@douyinfe/semi-foundation 2.36.0-beta.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 (415) hide show
  1. package/calendar/foundation.ts +2 -1
  2. package/lib/cjs/anchor/constants.js +0 -2
  3. package/lib/cjs/anchor/foundation.js +10 -73
  4. package/lib/cjs/anchor/linkFoundation.js +4 -16
  5. package/lib/cjs/autoComplete/constants.js +0 -3
  6. package/lib/cjs/autoComplete/foundation.d.ts +1 -1
  7. package/lib/cjs/autoComplete/foundation.js +25 -139
  8. package/lib/cjs/autoComplete/optionFoundation.js +4 -14
  9. package/lib/cjs/avatar/constants.js +0 -2
  10. package/lib/cjs/avatar/foundation.js +0 -17
  11. package/lib/cjs/backtop/constants.js +0 -2
  12. package/lib/cjs/backtop/foundation.d.ts +2 -2
  13. package/lib/cjs/backtop/foundation.js +0 -21
  14. package/lib/cjs/badge/constants.js +0 -2
  15. package/lib/cjs/banner/constants.js +0 -2
  16. package/lib/cjs/banner/foundation.js +0 -7
  17. package/lib/cjs/base/constants.js +2 -4
  18. package/lib/cjs/base/foundation.d.ts +1 -1
  19. package/lib/cjs/base/foundation.js +12 -46
  20. package/lib/cjs/base/index.js +0 -3
  21. package/lib/cjs/breadcrumb/constants.js +0 -2
  22. package/lib/cjs/breadcrumb/foundation.js +1 -12
  23. package/lib/cjs/breadcrumb/itemFoundation.js +0 -7
  24. package/lib/cjs/button/constants.js +0 -2
  25. package/lib/cjs/calendar/constants.js +0 -2
  26. package/lib/cjs/calendar/eventUtil.d.ts +1 -1
  27. package/lib/cjs/calendar/eventUtil.js +2 -74
  28. package/lib/cjs/calendar/foundation.d.ts +2 -2
  29. package/lib/cjs/calendar/foundation.js +28 -123
  30. package/lib/cjs/card/constants.js +0 -2
  31. package/lib/cjs/carousel/constants.js +0 -2
  32. package/lib/cjs/carousel/foundation.js +2 -52
  33. package/lib/cjs/cascader/constants.js +0 -3
  34. package/lib/cjs/cascader/foundation.d.ts +4 -4
  35. package/lib/cjs/cascader/foundation.js +28 -242
  36. package/lib/cjs/cascader/util.js +6 -24
  37. package/lib/cjs/checkbox/checkboxFoundation.js +2 -38
  38. package/lib/cjs/checkbox/checkboxGroupFoundation.js +2 -23
  39. package/lib/cjs/checkbox/constants.js +0 -2
  40. package/lib/cjs/collapse/constants.js +0 -2
  41. package/lib/cjs/collapse/foundation.d.ts +1 -1
  42. package/lib/cjs/collapse/foundation.js +2 -13
  43. package/lib/cjs/collapsible/constants.js +0 -2
  44. package/lib/cjs/collapsible/foundation.js +0 -9
  45. package/lib/cjs/datePicker/_utils/formatter.js +4 -10
  46. package/lib/cjs/datePicker/_utils/getDayOfWeek.d.ts +1 -1
  47. package/lib/cjs/datePicker/_utils/getDayOfWeek.js +0 -4
  48. package/lib/cjs/datePicker/_utils/getDefaultFormatToken.js +0 -5
  49. package/lib/cjs/datePicker/_utils/getDefaultPickerDate.d.ts +1 -1
  50. package/lib/cjs/datePicker/_utils/getDefaultPickerDate.js +0 -15
  51. package/lib/cjs/datePicker/_utils/getFullDateOffset.js +0 -7
  52. package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +0 -5
  53. package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +0 -6
  54. package/lib/cjs/datePicker/_utils/getMonthTable.d.ts +1 -1
  55. package/lib/cjs/datePicker/_utils/getMonthTable.js +3 -14
  56. package/lib/cjs/datePicker/_utils/getMonthsInYear.js +0 -2
  57. package/lib/cjs/datePicker/_utils/getYears.js +0 -4
  58. package/lib/cjs/datePicker/_utils/index.js +0 -13
  59. package/lib/cjs/datePicker/_utils/isAfter.js +0 -4
  60. package/lib/cjs/datePicker/_utils/isBefore.js +0 -4
  61. package/lib/cjs/datePicker/_utils/isBetween.js +0 -4
  62. package/lib/cjs/datePicker/_utils/isDate.js +0 -1
  63. package/lib/cjs/datePicker/_utils/isSameDay.js +0 -4
  64. package/lib/cjs/datePicker/_utils/isTimestamp.js +0 -4
  65. package/lib/cjs/datePicker/_utils/isUnixTimestamp.js +0 -4
  66. package/lib/cjs/datePicker/_utils/isValidDate.js +0 -1
  67. package/lib/cjs/datePicker/_utils/isValidTimeZone.js +0 -1
  68. package/lib/cjs/datePicker/_utils/isWithinInterval.js +0 -4
  69. package/lib/cjs/datePicker/_utils/parser.js +0 -10
  70. package/lib/cjs/datePicker/constants.js +0 -3
  71. package/lib/cjs/datePicker/foundation.d.ts +24 -24
  72. package/lib/cjs/datePicker/foundation.js +22 -333
  73. package/lib/cjs/datePicker/inputFoundation.d.ts +3 -3
  74. package/lib/cjs/datePicker/inputFoundation.js +5 -86
  75. package/lib/cjs/datePicker/monthFoundation.d.ts +1 -1
  76. package/lib/cjs/datePicker/monthFoundation.js +3 -28
  77. package/lib/cjs/datePicker/monthsGridFoundation.d.ts +3 -3
  78. package/lib/cjs/datePicker/monthsGridFoundation.js +43 -238
  79. package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +1 -1
  80. package/lib/cjs/datePicker/yearAndMonthFoundation.js +12 -38
  81. package/lib/cjs/descriptions/constants.js +0 -2
  82. package/lib/cjs/divider/constants.js +0 -2
  83. package/lib/cjs/dropdown/constants.js +0 -3
  84. package/lib/cjs/dropdown/foundation.js +4 -23
  85. package/lib/cjs/dropdown/menuFoundation.js +8 -27
  86. package/lib/cjs/empty/constants.js +0 -2
  87. package/lib/cjs/form/constants.js +0 -2
  88. package/lib/cjs/form/foundation.js +75 -206
  89. package/lib/cjs/form/interface.d.ts +5 -5
  90. package/lib/cjs/form/utils.js +47 -77
  91. package/lib/cjs/grid/constants.js +0 -2
  92. package/lib/cjs/highlight/constants.js +0 -2
  93. package/lib/cjs/icons/constants.js +0 -2
  94. package/lib/cjs/image/constants.js +0 -2
  95. package/lib/cjs/image/imageFoundation.js +4 -18
  96. package/lib/cjs/image/previewFooterFoundation.js +0 -13
  97. package/lib/cjs/image/previewFoundation.js +0 -11
  98. package/lib/cjs/image/previewImageFoundation.js +6 -80
  99. package/lib/cjs/image/previewInnerFoundation.js +12 -77
  100. package/lib/cjs/image/utils.js +0 -14
  101. package/lib/cjs/input/constants.js +0 -2
  102. package/lib/cjs/input/foundation.js +17 -101
  103. package/lib/cjs/input/textareaFoundation.js +20 -85
  104. package/lib/cjs/input/util/calculateNodeHeight.js +6 -18
  105. package/lib/cjs/input/util/getSizingData.js +7 -11
  106. package/lib/cjs/inputNumber/constants.js +0 -2
  107. package/lib/cjs/inputNumber/foundation.js +29 -192
  108. package/lib/cjs/layout/constants.js +0 -2
  109. package/lib/cjs/list/constants.js +0 -2
  110. package/lib/cjs/modal/constants.js +0 -2
  111. package/lib/cjs/modal/modalContentFoundation.js +0 -20
  112. package/lib/cjs/modal/modalFoundation.d.ts +2 -2
  113. package/lib/cjs/modal/modalFoundation.js +2 -22
  114. package/lib/cjs/navigation/NavItem.js +0 -10
  115. package/lib/cjs/navigation/constants.js +0 -3
  116. package/lib/cjs/navigation/foundation.js +3 -67
  117. package/lib/cjs/navigation/itemFoundation.js +3 -21
  118. package/lib/cjs/navigation/subNavFoundation.js +4 -40
  119. package/lib/cjs/notification/constants.js +0 -3
  120. package/lib/cjs/notification/notificationFoundation.d.ts +3 -3
  121. package/lib/cjs/notification/notificationFoundation.js +0 -16
  122. package/lib/cjs/notification/notificationListFoundation.js +7 -17
  123. package/lib/cjs/overflowList/constants.js +0 -2
  124. package/lib/cjs/overflowList/foundation.js +11 -41
  125. package/lib/cjs/pagination/constants.js +0 -2
  126. package/lib/cjs/pagination/foundation.d.ts +3 -3
  127. package/lib/cjs/pagination/foundation.js +21 -90
  128. package/lib/cjs/popconfirm/constants.js +0 -2
  129. package/lib/cjs/popconfirm/popconfirmFoundation.js +1 -21
  130. package/lib/cjs/popover/constants.js +0 -3
  131. package/lib/cjs/progress/constants.js +0 -2
  132. package/lib/cjs/progress/generates.d.ts +2 -2
  133. package/lib/cjs/progress/generates.js +19 -60
  134. package/lib/cjs/radio/constants.js +0 -2
  135. package/lib/cjs/radio/radioFoundation.js +0 -14
  136. package/lib/cjs/radio/radioGroupFoundation.js +4 -23
  137. package/lib/cjs/radio/radioInnerFoundation.js +2 -19
  138. package/lib/cjs/rating/constants.js +0 -2
  139. package/lib/cjs/rating/foundation.js +11 -61
  140. package/lib/cjs/scrollList/constants.js +0 -2
  141. package/lib/cjs/scrollList/foundation.js +0 -4
  142. package/lib/cjs/scrollList/itemFoundation.js +8 -61
  143. package/lib/cjs/scrollList/scrollTo.js +2 -5
  144. package/lib/cjs/select/constants.js +0 -3
  145. package/lib/cjs/select/foundation.d.ts +2 -2
  146. package/lib/cjs/select/foundation.js +122 -425
  147. package/lib/cjs/select/optionFoundation.js +4 -14
  148. package/lib/cjs/sideSheet/constants.js +0 -2
  149. package/lib/cjs/sideSheet/sideSheetFoundation.js +0 -18
  150. package/lib/cjs/skeleton/constants.js +0 -2
  151. package/lib/cjs/slider/constants.js +0 -2
  152. package/lib/cjs/slider/foundation.d.ts +1 -1
  153. package/lib/cjs/slider/foundation.js +25 -204
  154. package/lib/cjs/space/constants.js +0 -2
  155. package/lib/cjs/spin/constants.js +0 -2
  156. package/lib/cjs/spin/foundation.js +3 -13
  157. package/lib/cjs/steps/constants.js +0 -2
  158. package/lib/cjs/switch/constants.js +0 -2
  159. package/lib/cjs/switch/foundation.js +2 -18
  160. package/lib/cjs/table/bodyFoundation.js +2 -34
  161. package/lib/cjs/table/cellFoundation.js +0 -5
  162. package/lib/cjs/table/constants.js +7 -8
  163. package/lib/cjs/table/foundation.d.ts +17 -14
  164. package/lib/cjs/table/foundation.js +71 -302
  165. package/lib/cjs/table/tableRowFoundation.js +0 -11
  166. package/lib/cjs/table/tableSelectionCellFoundation.js +0 -6
  167. package/lib/cjs/table/utils.d.ts +2 -2
  168. package/lib/cjs/table/utils.js +5 -118
  169. package/lib/cjs/tabs/constants.js +0 -2
  170. package/lib/cjs/tabs/foundation.js +2 -40
  171. package/lib/cjs/tag/constants.js +1 -2
  172. package/lib/cjs/tagInput/constants.js +0 -2
  173. package/lib/cjs/tagInput/foundation.d.ts +4 -4
  174. package/lib/cjs/tagInput/foundation.js +4 -94
  175. package/lib/cjs/tagInput/utils/getSplitedArray.js +0 -11
  176. package/lib/cjs/timePicker/ComboxFoundation.js +4 -39
  177. package/lib/cjs/timePicker/constants.js +0 -3
  178. package/lib/cjs/timePicker/foundation.d.ts +1 -1
  179. package/lib/cjs/timePicker/foundation.js +3 -97
  180. package/lib/cjs/timePicker/inputFoundation.js +6 -25
  181. package/lib/cjs/timePicker/utils/index.js +6 -45
  182. package/lib/cjs/timePicker/utils/localeDate.js +0 -10
  183. package/lib/cjs/timeline/constants.js +0 -2
  184. package/lib/cjs/toast/constants.js +0 -3
  185. package/lib/cjs/toast/toastFoundation.d.ts +3 -3
  186. package/lib/cjs/toast/toastFoundation.js +0 -14
  187. package/lib/cjs/toast/toastListFoundation.js +4 -22
  188. package/lib/cjs/tooltip/constants.js +0 -2
  189. package/lib/cjs/tooltip/foundation.d.ts +1 -1
  190. package/lib/cjs/tooltip/foundation.js +63 -291
  191. package/lib/cjs/transfer/constants.js +0 -2
  192. package/lib/cjs/transfer/foundation.d.ts +1 -1
  193. package/lib/cjs/transfer/foundation.js +4 -68
  194. package/lib/cjs/transfer/transferUtils.js +5 -27
  195. package/lib/cjs/tree/constants.js +0 -2
  196. package/lib/cjs/tree/foundation.d.ts +3 -3
  197. package/lib/cjs/tree/foundation.js +34 -150
  198. package/lib/cjs/tree/treeUtil.js +54 -173
  199. package/lib/cjs/treeSelect/constants.js +0 -2
  200. package/lib/cjs/treeSelect/foundation.d.ts +7 -7
  201. package/lib/cjs/treeSelect/foundation.js +18 -192
  202. package/lib/cjs/typography/constants.js +0 -2
  203. package/lib/cjs/typography/formatNumeral.d.ts +3 -3
  204. package/lib/cjs/typography/formatNumeral.js +16 -32
  205. package/lib/cjs/upload/constants.js +0 -2
  206. package/lib/cjs/upload/foundation.d.ts +5 -5
  207. package/lib/cjs/upload/foundation.js +36 -245
  208. package/lib/cjs/upload/utils.js +10 -29
  209. package/lib/cjs/utils/Event.js +2 -21
  210. package/lib/cjs/utils/FocusHandle.d.ts +1 -1
  211. package/lib/cjs/utils/FocusHandle.js +6 -35
  212. package/lib/cjs/utils/Logger.js +0 -21
  213. package/lib/cjs/utils/Store.js +0 -10
  214. package/lib/cjs/utils/a11y.js +18 -43
  215. package/lib/cjs/utils/array.d.ts +1 -1
  216. package/lib/cjs/utils/array.js +0 -7
  217. package/lib/cjs/utils/arrayMove.js +0 -1
  218. package/lib/cjs/utils/classnames.js +0 -12
  219. package/lib/cjs/utils/date-fns-extra.js +0 -35
  220. package/lib/cjs/utils/dom.d.ts +1 -1
  221. package/lib/cjs/utils/dom.js +0 -13
  222. package/lib/cjs/utils/function.js +0 -1
  223. package/lib/cjs/utils/getDataAttr.js +0 -2
  224. package/lib/cjs/utils/getHighlight.js +5 -26
  225. package/lib/cjs/utils/getMotionObjFromProps.js +0 -12
  226. package/lib/cjs/utils/index.js +0 -4
  227. package/lib/cjs/utils/isBothNaN.js +0 -2
  228. package/lib/cjs/utils/isElement.js +0 -1
  229. package/lib/cjs/utils/isEnterPress.js +0 -5
  230. package/lib/cjs/utils/isEscPress.js +0 -5
  231. package/lib/cjs/utils/isNullOrUndefined.js +0 -1
  232. package/lib/cjs/utils/isNumber.js +0 -1
  233. package/lib/cjs/utils/isObject.js +0 -1
  234. package/lib/cjs/utils/isPromise.js +0 -3
  235. package/lib/cjs/utils/isString.js +0 -1
  236. package/lib/cjs/utils/keyCode.js +0 -105
  237. package/lib/cjs/utils/log.js +0 -5
  238. package/lib/cjs/utils/number.js +0 -2
  239. package/lib/cjs/utils/object.d.ts +4 -4
  240. package/lib/cjs/utils/object.js +12 -34
  241. package/lib/cjs/utils/set.js +0 -8
  242. package/lib/cjs/utils/shallowEqualObjects.js +0 -7
  243. package/lib/cjs/utils/touchPolyfill.js +0 -7
  244. package/lib/cjs/utils/type.d.ts +3 -3
  245. package/lib/cjs/utils/uuid.js +2 -9
  246. package/lib/cjs/utils/warning.js +0 -1
  247. package/lib/es/anchor/foundation.js +10 -66
  248. package/lib/es/anchor/linkFoundation.js +4 -12
  249. package/lib/es/autoComplete/foundation.d.ts +1 -1
  250. package/lib/es/autoComplete/foundation.js +24 -132
  251. package/lib/es/autoComplete/optionFoundation.js +4 -10
  252. package/lib/es/avatar/foundation.js +0 -12
  253. package/lib/es/backtop/foundation.d.ts +2 -2
  254. package/lib/es/backtop/foundation.js +0 -16
  255. package/lib/es/banner/foundation.js +0 -3
  256. package/lib/es/base/constants.js +2 -2
  257. package/lib/es/base/foundation.d.ts +1 -1
  258. package/lib/es/base/foundation.js +11 -44
  259. package/lib/es/breadcrumb/foundation.js +0 -7
  260. package/lib/es/breadcrumb/itemFoundation.js +0 -3
  261. package/lib/es/calendar/eventUtil.d.ts +1 -1
  262. package/lib/es/calendar/eventUtil.js +2 -36
  263. package/lib/es/calendar/foundation.d.ts +2 -2
  264. package/lib/es/calendar/foundation.js +28 -117
  265. package/lib/es/carousel/foundation.js +2 -47
  266. package/lib/es/cascader/constants.js +0 -1
  267. package/lib/es/cascader/foundation.d.ts +4 -4
  268. package/lib/es/cascader/foundation.js +30 -226
  269. package/lib/es/cascader/util.js +6 -15
  270. package/lib/es/checkbox/checkboxFoundation.js +2 -34
  271. package/lib/es/checkbox/checkboxGroupFoundation.js +2 -20
  272. package/lib/es/collapse/foundation.d.ts +1 -1
  273. package/lib/es/collapse/foundation.js +2 -9
  274. package/lib/es/collapsible/foundation.js +0 -7
  275. package/lib/es/datePicker/_utils/formatter.js +4 -8
  276. package/lib/es/datePicker/_utils/getDayOfWeek.d.ts +1 -1
  277. package/lib/es/datePicker/_utils/getDayOfWeek.js +0 -3
  278. package/lib/es/datePicker/_utils/getDefaultFormatToken.js +0 -2
  279. package/lib/es/datePicker/_utils/getDefaultPickerDate.d.ts +1 -1
  280. package/lib/es/datePicker/_utils/getDefaultPickerDate.js +0 -10
  281. package/lib/es/datePicker/_utils/getFullDateOffset.js +0 -3
  282. package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +0 -4
  283. package/lib/es/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +0 -5
  284. package/lib/es/datePicker/_utils/getMonthTable.d.ts +1 -1
  285. package/lib/es/datePicker/_utils/getMonthTable.js +4 -14
  286. package/lib/es/datePicker/_utils/getMonthsInYear.js +0 -1
  287. package/lib/es/datePicker/_utils/getYears.js +0 -3
  288. package/lib/es/datePicker/_utils/isBetween.js +0 -1
  289. package/lib/es/datePicker/_utils/parser.js +0 -8
  290. package/lib/es/datePicker/foundation.d.ts +24 -24
  291. package/lib/es/datePicker/foundation.js +22 -318
  292. package/lib/es/datePicker/inputFoundation.d.ts +3 -3
  293. package/lib/es/datePicker/inputFoundation.js +5 -74
  294. package/lib/es/datePicker/monthFoundation.d.ts +1 -1
  295. package/lib/es/datePicker/monthFoundation.js +4 -22
  296. package/lib/es/datePicker/monthsGridFoundation.d.ts +3 -3
  297. package/lib/es/datePicker/monthsGridFoundation.js +42 -222
  298. package/lib/es/datePicker/yearAndMonthFoundation.d.ts +1 -1
  299. package/lib/es/datePicker/yearAndMonthFoundation.js +12 -36
  300. package/lib/es/dropdown/foundation.js +4 -18
  301. package/lib/es/dropdown/menuFoundation.js +8 -22
  302. package/lib/es/form/foundation.js +74 -195
  303. package/lib/es/form/interface.d.ts +5 -5
  304. package/lib/es/form/utils.js +47 -70
  305. package/lib/es/image/imageFoundation.js +4 -13
  306. package/lib/es/image/previewFooterFoundation.js +0 -9
  307. package/lib/es/image/previewFoundation.js +0 -7
  308. package/lib/es/image/previewImageFoundation.js +6 -72
  309. package/lib/es/image/previewInnerFoundation.js +12 -70
  310. package/lib/es/image/utils.js +0 -6
  311. package/lib/es/input/foundation.js +17 -93
  312. package/lib/es/input/textareaFoundation.js +20 -75
  313. package/lib/es/input/util/calculateNodeHeight.js +6 -18
  314. package/lib/es/input/util/getSizingData.js +7 -11
  315. package/lib/es/inputNumber/foundation.js +28 -183
  316. package/lib/es/modal/modalContentFoundation.js +0 -15
  317. package/lib/es/modal/modalFoundation.d.ts +2 -2
  318. package/lib/es/modal/modalFoundation.js +2 -17
  319. package/lib/es/navigation/NavItem.js +0 -6
  320. package/lib/es/navigation/constants.js +1 -1
  321. package/lib/es/navigation/foundation.js +2 -60
  322. package/lib/es/navigation/itemFoundation.js +3 -18
  323. package/lib/es/navigation/subNavFoundation.js +4 -36
  324. package/lib/es/notification/constants.js +1 -1
  325. package/lib/es/notification/notificationFoundation.d.ts +3 -3
  326. package/lib/es/notification/notificationFoundation.js +0 -11
  327. package/lib/es/notification/notificationListFoundation.js +6 -13
  328. package/lib/es/overflowList/foundation.js +11 -37
  329. package/lib/es/pagination/foundation.d.ts +3 -3
  330. package/lib/es/pagination/foundation.js +20 -87
  331. package/lib/es/popconfirm/popconfirmFoundation.js +1 -16
  332. package/lib/es/progress/generates.d.ts +2 -2
  333. package/lib/es/progress/generates.js +19 -59
  334. package/lib/es/radio/radioFoundation.js +0 -9
  335. package/lib/es/radio/radioGroupFoundation.js +4 -19
  336. package/lib/es/radio/radioInnerFoundation.js +2 -15
  337. package/lib/es/rating/foundation.js +10 -54
  338. package/lib/es/scrollList/itemFoundation.js +8 -60
  339. package/lib/es/scrollList/scrollTo.js +2 -4
  340. package/lib/es/select/foundation.d.ts +2 -2
  341. package/lib/es/select/foundation.js +122 -411
  342. package/lib/es/select/optionFoundation.js +4 -10
  343. package/lib/es/sideSheet/sideSheetFoundation.js +0 -12
  344. package/lib/es/slider/foundation.d.ts +1 -1
  345. package/lib/es/slider/foundation.js +24 -197
  346. package/lib/es/spin/foundation.js +3 -11
  347. package/lib/es/switch/foundation.js +2 -13
  348. package/lib/es/table/bodyFoundation.js +2 -25
  349. package/lib/es/table/cellFoundation.js +0 -1
  350. package/lib/es/table/constants.js +6 -6
  351. package/lib/es/table/foundation.d.ts +17 -14
  352. package/lib/es/table/foundation.js +71 -309
  353. package/lib/es/table/tableRowFoundation.js +2 -9
  354. package/lib/es/table/tableSelectionCellFoundation.js +0 -2
  355. package/lib/es/table/utils.d.ts +2 -2
  356. package/lib/es/table/utils.js +5 -81
  357. package/lib/es/tabs/foundation.js +2 -35
  358. package/lib/es/tagInput/foundation.d.ts +4 -4
  359. package/lib/es/tagInput/foundation.js +4 -84
  360. package/lib/es/tagInput/utils/getSplitedArray.js +0 -7
  361. package/lib/es/timePicker/ComboxFoundation.js +4 -30
  362. package/lib/es/timePicker/foundation.d.ts +1 -1
  363. package/lib/es/timePicker/foundation.js +4 -90
  364. package/lib/es/timePicker/inputFoundation.js +6 -22
  365. package/lib/es/timePicker/utils/index.js +6 -25
  366. package/lib/es/timePicker/utils/localeDate.js +0 -8
  367. package/lib/es/toast/constants.js +1 -1
  368. package/lib/es/toast/toastFoundation.d.ts +3 -3
  369. package/lib/es/toast/toastFoundation.js +0 -9
  370. package/lib/es/toast/toastListFoundation.js +4 -18
  371. package/lib/es/tooltip/foundation.d.ts +1 -1
  372. package/lib/es/tooltip/foundation.js +63 -288
  373. package/lib/es/transfer/foundation.d.ts +1 -1
  374. package/lib/es/transfer/foundation.js +6 -62
  375. package/lib/es/transfer/transferUtils.js +5 -21
  376. package/lib/es/tree/foundation.d.ts +3 -3
  377. package/lib/es/tree/foundation.js +34 -143
  378. package/lib/es/tree/treeUtil.js +54 -139
  379. package/lib/es/treeSelect/foundation.d.ts +7 -7
  380. package/lib/es/treeSelect/foundation.js +20 -179
  381. package/lib/es/typography/formatNumeral.d.ts +3 -3
  382. package/lib/es/typography/formatNumeral.js +16 -29
  383. package/lib/es/upload/foundation.d.ts +5 -5
  384. package/lib/es/upload/foundation.js +36 -238
  385. package/lib/es/upload/utils.js +10 -24
  386. package/lib/es/utils/Event.js +2 -17
  387. package/lib/es/utils/FocusHandle.d.ts +1 -1
  388. package/lib/es/utils/FocusHandle.js +6 -32
  389. package/lib/es/utils/Logger.js +0 -20
  390. package/lib/es/utils/Store.js +0 -9
  391. package/lib/es/utils/a11y.js +18 -31
  392. package/lib/es/utils/array.d.ts +1 -1
  393. package/lib/es/utils/array.js +0 -5
  394. package/lib/es/utils/classnames.js +0 -10
  395. package/lib/es/utils/date-fns-extra.js +0 -27
  396. package/lib/es/utils/dom.d.ts +1 -1
  397. package/lib/es/utils/dom.js +0 -9
  398. package/lib/es/utils/getDataAttr.js +0 -1
  399. package/lib/es/utils/getHighlight.js +5 -26
  400. package/lib/es/utils/getMotionObjFromProps.js +0 -8
  401. package/lib/es/utils/isBothNaN.js +0 -1
  402. package/lib/es/utils/isEnterPress.js +0 -2
  403. package/lib/es/utils/isEscPress.js +0 -2
  404. package/lib/es/utils/keyCode.js +0 -104
  405. package/lib/es/utils/log.js +0 -3
  406. package/lib/es/utils/object.d.ts +4 -4
  407. package/lib/es/utils/object.js +12 -28
  408. package/lib/es/utils/set.js +0 -5
  409. package/lib/es/utils/shallowEqualObjects.js +0 -6
  410. package/lib/es/utils/touchPolyfill.js +0 -5
  411. package/lib/es/utils/type.d.ts +3 -3
  412. package/lib/es/utils/uuid.js +2 -8
  413. package/package.json +2 -2
  414. package/table/foundation.ts +7 -10
  415. package/upload/foundation.ts +8 -8
