@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
@@ -2,34 +2,25 @@ import _isString from "lodash/isString";
2
2
  import _get from "lodash/get";
3
3
  import _toString from "lodash/toString";
4
4
  import _toNumber from "lodash/toNumber";
5
-
6
5
  /* eslint-disable max-len */
7
-
8
6
  /* eslint-disable no-param-reassign */
9
-
10
7
  /* eslint-disable eqeqeq */
11
8
  import BaseFoundation from '../base/foundation';
12
9
  import keyCode from '../utils/keyCode';
13
10
  import { numbers } from './constants';
14
11
  import { minus as numberMinus } from '../utils/number';
15
-
16
12
  class InputNumberFoundation extends BaseFoundation {
17
13
  init() {
18
14
  this._setInitValue();
19
15
  }
20
-
21
16
  destroy() {
22
17
  this._unregisterInterval();
23
-
24
18
  this._unregisterTimer();
25
-
26
19
  this._adapter.unregisterGlobalEvent('mouseup');
27
20
  }
28
-
29
21
  isControlled() {
30
22
  return this._isControlledComponent('value');
31
23
  }
32
-
33
24
  _doInput() {
34
25
  let v = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
35
26
  let event = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
@@ -37,34 +28,28 @@ class InputNumberFoundation extends BaseFoundation {
37
28
  let notifyVal = v;
38
29
  let number = v;
39
30
  let isValidNumber = true;
40
- const isControlled = this.isControlled(); // console.log(v);
41
-
31
+ const isControlled = this.isControlled();
32
+ // console.log(v);
42
33
  if (typeof v !== 'number') {
43
34
  number = this.doParse(v, false);
44
35
  isValidNumber = !isNaN(number);
45
36
  }
46
-
47
37
  if (isValidNumber) {
48
38
  notifyVal = number;
49
-
50
39
  if (!isControlled) {
51
40
  this._adapter.setNumber(number);
52
41
  }
53
42
  }
54
-
55
43
  if (!isControlled) {
56
44
  this._adapter.setValue(v, updateCb);
57
45
  }
58
-
59
46
  if (this.getProp('keepFocus')) {
60
47
  this._adapter.setFocusing(true, () => {
61
48
  this._adapter.setClickUpOrDown(true);
62
49
  });
63
50
  }
64
-
65
51
  this.notifyChange(notifyVal, event);
66
52
  }
67
-
68
53
  _registerInterval(cb) {
69
54
  const pressInterval = this.getProp('pressInterval') || numbers.DEFAULT_PRESS_INTERVAL;
70
55
  this._intervalHasRegistered = true;
@@ -74,7 +59,6 @@ class InputNumberFoundation extends BaseFoundation {
74
59
  }
75
60
  }, pressInterval);
76
61
  }
77
-
78
62
  _unregisterInterval() {
79
63
  if (this._interval) {
80
64
  this._intervalHasRegistered = false;
@@ -82,7 +66,6 @@ class InputNumberFoundation extends BaseFoundation {
82
66
  this._interval = null;
83
67
  }
84
68
  }
85
-
86
69
  _registerTimer(cb) {
87
70
  const pressTimeout = this.getProp('pressTimeout') || numbers.DEFAULT_PRESS_TIMEOUT;
88
71
  this._timerHasRegistered = true;
@@ -92,7 +75,6 @@ class InputNumberFoundation extends BaseFoundation {
92
75
  }
93
76
  }, pressTimeout);
94
77
  }
95
-
96
78
  _unregisterTimer() {
97
79
  if (this._timer) {
98
80
  this._timerHasRegistered = false;
@@ -100,20 +82,15 @@ class InputNumberFoundation extends BaseFoundation {
100
82
  this._timer = null;
101
83
  }
102
84
  }
103
-
104
85
  handleInputFocus(e) {
105
86
  const value = this.getState('value');
106
-
107
- if (value !== '') {// let parsedStr = this.doParse(this.getState('value'));
87
+ if (value !== '') {
88
+ // let parsedStr = this.doParse(this.getState('value'));
108
89
  // this._adapter.setValue(Number(parsedStr));
109
90
  }
110
-
111
91
  this._adapter.recordCursorPosition();
112
-
113
92
  this._adapter.setFocusing(true, null);
114
-
115
93
  this._adapter.setClickUpOrDown(false);
116
-
117
94
  this._adapter.notifyFocus(e);
118
95
  }
119
96
  /**
@@ -121,23 +98,18 @@ class InputNumberFoundation extends BaseFoundation {
121
98
  * @param {String} value
122
99
  * @param {*} event
123
100
  */
124
-
125
-
126
101
  handleInputChange(value, event) {
127
102
  // Check accuracy, adjust accuracy, adjust maximum and minimum values, call parser to parse the number
128
- const parsedNum = this.doParse(value, true, true, true); // Parser parsed number, type Number (normal number or NaN)
129
-
130
- const toNum = this.doParse(value, false, false, false); // String converted from parser parsed numbers or directly converted without parser
131
-
103
+ const parsedNum = this.doParse(value, true, true, true);
104
+ // Parser parsed number, type Number (normal number or NaN)
105
+ const toNum = this.doParse(value, false, false, false);
106
+ // String converted from parser parsed numbers or directly converted without parser
132
107
  const valueAfterParser = this.afterParser(value);
133
-
134
108
  this._adapter.recordCursorPosition();
135
-
136
109
  let notifyVal;
137
- let num = toNum; // The formatted input value
138
-
110
+ let num = toNum;
111
+ // The formatted input value
139
112
  let formattedNum = value;
140
-
141
113
  if (value === '') {
142
114
  if (!this.isControlled()) {
143
115
  num = null;
@@ -150,13 +122,11 @@ class InputNumberFoundation extends BaseFoundation {
150
122
  * This logic is used to solve the problem that parsedNum is not a valid number
151
123
  */
152
124
  if (typeof toNum === 'number' && !isNaN(toNum)) {
153
- formattedNum = this.doFormat(toNum, false); // console.log(`parsedStr: `, parsedStr, `toNum: `, toNum);
154
-
125
+ formattedNum = this.doFormat(toNum, false);
126
+ // console.log(`parsedStr: `, parsedStr, `toNum: `, toNum);
155
127
  const dotIndex = valueAfterParser.lastIndexOf('.');
156
128
  const lengthAfterDot = valueAfterParser.length - 1 - dotIndex;
157
-
158
129
  const precLength = this._getPrecLen(toNum);
159
-
160
130
  if (!precLength) {
161
131
  const dotBeginStr = dotIndex > -1 ? valueAfterParser.slice(dotIndex) : '';
162
132
  formattedNum += dotBeginStr;
@@ -165,9 +135,8 @@ class InputNumberFoundation extends BaseFoundation {
165
135
  for (let i = 0; i < lengthAfterDot - precLength; i++) {
166
136
  formattedNum += '0';
167
137
  }
168
- } // NOUSE:
169
-
170
-
138
+ }
139
+ // NOUSE:
171
140
  num = toNum;
172
141
  } else {
173
142
  /**
@@ -179,163 +148,120 @@ class InputNumberFoundation extends BaseFoundation {
179
148
  */
180
149
  formattedNum = this.doFormat(valueAfterParser, false);
181
150
  }
182
-
183
151
  notifyVal = valueAfterParser;
184
152
  }
185
-
186
153
  if (!this.isControlled() && (num === null || typeof num === 'number' && !isNaN(num))) {
187
154
  this._adapter.setNumber(num);
188
155
  }
189
-
190
156
  this._adapter.setValue(this.isControlled() ? formattedNum : this.doFormat(valueAfterParser, false), () => {
191
157
  this._adapter.restoreCursor();
192
158
  });
193
-
194
159
  this.notifyChange(notifyVal, event);
195
160
  }
196
-
197
161
  handleInputKeyDown(event) {
198
162
  const code = event.keyCode;
199
-
200
163
  if (code === keyCode.UP || code === keyCode.DOWN) {
201
164
  this._adapter.setClickUpOrDown(true);
202
-
203
165
  this._adapter.recordCursorPosition();
204
-
205
166
  const formattedVal = code === keyCode.UP ? this.add(null, event) : this.minus(null, event);
206
-
207
167
  this._doInput(formattedVal, event, () => {
208
168
  this._adapter.restoreCursor();
209
169
  });
210
-
211
170
  event.preventDefault();
212
171
  }
213
-
214
172
  this._adapter.notifyKeyDown(event);
215
173
  }
216
-
217
174
  handleInputBlur(e) {
218
175
  const currentValue = _toString(this.getState('value'));
219
-
220
176
  let currentNumber = this.getState('number');
221
-
222
177
  if (currentNumber != null || currentValue != null && currentValue !== '') {
223
178
  const parsedNum = this.doParse(currentValue, false, true, true);
224
179
  let numHasChanged = false;
225
180
  let strHasChanged = false;
226
181
  let willSetNum, willSetVal;
227
-
228
182
  if (this.isValidNumber(parsedNum) && currentNumber !== parsedNum) {
229
183
  willSetNum = parsedNum;
230
-
231
184
  if (!this.isControlled()) {
232
185
  currentNumber = willSetNum;
233
186
  }
234
-
235
187
  numHasChanged = true;
236
188
  }
237
-
238
189
  const currentFormattedNum = this.doFormat(currentNumber, true);
239
-
240
190
  if (currentFormattedNum !== currentValue) {
241
191
  willSetVal = currentFormattedNum;
242
192
  strHasChanged = true;
243
193
  }
244
-
245
194
  if (strHasChanged || numHasChanged) {
246
195
  const notifyVal = willSetVal != null ? willSetVal : willSetNum;
247
-
248
196
  if (willSetVal != null) {
249
- this._adapter.setValue(willSetVal); // this.notifyChange(willSetVal);
250
-
197
+ this._adapter.setValue(willSetVal);
198
+ // this.notifyChange(willSetVal);
251
199
  }
252
200
 
253
201
  if (willSetNum != null) {
254
202
  // eslint-disable-next-line max-depth
255
203
  if (!this._isControlledComponent('value')) {
256
204
  this._adapter.setNumber(willSetNum);
257
- } // this.notifyChange(willSetNum);
258
-
205
+ }
206
+ // this.notifyChange(willSetNum);
259
207
  }
260
208
 
261
209
  this.notifyChange(notifyVal, e);
262
210
  }
263
211
  }
264
-
265
212
  this._adapter.setFocusing(false);
266
-
267
213
  this._adapter.notifyBlur(e);
268
214
  }
269
-
270
215
  handleInputMouseEnter(event) {
271
216
  this._adapter.setHovering(true);
272
217
  }
273
-
274
218
  handleInputMouseLeave(event) {
275
219
  this._adapter.setHovering(false);
276
220
  }
277
-
278
221
  handleInputMouseMove(event) {
279
222
  this._adapter.setHovering(true);
280
223
  }
281
-
282
224
  handleMouseUp(e) {
283
225
  this._unregisterInterval();
284
-
285
226
  this._unregisterTimer();
286
-
287
227
  this._adapter.unregisterGlobalEvent('mouseup');
288
228
  }
289
-
290
229
  handleUpClick(event) {
291
230
  const {
292
231
  readonly
293
232
  } = this.getProps();
294
-
295
233
  if (!this._isMouseButtonLeft(event) || readonly) {
296
234
  return;
297
235
  }
298
-
299
236
  this._adapter.setClickUpOrDown(true);
300
-
301
237
  if (event) {
302
238
  this._persistEvent(event);
303
-
304
- event.stopPropagation(); // Prevent native blurring events
305
-
239
+ event.stopPropagation();
240
+ // Prevent native blurring events
306
241
  this._preventDefault(event);
307
242
  }
308
-
309
- this.upClick(event); // Cannot access event objects asynchronously https://reactjs.org/docs/events.html#event-pooling
310
-
243
+ this.upClick(event);
244
+ // Cannot access event objects asynchronously https://reactjs.org/docs/events.html#event-pooling
311
245
  this._registerTimer(() => {
312
246
  this._registerInterval(() => {
313
247
  this.upClick(event);
314
248
  });
315
249
  });
316
250
  }
317
-
318
251
  handleDownClick(event) {
319
252
  const {
320
253
  readonly
321
254
  } = this.getProps();
322
-
323
255
  if (!this._isMouseButtonLeft(event) || readonly) {
324
256
  return;
325
257
  }
326
-
327
258
  this._adapter.setClickUpOrDown(true);
328
-
329
259
  if (event) {
330
260
  this._persistEvent(event);
331
-
332
261
  event.stopPropagation();
333
-
334
262
  this._preventDefault(event);
335
263
  }
336
-
337
264
  this.downClick(event);
338
-
339
265
  this._registerTimer(() => {
340
266
  this._registerInterval(() => {
341
267
  this.downClick(event);
@@ -346,44 +272,31 @@ class InputNumberFoundation extends BaseFoundation {
346
272
  * Whether it is a left mouse button click
347
273
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
348
274
  */
349
-
350
-
351
275
  _isMouseButtonLeft(event) {
352
276
  return _get(event, 'button') === numbers.MOUSE_BUTTON_LEFT;
353
277
  }
354
-
355
278
  _preventDefault(event) {
356
279
  const keepFocus = this._adapter.getProp('keepFocus');
357
-
358
280
  const innerButtons = this._adapter.getProp('innerButtons');
359
-
360
281
  if (keepFocus || innerButtons) {
361
282
  event.preventDefault();
362
283
  }
363
284
  }
364
-
365
285
  handleMouseLeave(event) {
366
286
  this._adapter.registerGlobalEvent('mouseup', () => {
367
287
  this.handleMouseUp(event);
368
288
  });
369
289
  }
370
-
371
290
  upClick(event) {
372
291
  const value = this.add(null, event);
373
-
374
292
  this._doInput(value, event);
375
-
376
293
  this._adapter.notifyUpClick(value, event);
377
294
  }
378
-
379
295
  downClick(event) {
380
296
  const value = this.minus(null, event);
381
-
382
297
  this._doInput(value, event);
383
-
384
298
  this._adapter.notifyDownClick(value, event);
385
299
  }
386
-
387
300
  _setInitValue() {
388
301
  const {
389
302
  defaultValue,
@@ -392,22 +305,16 @@ class InputNumberFoundation extends BaseFoundation {
392
305
  const propsValue = this._isControlledComponent('value') ? value : defaultValue;
393
306
  const tmpNumber = this.doParse(_toString(propsValue), false, true, true);
394
307
  let number = null;
395
-
396
308
  if (typeof tmpNumber === 'number' && !isNaN(tmpNumber)) {
397
309
  number = tmpNumber;
398
310
  }
399
-
400
311
  const formattedValue = typeof number === 'number' ? this.doFormat(number, true) : '';
401
-
402
312
  this._adapter.setNumber(number);
403
-
404
313
  this._adapter.setValue(formattedValue);
405
-
406
314
  if (_isString(formattedValue) && formattedValue !== String(propsValue !== null && propsValue !== void 0 ? propsValue : '')) {
407
315
  this.notifyChange(formattedValue, null);
408
316
  }
409
317
  }
410
-
411
318
  add(step, event) {
412
319
  const pressShift = event && event.shiftKey;
413
320
  const propStep = pressShift ? this.getProp('shiftStep') : this.getProp('step');
@@ -417,17 +324,11 @@ class InputNumberFoundation extends BaseFoundation {
417
324
  let curNum = this.toNumber(curVal) || 0;
418
325
  const min = this.getProp('min');
419
326
  const max = this.getProp('max');
420
-
421
327
  const minPrecLen = this._getPrecLen(min);
422
-
423
328
  const maxPrecLen = this._getPrecLen(max);
424
-
425
329
  const curPrecLen = this._getPrecLen(curNum);
426
-
427
330
  const stepPrecLen = this._getPrecLen(step);
428
-
429
331
  const scale = Math.pow(10, Math.max(minPrecLen, maxPrecLen, curPrecLen, stepPrecLen));
430
-
431
332
  if (step < 0) {
432
333
  // Js accuracy problem
433
334
  if (Math.abs(numberMinus(min, curNum)) >= stepAbs) {
@@ -438,19 +339,15 @@ class InputNumberFoundation extends BaseFoundation {
438
339
  curNum = (curNum * scale + step * scale) / scale;
439
340
  }
440
341
  }
441
-
442
342
  if (typeof min === 'number' && min > curNum) {
443
343
  curNum = min;
444
344
  }
445
-
446
345
  if (typeof max === 'number' && max < curNum) {
447
346
  curNum = max;
448
- } // console.log('scale: ', scale, 'curNum: ', curNum);
449
-
450
-
347
+ }
348
+ // console.log('scale: ', scale, 'curNum: ', curNum);
451
349
  return this.doFormat(curNum, true);
452
350
  }
453
-
454
351
  minus(step, event) {
455
352
  const pressShift = event && event.shiftKey;
456
353
  const propStep = pressShift ? this.getProp('shiftStep') : this.getProp('step');
@@ -462,24 +359,18 @@ class InputNumberFoundation extends BaseFoundation {
462
359
  * @param {number} num
463
360
  * @returns {number}
464
361
  */
465
-
466
-
467
362
  _getPrecLen(num) {
468
363
  if (typeof num !== 'string') {
469
364
  num = String(Math.abs(Number(num || '')));
470
365
  }
471
-
472
366
  const idx = num.indexOf('.') + 1;
473
367
  return idx ? num.length - idx : 0;
474
368
  }
475
-
476
369
  _adjustPrec(num) {
477
370
  const precision = this.getProp('precision');
478
-
479
371
  if (typeof precision === 'number' && num !== '' && num !== null && !Number.isNaN(Number(num))) {
480
372
  num = Number(num).toFixed(precision);
481
373
  }
482
-
483
374
  return _toString(num);
484
375
  }
485
376
  /**
@@ -488,8 +379,6 @@ class InputNumberFoundation extends BaseFoundation {
488
379
  * @param {boolean} needAdjustPrec
489
380
  * @returns {string}
490
381
  */
491
-
492
-
493
382
  doFormat() {
494
383
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
495
384
  let needAdjustPrec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
@@ -498,17 +387,14 @@ class InputNumberFoundation extends BaseFoundation {
498
387
  // }
499
388
  let str;
500
389
  const formatter = this.getProp('formatter');
501
-
502
390
  if (needAdjustPrec) {
503
391
  str = this._adjustPrec(value);
504
392
  } else {
505
393
  str = _toString(value);
506
394
  }
507
-
508
395
  if (typeof formatter === 'function') {
509
396
  str = formatter(str);
510
397
  }
511
-
512
398
  return str;
513
399
  }
514
400
  /**
@@ -516,20 +402,16 @@ class InputNumberFoundation extends BaseFoundation {
516
402
  * @param {number} current
517
403
  * @returns {number}
518
404
  */
519
-
520
-
521
405
  fetchMinOrMax(current) {
522
406
  const {
523
407
  min,
524
408
  max
525
409
  } = this.getProps();
526
-
527
410
  if (current < min) {
528
411
  return min;
529
412
  } else if (current > max) {
530
413
  return max;
531
414
  }
532
-
533
415
  return current;
534
416
  }
535
417
  /**
@@ -540,49 +422,38 @@ class InputNumberFoundation extends BaseFoundation {
540
422
  * @param {boolean} needAdjustMaxMin
541
423
  * @returns {number}
542
424
  */
543
-
544
-
545
425
  doParse(value) {
546
426
  let needCheckPrec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
547
427
  let needAdjustPrec = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
548
428
  let needAdjustMaxMin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
549
-
550
429
  if (typeof value === 'number') {
551
430
  if (needAdjustMaxMin) {
552
431
  value = this.fetchMinOrMax(value);
553
432
  }
554
-
555
433
  if (needAdjustPrec) {
556
434
  value = this._adjustPrec(value);
557
435
  }
558
-
559
436
  return _toNumber(value);
560
437
  }
561
-
562
438
  const parser = this.getProp('parser');
563
-
564
439
  if (typeof parser === 'function') {
565
440
  value = parser(value);
566
441
  }
567
-
568
442
  if (needCheckPrec && typeof value === 'string') {
569
443
  const zeroIsValid = value.indexOf('.') === -1 || value.indexOf('.') > -1 && (value === '0' || value.lastIndexOf('0') < value.length - 1);
570
444
  const dotIsValid = value.lastIndexOf('.') < value.length - 1 && value.split('').filter(v => v === '.').length < 2;
571
-
572
- if (!zeroIsValid || !dotIsValid // (this.getProp('precision') > 0 && this._getPrecLen(value) > this.getProp('precision'))
445
+ if (!zeroIsValid || !dotIsValid
446
+ // (this.getProp('precision') > 0 && this._getPrecLen(value) > this.getProp('precision'))
573
447
  ) {
574
448
  return NaN;
575
449
  }
576
450
  }
577
-
578
451
  if (needAdjustPrec) {
579
452
  value = this._adjustPrec(value);
580
453
  }
581
-
582
454
  if (typeof value === 'string' && value.length) {
583
455
  return needAdjustMaxMin ? this.fetchMinOrMax(_toNumber(value)) : _toNumber(value);
584
456
  }
585
-
586
457
  return NaN;
587
458
  }
588
459
  /**
@@ -590,37 +461,27 @@ class InputNumberFoundation extends BaseFoundation {
590
461
  * @param {string} value
591
462
  * @returns {string}
592
463
  */
593
-
594
-
595
464
  afterParser(value) {
596
465
  const parser = this.getProp('parser');
597
-
598
466
  if (typeof value === 'string' && typeof parser === 'function') {
599
467
  return _toString(parser(value));
600
468
  }
601
-
602
469
  return _toString(value);
603
470
  }
604
-
605
471
  toNumber(value) {
606
472
  let needAdjustPrec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
607
-
608
473
  if (typeof value === 'number') {
609
474
  return value;
610
475
  }
611
-
612
476
  if (typeof value === 'string') {
613
477
  const parser = this.getProp('parser');
614
-
615
478
  if (typeof parser === 'function') {
616
479
  value = parser(value);
617
480
  }
618
-
619
481
  if (needAdjustPrec) {
620
482
  value = this._adjustPrec(value);
621
483
  }
622
484
  }
623
-
624
485
  return _toNumber(value);
625
486
  }
626
487
  /**
@@ -632,70 +493,54 @@ class InputNumberFoundation extends BaseFoundation {
632
493
  * @param {*} needCheckPrec
633
494
  * @returns
634
495
  */
635
-
636
-
637
496
  isValidNumber(num) {
638
497
  let needCheckPrec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
639
-
640
498
  if (typeof num === 'number' && !isNaN(num)) {
641
499
  const {
642
500
  min,
643
501
  max,
644
502
  precision
645
503
  } = this.getProps();
646
-
647
504
  const numPrec = this._getPrecLen(num);
648
-
649
505
  const precIsValid = needCheckPrec ? typeof precision === 'number' && numPrec <= precision || typeof precision !== 'number' : true;
650
-
651
506
  if (num >= min && num <= max && precIsValid) {
652
507
  return true;
653
508
  }
654
509
  }
655
-
656
510
  return false;
657
511
  }
658
-
659
512
  isValidString(str) {
660
513
  if (typeof str === 'string' && str.length) {
661
514
  const parsedNum = this.doParse(str);
662
515
  return this.isValidNumber(parsedNum);
663
516
  }
664
-
665
517
  return false;
666
518
  }
667
-
668
519
  notifyChange(value, e) {
669
520
  if (value == null || value === '') {
670
521
  this._adapter.notifyChange('', e);
671
522
  } else {
672
523
  const parsedNum = this.toNumber(value, true);
673
-
674
524
  if (typeof parsedNum === 'number' && !isNaN(parsedNum)) {
675
525
  // this._adapter.notifyChange(typeof value === 'number' ? parsedNum : this.afterParser(value), e);
676
526
  this._adapter.notifyChange(parsedNum, e);
677
-
678
527
  this.notifyNumberChange(parsedNum, e);
679
528
  } else {
680
529
  this._adapter.notifyChange(this.afterParser(value), e);
681
530
  }
682
531
  }
683
532
  }
684
-
685
533
  notifyNumberChange(value, e) {
686
534
  const {
687
535
  number
688
- } = this.getStates(); // Does not trigger numberChange if value is not a significant number
689
-
536
+ } = this.getStates();
537
+ // Does not trigger numberChange if value is not a significant number
690
538
  if (this.isValidNumber(value) && value !== number) {
691
539
  this._adapter.notifyNumberChange(value, e);
692
540
  }
693
541
  }
694
-
695
542
  updateStates(states, callback) {
696
543
  this._adapter.updateStates(states, callback);
697
544
  }
698
-
699
545
  }
700
-
701
546
  export default InputNumberFoundation;