@@ -12,36 +12,30 @@ import BaseFoundation from '../base/foundation';
12
12
  import { filter, findAncestorKeys, calcCheckedKeysForUnchecked, calcCheckedKeysForChecked, calcCheckedKeys, findDescendantKeys, normalizeKeyList } from '../tree/treeUtil';
13
13
  import { convertDataToEntities, findKeysForValues, normalizedArr, isValid, calcMergeType } from './util';
14
14
  import { strings } from './constants';
15
- import isEnterPress from '../utils/isEnterPress'; // eslint-disable-next-line max-len
16
-
15
+ import isEnterPress from '../utils/isEnterPress';
16
+ // eslint-disable-next-line max-len
17
17
  export default class CascaderFoundation extends BaseFoundation {
18
18
  constructor(adapter) {
19
19
  super(Object.assign({}, adapter));
20
-
21
20
  this.updateSearching = isSearching => {
22
21
  this._adapter.updateStates({
23
22
  isSearching: false
24
23
  });
25
24
  };
26
25
  }
27
-
28
26
  init() {
29
27
  const isOpen = this.getProp('open') || this.getProp('defaultOpen');
30
28
  this.collectOptions(true);
31
-
32
29
  if (isOpen && !this._isDisabled()) {
33
30
  this.open();
34
31
  }
35
32
  }
36
-
37
33
  destroy() {
38
34
  this._adapter.unregisterClickOutsideHandler();
39
35
  }
40
-
41
36
  _isDisabled() {
42
37
  return this.getProp('disabled');
43
38
  }
44
-
45
39
  _isFilterable() {
46
40
  return Boolean(this.getProp('filterTreeNode')); // filter can be boolean or function
47
41
  }
@@ -52,78 +46,65 @@ export default class CascaderFoundation extends BaseFoundation {
52
46
  multiple
53
47
  } = this.getProps();
54
48
  const valueProp = onChangeWithObject ? [] : 'value';
55
-
56
49
  if (multiple) {
57
- const valuePath = []; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
50
+ const valuePath = [];
51
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
58
52
  // @ts-ignore
59
-
60
53
  item.forEach(checkedKey => {
61
54
  const valuePathItem = this.getItemPropPath(checkedKey, valueProp);
62
55
  valuePath.push(valuePathItem);
63
56
  });
64
-
65
57
  this._adapter.notifyChange(valuePath);
66
58
  } else {
67
59
  const valuePath = _isUndefined(item) || !('key' in item) ? [] : this.getItemPropPath(item.key, valueProp);
68
-
69
60
  this._adapter.notifyChange(valuePath);
70
61
  }
71
62
  }
72
-
73
63
  _isLeaf(item) {
74
64
  if (this.getProp('loadData')) {
75
65
  return Boolean(item.isLeaf);
76
66
  }
77
-
78
67
  return !item.children || !item.children.length;
79
68
  }
80
-
81
69
  _clearInput() {
82
70
  this._adapter.updateInputValue('');
83
- } // Scenes that may trigger blur:
71
+ }
72
+ // Scenes that may trigger blur:
84
73
  // 1、clickOutSide
85
-
86
-
87
74
  _notifyBlur(e) {
88
75
  this._adapter.notifyBlur(e);
89
- } // Scenes that may trigger focus:
76
+ }
77
+ // Scenes that may trigger focus:
90
78
  // 1、click selection
91
-
92
-
93
79
  _notifyFocus(e) {
94
80
  this._adapter.notifyFocus(e);
95
81
  }
96
-
97
82
  _isOptionDisabled(key, keyEntities) {
98
83
  const isDisabled = findAncestorKeys([key], keyEntities, true).some(item => keyEntities[item].data.disabled);
99
84
  return isDisabled;
100
85
  }
101
-
102
86
  getCopyFromState(items) {
103
87
  const res = {};
104
88
  normalizedArr(items).forEach(key => {
105
89
  res[key] = _cloneDeep(this.getState(key));
106
90
  });
107
91
  return res;
108
- } // prop: is array, return all data
109
-
110
-
92
+ }
93
+ // prop: is array, return all data
111
94
  getItemPropPath(selectedKey, prop, keyEntities) {
112
95
  const searchMap = keyEntities || this.getState('keyEntities');
113
96
  const selectedItem = searchMap[selectedKey];
114
97
  let path = [];
115
-
116
- if (!selectedItem) {// do nothing
98
+ if (!selectedItem) {
99
+ // do nothing
117
100
  } else if (selectedItem._notExist) {
118
101
  path = selectedItem.path;
119
102
  } else {
120
103
  const keyPath = selectedItem.path;
121
104
  path = Array.isArray(prop) ? keyPath.map(key => searchMap[key].data) : keyPath.map(key => searchMap[key].data[prop]);
122
105
  }
123
-
124
106
  return path;
125
107
  }
126
-
127
108
  _getCacheValue(keyEntities) {
128
109
  const {
129
110
  selectedKeys
@@ -131,13 +112,12 @@ export default class CascaderFoundation extends BaseFoundation {
131
112
  const selectedKey = Array.from(selectedKeys)[0];
132
113
  let cacheValue;
133
114
  /* selectedKeys does not match keyEntities */
134
-
135
115
  if (_isEmpty(keyEntities[selectedKey])) {
136
116
  if (_includes(selectedKey, 'not-exist-')) {
137
117
  /* Get the value behind not-exist- */
138
118
  // eslint-disable-next-line prefer-destructuring
139
- const targetValue = selectedKey.match(/not-exist-(\S*)/)[1]; // eslint-disable-next-line max-depth
140
-
119
+ const targetValue = selectedKey.match(/not-exist-(\S*)/)[1];
120
+ // eslint-disable-next-line max-depth
141
121
  if (_isEmpty(keyEntities[targetValue])) {
142
122
  cacheValue = targetValue;
143
123
  } else {
@@ -149,7 +129,6 @@ export default class CascaderFoundation extends BaseFoundation {
149
129
  * 中存在,则 selectedKeys=Set('0-0'),此时输入框显示 0-0 的 label。 这个地
150
130
  * 方做的操作就是,为了例子中第二次更新后 0-0 label 能够正常显示。
151
131
  */
152
-
153
132
  /**
154
133
  * The typical scenario is: suppose we select the 0-0 node, at this time
155
134
  * selectedKeys=Set('0-0'), the input box will display a 0-0 label. When
@@ -167,15 +146,12 @@ export default class CascaderFoundation extends BaseFoundation {
167
146
  cacheValue = selectedKey;
168
147
  }
169
148
  /* selectedKeys match keyEntities */
170
-
171
149
  } else {
172
150
  /* selectedKeys match keyEntities */
173
151
  cacheValue = keyEntities[selectedKey].valuePath;
174
152
  }
175
-
176
153
  return cacheValue;
177
154
  }
178
-
179
155
  collectOptions() {
180
156
  let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
181
157
  const {
@@ -184,20 +160,15 @@ export default class CascaderFoundation extends BaseFoundation {
184
160
  defaultValue
185
161
  } = this.getProps();
186
162
  const keyEntities = convertDataToEntities(treeData);
187
-
188
163
  this._adapter.rePositionDropdown();
189
-
190
164
  let cacheValue;
191
165
  /* when mount */
192
-
193
166
  if (init) {
194
167
  cacheValue = defaultValue;
195
168
  } else if (!_isEmpty(keyEntities)) {
196
169
  cacheValue = this._getCacheValue(keyEntities);
197
170
  }
198
-
199
171
  const selectedValue = !this._isControlledComponent() ? cacheValue : value;
200
-
201
172
  if (isValid(selectedValue)) {
202
173
  this.updateSelectedKey(selectedValue, keyEntities);
203
174
  } else {
@@ -205,9 +176,8 @@ export default class CascaderFoundation extends BaseFoundation {
205
176
  keyEntities
206
177
  });
207
178
  }
208
- } // call when props.value change
209
-
210
-
179
+ }
180
+ // call when props.value change
211
181
  handleValueChange(value) {
212
182
  const {
213
183
  keyEntities
@@ -221,8 +191,6 @@ export default class CascaderFoundation extends BaseFoundation {
221
191
  * When single selection, the clear objects of
222
192
  * selectedKeys, activeKeys, filteredKeys, input, etc.
223
193
  */
224
-
225
-
226
194
  _getClearSelectedKey(filterable) {
227
195
  const updateStates = {};
228
196
  const {
@@ -233,15 +201,12 @@ export default class CascaderFoundation extends BaseFoundation {
233
201
  updateStates.selectedKeys = new Set([]);
234
202
  updateStates.activeKeys = new Set([]);
235
203
  updateStates.filteredKeys = new Set([]);
236
-
237
204
  if (filterable && !multiple) {
238
205
  updateStates.inputPlaceHolder = searchPlaceholder || placeholder || '';
239
206
  updateStates.inputValue = '';
240
207
  }
241
-
242
208
  return updateStates;
243
209
  }
244
-
245
210
  updateSelectedKey(value, keyEntities) {
246
211
  const {
247
212
  changeOnSelect,
@@ -255,14 +220,11 @@ export default class CascaderFoundation extends BaseFoundation {
255
220
  keyEntities: keyEntityState,
256
221
  selectedKeys: selectedKeysState
257
222
  } = this.getStates();
258
-
259
223
  const filterable = this._isFilterable();
260
-
261
224
  const loadingActive = [...activeKeys].filter(i => loadingKeys.has(i));
262
225
  const valuePath = onChangeWithObject ? normalizedArr(value).map(i => i.value) : normalizedArr(value);
263
226
  const selectedKeys = findKeysForValues(valuePath, keyEntities);
264
227
  let updateStates = {};
265
-
266
228
  if (selectedKeys.length) {
267
229
  const selectedKey = selectedKeys[0];
268
230
  const selectedItem = keyEntities[selectedKey];
@@ -270,14 +232,11 @@ export default class CascaderFoundation extends BaseFoundation {
270
232
  * When changeOnSelect is turned on, or the target option is a leaf option,
271
233
  * the option is considered to be selected, even if the option is disabled
272
234
  */
273
-
274
235
  if (changeOnSelect || this._isLeaf(selectedItem.data)) {
275
236
  updateStates.selectedKeys = new Set([selectedKey]);
276
-
277
237
  if (!loadingActive.length) {
278
238
  updateStates.activeKeys = new Set(selectedItem.path);
279
239
  }
280
-
281
240
  if (filterable && !multiple) {
282
241
  const displayText = this.renderDisplayText(selectedKey, keyEntities);
283
242
  updateStates.inputPlaceHolder = displayText;
@@ -297,7 +256,6 @@ export default class CascaderFoundation extends BaseFoundation {
297
256
  * is a non-leaf node. At this point, selectedKeys should
298
257
  * be cleared.
299
258
  */
300
-
301
259
  } else if (_isEqual(selectedKeys, Array.from(selectedKeysState))) {
302
260
  updateStates = this._getClearSelectedKey(filterable);
303
261
  }
@@ -314,10 +272,8 @@ export default class CascaderFoundation extends BaseFoundation {
314
272
  _notExist: true
315
273
  };
316
274
  updateStates.selectedKeys = new Set([key]);
317
-
318
275
  if (filterable && !multiple) {
319
276
  const displayText = this._defaultRenderText(valuePath);
320
-
321
277
  updateStates.inputPlaceHolder = displayText;
322
278
  /*
323
279
  * displayText should not be assign to inputValue,
@@ -326,48 +282,36 @@ export default class CascaderFoundation extends BaseFoundation {
326
282
  // updateStates.inputValue = displayText;
327
283
  }
328
284
 
329
- keyEntities[key] = optionNotExist; // Fix: 1155, if the data is loaded asynchronously to update treeData, the emptying operation should not be done when entering the updateSelectedKey method
285
+ keyEntities[key] = optionNotExist;
286
+ // Fix: 1155, if the data is loaded asynchronously to update treeData, the emptying operation should not be done when entering the updateSelectedKey method
330
287
  } else if (loading) {
331
288
  // Use assign to avoid overwriting the'not-exist- * 'property of keyEntities after asynchronous loading
332
289
  // Overwriting'not-exist- * 'will cause selectionContent to be emptied unexpectedly when clicking on a dropDown item
333
290
  updateStates.keyEntities = _assign(keyEntityState, keyEntities);
334
-
335
291
  this._adapter.updateStates(updateStates);
336
-
337
292
  return;
338
293
  } else {
339
294
  updateStates = this._getClearSelectedKey(filterable);
340
295
  }
341
-
342
296
  updateStates.keyEntities = keyEntities;
343
-
344
297
  this._adapter.updateStates(updateStates);
345
298
  }
346
-
347
299
  open() {
348
300
  const filterable = this._isFilterable();
349
-
350
301
  const {
351
302
  multiple
352
303
  } = this.getProps();
353
-
354
304
  this._adapter.openMenu();
355
-
356
305
  if (filterable) {
357
306
  this._clearInput();
358
-
359
307
  !multiple && this.toggle2SearchInput(true);
360
308
  }
361
-
362
309
  if (this._isControlledComponent()) {
363
310
  this.reCalcActiveKeys();
364
311
  }
365
-
366
312
  this._adapter.notifyDropdownVisibleChange(true);
367
-
368
313
  this._adapter.registerClickOutsideHandler(e => this.close(e));
369
314
  }
370
-
371
315
  reCalcActiveKeys() {
372
316
  const {
373
317
  selectedKeys,
@@ -376,79 +320,60 @@ export default class CascaderFoundation extends BaseFoundation {
376
320
  } = this.getStates();
377
321
  const selectedKey = [...selectedKeys][0];
378
322
  const selectedItem = keyEntities[selectedKey];
379
-
380
323
  if (!selectedItem) {
381
324
  return;
382
325
  }
383
-
384
326
  const newActiveKeys = new Set(selectedItem.path);
385
-
386
327
  if (!_isEqual(newActiveKeys, activeKeys)) {
387
328
  this._adapter.updateStates({
388
329
  activeKeys: newActiveKeys
389
330
  });
390
331
  }
391
332
  }
392
-
393
333
  close(e, key) {
394
334
  const {
395
335
  multiple
396
336
  } = this.getProps();
397
-
398
337
  this._adapter.closeMenu();
399
-
400
338
  this._adapter.notifyDropdownVisibleChange(false);
401
-
402
339
  this._adapter.unregisterClickOutsideHandler();
403
-
404
340
  if (this._isFilterable()) {
405
341
  const {
406
342
  selectedKeys,
407
343
  isSearching
408
344
  } = this.getStates();
409
345
  let inputValue = '';
410
-
411
346
  if (key && !multiple) {
412
347
  inputValue = this.renderDisplayText(key);
413
348
  } else if (selectedKeys.size && !multiple) {
414
349
  inputValue = this.renderDisplayText([...selectedKeys][0]);
415
350
  }
416
-
417
351
  this._adapter.updateStates({
418
352
  inputValue
419
353
  });
420
-
421
354
  !multiple && this.toggle2SearchInput(false);
422
355
  !multiple && this._adapter.updateFocusState(false);
423
356
  }
424
-
425
357
  this._notifyBlur(e);
426
358
  }
427
-
428
359
  focus() {
429
360
  const {
430
361
  filterTreeNode
431
362
  } = this.getProps();
432
-
433
363
  if (filterTreeNode) {
434
364
  this._adapter.focusInput();
435
365
  }
436
-
437
366
  this._adapter.updateFocusState(true);
438
367
  }
439
-
440
368
  blur() {
441
369
  const {
442
370
  filterTreeNode
443
371
  } = this.getProps();
444
-
445
372
  if (filterTreeNode) {
446
373
  this._adapter.blurInput();
447
374
  }
448
-
449
375
  this._adapter.updateFocusState(false);
450
376
  }
451
-
452
377
  toggle2SearchInput(isShow) {
453
378
  if (isShow) {
454
379
  this._adapter.toggleInputShow(isShow, () => this.focus());
@@ -456,29 +381,21 @@ export default class CascaderFoundation extends BaseFoundation {
456
381
  this._adapter.toggleInputShow(isShow, () => undefined);
457
382
  }
458
383
  }
459
-
460
384
  handleItemClick(e, item) {
461
385
  const isDisabled = this._isDisabled();
462
-
463
386
  if (isDisabled) {
464
387
  return;
465
388
  }
466
-
467
389
  this.handleSingleSelect(e, item);
468
-
469
390
  this._adapter.rePositionDropdown();
470
391
  }
471
-
472
392
  handleItemHover(e, item) {
473
393
  const isDisabled = this._isDisabled();
474
-
475
394
  if (isDisabled) {
476
395
  return;
477
396
  }
478
-
479
397
  this.handleShowNextByHover(item);
480
398
  }
481
-
482
399
  handleShowNextByHover(item) {
483
400
  const {
484
401
  keyEntities
@@ -487,46 +404,33 @@ export default class CascaderFoundation extends BaseFoundation {
487
404
  data,
488
405
  key
489
406
  } = item;
490
-
491
407
  const isLeaf = this._isLeaf(data);
492
-
493
408
  const activeKeys = keyEntities[key].path;
494
-
495
409
  this._adapter.updateStates({
496
410
  activeKeys: new Set(activeKeys)
497
411
  });
498
-
499
412
  if (!isLeaf) {
500
413
  this.notifyIfLoadData(item);
501
414
  }
502
415
  }
503
-
504
416
  onItemCheckboxClick(item) {
505
417
  const isDisabled = this._isDisabled();
506
-
507
418
  if (isDisabled) {
508
419
  return;
509
420
  }
510
-
511
421
  this._handleMultipleSelect(item);
512
-
513
422
  this._adapter.rePositionDropdown();
514
423
  }
515
-
516
424
  handleClick(e) {
517
425
  const isDisabled = this._isDisabled();
518
-
519
426
  const isFilterable = this._isFilterable();
520
-
521
427
  const {
522
428
  isOpen
523
429
  } = this.getStates();
524
-
525
430
  if (isDisabled) {
526
431
  return;
527
432
  } else if (!isOpen) {
528
433
  this.open();
529
-
530
434
  this._notifyFocus(e);
531
435
  } else if (isOpen && !isFilterable) {
532
436
  this.close(e);
@@ -535,37 +439,29 @@ export default class CascaderFoundation extends BaseFoundation {
535
439
  /**
536
440
  * A11y: simulate selection click
537
441
  */
538
-
539
442
  /* istanbul ignore next */
540
-
541
-
542
443
  handleSelectionEnterPress(keyboardEvent) {
543
444
  if (isEnterPress(keyboardEvent)) {
544
445
  this.handleClick(keyboardEvent);
545
446
  }
546
447
  }
547
-
548
448
  toggleHoverState(bool) {
549
449
  this._adapter.toggleHovering(bool);
550
450
  }
551
-
552
451
  _defaultRenderText(path, displayRender) {
553
452
  const separator = this.getProp('separator');
554
-
555
453
  if (displayRender && typeof displayRender === 'function') {
556
454
  return displayRender(path);
557
455
  } else {
558
456
  return path.join(separator);
559
457
  }
560
458
  }
561
-
562
459
  renderDisplayText(targetKey, keyEntities) {
563
460
  const renderFunc = this.getProp('displayRender');
564
461
  const displayProp = this.getProp('displayProp');
565
462
  const displayPath = this.getItemPropPath(targetKey, displayProp, keyEntities);
566
463
  return this._defaultRenderText(displayPath, renderFunc);
567
464
  }
568
-
569
465
  handleNodeLoad(item) {
570
466
  const {
571
467
  data,
@@ -577,52 +473,42 @@ export default class CascaderFoundation extends BaseFoundation {
577
473
  } = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
578
474
  const newLoadedKeys = prevLoadedKeys.add(key);
579
475
  const newLoadingKeys = new Set([...prevLoadingKeys]);
580
- newLoadingKeys.delete(key); // onLoad should trigger before internal setState to avoid `loadData` trigger twice.
581
-
476
+ newLoadingKeys.delete(key);
477
+ // onLoad should trigger before internal setState to avoid `loadData` trigger twice.
582
478
  this._adapter.notifyOnLoad(newLoadedKeys, data);
583
-
584
479
  this._adapter.updateStates({
585
480
  loadingKeys: newLoadingKeys
586
481
  });
587
482
  }
588
-
589
483
  notifyIfLoadData(item) {
590
484
  const {
591
485
  data,
592
486
  key
593
487
  } = item;
594
-
595
488
  this._adapter.updateStates({
596
489
  loading: false
597
490
  });
598
-
599
491
  if (!data.isLeaf && !data.children && this.getProp('loadData')) {
600
492
  const {
601
493
  loadedKeys,
602
494
  loadingKeys
603
495
  } = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
604
-
605
496
  if (loadedKeys.has(key) || loadingKeys.has(key)) {
606
497
  return;
607
498
  }
608
-
609
499
  this._adapter.updateStates({
610
500
  loading: true
611
501
  });
612
-
613
502
  const {
614
503
  keyEntities
615
504
  } = this.getStates();
616
505
  const optionPath = this.getItemPropPath(key, [], keyEntities);
617
-
618
506
  this._adapter.updateStates({
619
507
  loadingKeys: loadingKeys.add(key)
620
508
  });
621
-
622
509
  this._adapter.notifyLoadData(optionPath, this.handleNodeLoad.bind(this, item));
623
510
  }
624
511
  }
625
-
626
512
  handleSingleSelect(e, item) {
627
513
  const {
628
514
  changeOnSelect: allowChange,
@@ -635,68 +521,51 @@ export default class CascaderFoundation extends BaseFoundation {
635
521
  selectedKeys,
636
522
  isSearching
637
523
  } = this.getStates();
638
-
639
524
  const filterable = this._isFilterable();
640
-
641
525
  const {
642
526
  data,
643
527
  key
644
528
  } = item;
645
-
646
529
  const isLeaf = this._isLeaf(data);
647
-
648
530
  const activeKeys = keyEntities[key].path;
649
531
  const selectedKey = [key];
650
532
  const hasChanged = key !== [...selectedKeys][0];
651
-
652
533
  if (!isLeaf && !allowChange && !isSearching) {
653
534
  this._adapter.updateStates({
654
535
  activeKeys: new Set(activeKeys)
655
536
  });
656
-
657
537
  this.notifyIfLoadData(item);
658
538
  return;
659
539
  }
660
-
661
540
  if (multiple) {
662
541
  this._adapter.updateStates({
663
542
  activeKeys: new Set(activeKeys)
664
543
  });
665
-
666
544
  if (isLeaf && enableLeafClick) {
667
545
  this.onItemCheckboxClick(item);
668
546
  }
669
547
  } else {
670
548
  this._adapter.notifySelect(data.value);
671
-
672
549
  if (hasChanged) {
673
550
  this._notifyChange(item);
674
-
675
551
  this.notifyIfLoadData(item);
676
-
677
552
  if (this._isControlledComponent()) {
678
553
  this._adapter.updateStates({
679
554
  activeKeys: new Set(activeKeys)
680
555
  });
681
-
682
556
  if (isLeaf) {
683
557
  this.close(e);
684
558
  }
685
-
686
559
  return;
687
560
  }
688
-
689
561
  this._adapter.updateStates({
690
562
  activeKeys: new Set(activeKeys),
691
563
  selectedKeys: new Set(selectedKey)
692
564
  });
693
-
694
565
  const displayText = this.renderDisplayText(key);
695
-
696
566
  if (filterable) {
697
567
  this._adapter.updateInputPlaceHolder(displayText);
698
568
  }
699
-
700
569
  if (isLeaf) {
701
570
  this.close(e, key);
702
571
  } else if (!filterLeafOnly && isSearching) {
@@ -707,7 +576,6 @@ export default class CascaderFoundation extends BaseFoundation {
707
576
  }
708
577
  }
709
578
  }
710
-
711
579
  _handleMultipleSelect(item) {
712
580
  const {
713
581
  key
@@ -722,12 +590,12 @@ export default class CascaderFoundation extends BaseFoundation {
722
590
  max,
723
591
  disableStrictly,
724
592
  leafOnly
725
- } = this.getProps(); // prev checked status
726
-
727
- const prevCheckedStatus = checkedKeys.has(key); // next checked status
728
-
729
- const curCheckedStatus = disableStrictly ? this.calcCheckedStatus(!prevCheckedStatus, key) : !prevCheckedStatus; // calculate all key of nodes that are checked or half checked
730
-
593
+ } = this.getProps();
594
+ // prev checked status
595
+ const prevCheckedStatus = checkedKeys.has(key);
596
+ // next checked status
597
+ const curCheckedStatus = disableStrictly ? this.calcCheckedStatus(!prevCheckedStatus, key) : !prevCheckedStatus;
598
+ // calculate all key of nodes that are checked or half checked
731
599
  const {
732
600
  checkedKeys: curCheckedKeys,
733
601
  halfCheckedKeys: curHalfCheckedKeys
@@ -737,7 +605,6 @@ export default class CascaderFoundation extends BaseFoundation {
737
605
  const isNoneMerge = mergeType === strings.NONE_MERGE_TYPE;
738
606
  const curResolvedCheckedKeys = new Set(normalizeKeyList(curCheckedKeys, keyEntities, isLeafOnlyMerge));
739
607
  const curRealCheckedKeys = isNoneMerge ? curCheckedKeys : curResolvedCheckedKeys;
740
-
741
608
  if (_isNumber(max)) {
742
609
  if (!isNoneMerge) {
743
610
  // When it exceeds max, the quantity is allowed to be reduced, and no further increase is allowed
@@ -746,9 +613,7 @@ export default class CascaderFoundation extends BaseFoundation {
746
613
  curResolvedCheckedKeys.forEach(itemKey => {
747
614
  checkedEntities.push(keyEntities[itemKey]);
748
615
  });
749
-
750
616
  this._adapter.notifyOnExceed(checkedEntities);
751
-
752
617
  return;
753
618
  }
754
619
  } else {
@@ -758,35 +623,28 @@ export default class CascaderFoundation extends BaseFoundation {
758
623
  curCheckedKeys.forEach(itemKey => {
759
624
  checkedEntities.push(keyEntities[itemKey]);
760
625
  });
761
-
762
626
  this._adapter.notifyOnExceed(checkedEntities);
763
-
764
627
  return;
765
628
  }
766
629
  }
767
630
  }
768
-
769
631
  if (!this._isControlledComponent()) {
770
632
  this._adapter.updateStates({
771
633
  checkedKeys: curCheckedKeys,
772
634
  halfCheckedKeys: curHalfCheckedKeys,
773
635
  resolvedCheckedKeys: curResolvedCheckedKeys
774
636
  });
775
- } // The click event during multiple selection will definitely cause the checked state of node to change,
637
+ }
638
+ // The click event during multiple selection will definitely cause the checked state of node to change,
776
639
  // so there is no need to judge the value to change.
777
-
778
-
779
640
  this._notifyChange(curRealCheckedKeys);
780
-
781
641
  if (curCheckedStatus) {
782
642
  this._notifySelect(curRealCheckedKeys);
783
643
  }
784
-
785
644
  this._adapter.updateStates({
786
645
  inputValue: ''
787
646
  });
788
647
  }
789
-
790
648
  calcNonDisabledCheckedKeys(eventKey, targetStatus) {
791
649
  const {
792
650
  keyEntities,
@@ -797,21 +655,17 @@ export default class CascaderFoundation extends BaseFoundation {
797
655
  } = this.getCopyFromState(['checkedKeys']);
798
656
  const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
799
657
  const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
800
-
801
658
  if (!hasDisabled) {
802
659
  return this.calcCheckedKeys(eventKey, targetStatus);
803
660
  }
804
-
805
661
  const nonDisabled = descendantKeys.filter(key => !disabledKeys.has(key));
806
662
  const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : _difference(normalizeKeyList([...checkedKeys], keyEntities, true), nonDisabled);
807
663
  return calcCheckedKeys(newCheckedKeys, keyEntities);
808
664
  }
809
-
810
665
  calcCheckedStatus(targetStatus, eventKey) {
811
666
  if (!targetStatus) {
812
667
  return targetStatus;
813
668
  }
814
-
815
669
  const {
816
670
  checkedKeys,
817
671
  keyEntities,
@@ -819,16 +673,13 @@ export default class CascaderFoundation extends BaseFoundation {
819
673
  } = this.getStates();
820
674
  const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
821
675
  const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
822
-
823
676
  if (!hasDisabled) {
824
677
  return targetStatus;
825
678
  }
826
-
827
679
  const nonDisabledKeys = descendantKeys.filter(key => !disabledKeys.has(key));
828
680
  const allChecked = nonDisabledKeys.every(key => checkedKeys.has(key));
829
681
  return !allChecked;
830
682
  }
831
-
832
683
  _notifySelect(keys) {
833
684
  const {
834
685
  keyEntities
@@ -841,7 +692,6 @@ export default class CascaderFoundation extends BaseFoundation {
841
692
  }
842
693
  });
843
694
  const formatValue = values.length === 1 ? values[0] : values;
844
-
845
695
  this._adapter.notifySelect(formatValue);
846
696
  }
847
697
  /**
@@ -849,8 +699,6 @@ export default class CascaderFoundation extends BaseFoundation {
849
699
  * @param {string} key key of node
850
700
  * @param {boolean} curCheckedStatus checked status of node
851
701
  */
852
-
853
-
854
702
  calcCheckedKeys(key, curCheckedStatus) {
855
703
  const {
856
704
  keyEntities
@@ -861,10 +709,8 @@ export default class CascaderFoundation extends BaseFoundation {
861
709
  } = this.getCopyFromState(['checkedKeys', 'halfCheckedKeys']);
862
710
  return curCheckedStatus ? calcCheckedKeysForChecked(key, keyEntities, checkedKeys, halfCheckedKeys) : calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfCheckedKeys);
863
711
  }
864
-
865
712
  handleInputChange(sugInput) {
866
713
  this._adapter.updateInputValue(sugInput);
867
-
868
714
  const {
869
715
  keyEntities
870
716
  } = this.getStates();
@@ -874,7 +720,6 @@ export default class CascaderFoundation extends BaseFoundation {
874
720
  filterLeafOnly
875
721
  } = this.getProps();
876
722
  let filteredKeys = [];
877
-
878
723
  if (sugInput) {
879
724
  filteredKeys = Object.values(keyEntities).filter(item => {
880
725
  const {
@@ -882,24 +727,19 @@ export default class CascaderFoundation extends BaseFoundation {
882
727
  _notExist,
883
728
  data
884
729
  } = item;
885
-
886
730
  if (_notExist) {
887
731
  return false;
888
732
  }
889
-
890
733
  const filteredPath = this.getItemPropPath(key, treeNodeFilterProp).join();
891
734
  return filter(sugInput, data, filterTreeNode, false, filteredPath);
892
735
  }).filter(item => filterTreeNode && !filterLeafOnly || this._isLeaf(item)).map(item => item.key);
893
736
  }
894
-
895
737
  this._adapter.updateStates({
896
738
  isSearching: Boolean(sugInput),
897
739
  filteredKeys: new Set(filteredKeys)
898
740
  });
899
-
900
741
  this._adapter.notifyOnSearch(sugInput);
901
742
  }
902
-
903
743
  handleClear() {
904
744
  const {
905
745
  isSearching
@@ -909,90 +749,66 @@ export default class CascaderFoundation extends BaseFoundation {
909
749
  placeholder,
910
750
  multiple
911
751
  } = this.getProps();
912
-
913
752
  const isFilterable = this._isFilterable();
914
-
915
753
  const isControlled = this._isControlledComponent();
916
-
917
754
  const newState = {};
918
-
919
755
  if (multiple) {
920
756
  this._adapter.updateInputValue('');
921
-
922
757
  this._adapter.notifyOnSearch('');
923
-
924
758
  newState.checkedKeys = new Set([]);
925
759
  newState.halfCheckedKeys = new Set([]);
926
760
  newState.selectedKeys = new Set([]);
927
761
  newState.activeKeys = new Set([]);
928
762
  newState.resolvedCheckedKeys = new Set([]);
929
-
930
763
  this._adapter.notifyChange([]);
931
764
  } else {
932
765
  // if click clearBtn when not searching, clear selected and active values as well
933
766
  if (isFilterable && isSearching) {
934
767
  newState.isSearching = false;
935
-
936
768
  this._adapter.updateInputValue('');
937
-
938
769
  this._adapter.notifyOnSearch('');
939
770
  } else {
940
771
  if (isFilterable) {
941
772
  newState.inputValue = '';
942
773
  newState.inputPlaceHolder = searchPlaceholder || placeholder || '';
943
-
944
774
  this._adapter.updateInputValue('');
945
-
946
775
  this._adapter.notifyOnSearch('');
947
776
  }
948
-
949
777
  if (!isControlled) {
950
778
  newState.selectedKeys = new Set([]);
951
779
  }
952
-
953
780
  newState.activeKeys = new Set([]);
954
781
  newState.filteredKeys = new Set([]);
955
-
956
782
  this._adapter.notifyChange([]);
957
783
  }
958
784
  }
959
-
960
785
  this._adapter.updateStates(newState);
961
-
962
786
  this._adapter.notifyClear();
963
-
964
787
  this._adapter.rePositionDropdown();
965
788
  }
966
789
  /**
967
790
  * A11y: simulate clear button click
968
791
  */
969
-
970
792
  /* istanbul ignore next */
971
-
972
-
973
793
  handleClearEnterPress(keyboardEvent) {
974
794
  if (isEnterPress(keyboardEvent)) {
975
795
  this.handleClear();
976
796
  }
977
797
  }
978
-
979
798
  getRenderData() {
980
799
  const {
981
800
  keyEntities,
982
801
  isSearching
983
802
  } = this.getStates();
984
-
985
803
  const isFilterable = this._isFilterable();
986
-
987
804
  if (isSearching && isFilterable) {
988
805
  return this.getFilteredData();
989
806
  }
990
-
991
- return Object.values(keyEntities).filter(item => item.parentKey === null && !item._notExist) // eslint-disable-next-line @typescript-eslint/ban-ts-comment
807
+ return Object.values(keyEntities).filter(item => item.parentKey === null && !item._notExist)
808
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
992
809
  // @ts-ignore
993
810
  .sort((a, b) => parseInt(a.ind, 10) - parseInt(b.ind, 10));
994
811
  }
995
-
996
812
  getFilteredData() {
997
813
  const {
998
814
  treeNodeFilterProp,
@@ -1007,16 +823,12 @@ export default class CascaderFoundation extends BaseFoundation {
1007
823
  const filteredKeyArr = [...filteredKeys];
1008
824
  filteredKeyArr.forEach(key => {
1009
825
  const item = keyEntities[key];
1010
-
1011
826
  if (!item) {
1012
827
  return;
1013
828
  }
1014
-
1015
829
  const pathData = this.getItemPropPath(key, []);
1016
830
  const itemSearchPath = pathData.map(item => item[treeNodeFilterProp]);
1017
-
1018
831
  const isDisabled = this._isOptionDisabled(key, keyEntities);
1019
-
1020
832
  filteredList.push({
1021
833
  data: item.data,
1022
834
  pathData,
@@ -1025,16 +837,13 @@ export default class CascaderFoundation extends BaseFoundation {
1025
837
  searchText: itemSearchPath
1026
838
  });
1027
839
  });
1028
-
1029
840
  if (_isFunction(filterSorter)) {
1030
841
  filteredList.sort((a, b) => {
1031
842
  return filterSorter(a.pathData, b.pathData, inputValue);
1032
843
  });
1033
844
  }
1034
-
1035
845
  return filteredList;
1036
846
  }
1037
-
1038
847
  handleListScroll(e, ind) {
1039
848
  const {
1040
849
  activeKeys,
@@ -1042,13 +851,11 @@ export default class CascaderFoundation extends BaseFoundation {
1042
851
  } = this.getStates();
1043
852
  const lastActiveKey = [...activeKeys][activeKeys.size - 1];
1044
853
  const data = lastActiveKey ? _get(keyEntities, [lastActiveKey, 'data'], null) : null;
1045
-
1046
854
  this._adapter.notifyListScroll(e, {
1047
855
  panelIndex: ind,
1048
856
  activeNode: data
1049
857
  });
1050
858
  }
1051
-
1052
859
  handleTagRemove(e, tagValuePath) {
1053
860
  const {
1054
861
  keyEntities
@@ -1056,14 +863,11 @@ export default class CascaderFoundation extends BaseFoundation {
1056
863
  const {
1057
864
  disabled
1058
865
  } = this.getProps();
1059
-
1060
866
  if (disabled) {
1061
867
  /* istanbul ignore next */
1062
868
  return;
1063
869
  }
1064
-
1065
870
  const removedItem = Object.values(keyEntities).filter(item => _isEqual(item.valuePath, tagValuePath))[0];
1066
871
  !_isEmpty(removedItem) && !removedItem.data.disabled && this._handleMultipleSelect(removedItem);
1067
872
  }
1068
-
1069
873
  }