@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
@@ -3,9 +3,7 @@ import _isEqual from "lodash/isEqual";
3
3
  import _isString from "lodash/isString";
4
4
  import _isObject from "lodash/isObject";
5
5
  import _get from "lodash/get";
6
-
7
6
  /* eslint-disable no-nested-ternary */
8
-
9
7
  /* eslint-disable max-len, max-depth, */
10
8
  import { format, isValid, isSameSecond, isEqual as isDateEqual, isDate } from 'date-fns';
11
9
  import BaseFoundation from '../base/foundation';
@@ -24,7 +22,6 @@ import isValidTimeZone from './_utils/isValidTimeZone';
24
22
  * task 1. Accept the selected date change, update the date value, and update the input box value according to the date = > Notify the change
25
23
  * task 2. When the input box changes, update the date value = > Notify the change
26
24
  */
27
-
28
25
  export default class DatePickerFoundation extends BaseFoundation {
29
26
  constructor(adapter) {
30
27
  super(Object.assign({}, adapter));
@@ -32,41 +29,31 @@ export default class DatePickerFoundation extends BaseFoundation {
32
29
  * clear range input focus when open is controlled
33
30
  * fixed github 1375
34
31
  */
35
-
36
32
  this.clearRangeInputFocus = () => {
37
33
  const {
38
34
  type
39
35
  } = this._adapter.getProps();
40
-
41
36
  const {
42
37
  rangeInputFocus
43
38
  } = this._adapter.getStates();
44
-
45
39
  if (type === 'dateTimeRange' && rangeInputFocus) {
46
40
  this._adapter.setRangeInputFocus(false);
47
41
  }
48
42
  };
49
-
50
43
  this._isRangeType = () => {
51
44
  const type = this._adapter.getProp('type');
52
-
53
45
  return /range/i.test(type);
54
46
  };
55
-
56
47
  this._isRangeValueComplete = value => {
57
48
  let result = false;
58
-
59
49
  if (Array.isArray(value)) {
60
50
  result = !value.some(date => isNullOrUndefined(date));
61
51
  }
62
-
63
52
  return result;
64
53
  };
65
54
  }
66
-
67
55
  init() {
68
56
  const timeZone = this.getProp('timeZone');
69
-
70
57
  if (this._isControlledComponent()) {
71
58
  this.initFromProps({
72
59
  timeZone,
@@ -78,31 +65,22 @@ export default class DatePickerFoundation extends BaseFoundation {
78
65
  value: this.getProp('defaultValue')
79
66
  });
80
67
  }
81
-
82
68
  this.initPanelOpenStatus(this.getProp('defaultOpen'));
83
69
  }
84
-
85
70
  initFromProps(_ref) {
86
71
  let {
87
72
  value,
88
73
  timeZone,
89
74
  prevTimeZone
90
75
  } = _ref;
91
-
92
76
  const _value = (Array.isArray(value) ? [...value] : (value || value === 0) && [value]) || [];
93
-
94
77
  const result = this.parseWithTimezone(_value, timeZone, prevTimeZone);
95
-
96
- this._adapter.updatePrevTimezone(prevTimeZone); // reset input value when value update
97
-
98
-
78
+ this._adapter.updatePrevTimezone(prevTimeZone);
79
+ // reset input value when value update
99
80
  this.clearInputValue();
100
-
101
81
  this._adapter.updateValue(result);
102
-
103
82
  this.resetCachedSelectedValue(result);
104
83
  this.initRangeInputFocus(result);
105
-
106
84
  if (this._adapter.needConfirm()) {
107
85
  this._adapter.updateCachedSelectedValue(result);
108
86
  }
@@ -112,13 +90,10 @@ export default class DatePickerFoundation extends BaseFoundation {
112
90
  *
113
91
  * If the user passes an empty value, you need to set the range input focus to rangeStart, so that the user can continue to select from the beginning after clearing
114
92
  */
115
-
116
-
117
93
  initRangeInputFocus(result) {
118
94
  const {
119
95
  triggerRender
120
96
  } = this.getProps();
121
-
122
97
  if (this._isRangeType() && _isFunction(triggerRender) && result.length === 0) {
123
98
  this._adapter.setRangeInputFocus('rangeStart');
124
99
  }
@@ -135,28 +110,21 @@ export default class DatePickerFoundation extends BaseFoundation {
135
110
  * 如果是 value 变化,则不需要传入之前的时区,将 UTC value 转为 zoned value 即可
136
111
  *
137
112
  */
138
-
139
-
140
113
  parseWithTimezone(value, timeZone, prevTimeZone) {
141
114
  const result = [];
142
-
143
115
  if (Array.isArray(value) && value.length) {
144
116
  for (const v of value) {
145
117
  let parsedV = (v || v === 0) && this._parseValue(v);
146
-
147
118
  if (parsedV) {
148
119
  if (isValidTimeZone(prevTimeZone)) {
149
120
  parsedV = zonedTimeToUtc(parsedV, prevTimeZone);
150
121
  }
151
-
152
122
  result.push(isValidTimeZone(timeZone) ? utcToZonedTime(parsedV, timeZone) : parsedV);
153
123
  }
154
124
  }
155
125
  }
156
-
157
126
  return result;
158
127
  }
159
-
160
128
  _isMultiple() {
161
129
  return Boolean(this.getProp('multiple'));
162
130
  }
@@ -170,17 +138,12 @@ export default class DatePickerFoundation extends BaseFoundation {
170
138
  Unified here to format the incoming value and output it as a Date object
171
139
  *
172
140
  */
173
-
174
-
175
141
  _parseValue(value) {
176
142
  const dateFnsLocale = this._adapter.getProp('dateFnsLocale');
177
-
178
143
  let dateObj;
179
-
180
144
  if (!value && value !== 0) {
181
145
  return new Date();
182
146
  }
183
-
184
147
  if (isValidDate(value)) {
185
148
  dateObj = value;
186
149
  } else if (_isString(value)) {
@@ -190,48 +153,37 @@ export default class DatePickerFoundation extends BaseFoundation {
190
153
  } else {
191
154
  throw new TypeError('defaultValue should be valid Date object/timestamp or string');
192
155
  }
193
-
194
156
  return dateObj;
195
157
  }
196
-
197
158
  destroy() {
198
159
  // Ensure that event listeners will be uninstalled and users may not trigger closePanel
199
160
  this._adapter.togglePanel(false);
200
-
201
161
  this._adapter.unregisterClickOutSide();
202
162
  }
203
-
204
163
  initPanelOpenStatus(defaultOpen) {
205
164
  if ((this.getProp('open') || defaultOpen) && !this.getProp('disabled')) {
206
165
  this._adapter.togglePanel(true);
207
-
208
166
  this._adapter.registerClickOutSide();
209
167
  } else {
210
168
  this._adapter.togglePanel(false);
211
-
212
169
  this._adapter.unregisterClickOutSide();
213
170
  }
214
171
  }
215
-
216
172
  openPanel() {
217
173
  if (!this.getProp('disabled')) {
218
174
  if (!this._isControlledComponent('open')) {
219
175
  this.open();
220
176
  }
221
-
222
177
  this._adapter.notifyOpenChange(true);
223
178
  }
224
179
  }
225
180
  /**
226
181
  * clear inset input value when close panel
227
182
  */
228
-
229
-
230
183
  clearInsetInputValue() {
231
184
  const {
232
185
  insetInput
233
186
  } = this._adapter.getProps();
234
-
235
187
  if (insetInput) {
236
188
  this._adapter.updateInsetInputValue(null);
237
189
  }
@@ -239,16 +191,12 @@ export default class DatePickerFoundation extends BaseFoundation {
239
191
  /**
240
192
  * call it when change state value or input value
241
193
  */
242
-
243
-
244
194
  resetCachedSelectedValue(willUpdateDates) {
245
195
  const {
246
196
  value,
247
197
  cachedSelectedValue
248
198
  } = this._adapter.getStates();
249
-
250
199
  const newCachedSelectedValue = Array.isArray(willUpdateDates) ? willUpdateDates : value;
251
-
252
200
  if (!_isEqual(newCachedSelectedValue, cachedSelectedValue)) {
253
201
  this._adapter.updateCachedSelectedValue(newCachedSelectedValue);
254
202
  }
@@ -265,49 +213,36 @@ export default class DatePickerFoundation extends BaseFoundation {
265
213
  * @param {String} inputValue
266
214
  * @param {Date[]} dates
267
215
  */
268
-
269
-
270
216
  closePanel(e) {
271
217
  let inputValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
272
218
  let dates = arguments.length > 2 ? arguments[2] : undefined;
273
-
274
219
  const {
275
220
  value
276
221
  } = this._adapter.getStates();
277
-
278
222
  const willUpdateDates = isNullOrUndefined(dates) ? value : dates;
279
-
280
223
  if (!this._isControlledComponent('open')) {
281
224
  this.close();
282
225
  } else {
283
226
  this.resetInnerSelectedStates(willUpdateDates);
284
227
  }
285
-
286
228
  this._adapter.notifyOpenChange(false);
287
229
  }
288
-
289
230
  open() {
290
231
  this._adapter.togglePanel(true);
291
-
292
232
  this._adapter.registerClickOutSide();
293
233
  }
294
-
295
234
  close() {
296
235
  this._adapter.togglePanel(false, () => this.resetInnerSelectedStates());
297
-
298
236
  this._adapter.unregisterClickOutSide();
299
237
  }
300
-
301
238
  focus(focusType) {
302
239
  if (this._isRangeType()) {
303
240
  const rangeInputFocus = focusType !== null && focusType !== void 0 ? focusType : 'rangeStart';
304
-
305
241
  this._adapter.setRangeInputFocus(rangeInputFocus);
306
242
  } else {
307
243
  this._adapter.setInputFocus();
308
244
  }
309
245
  }
310
-
311
246
  blur() {
312
247
  if (this._isRangeType()) {
313
248
  this._adapter.setRangeInputBlur();
@@ -318,72 +253,52 @@ export default class DatePickerFoundation extends BaseFoundation {
318
253
  /**
319
254
  * reset cachedSelectedValue, inputValue when close panel
320
255
  */
321
-
322
-
323
256
  resetInnerSelectedStates(willUpdateDates) {
324
257
  const {
325
258
  value
326
259
  } = this._adapter.getStates();
327
-
328
260
  const needResetCachedSelectedValue = !this.isCachedSelectedValueValid(willUpdateDates) || this._adapter.needConfirm() && !this.clickConfirmButton;
329
-
330
261
  if (needResetCachedSelectedValue) {
331
262
  this.resetCachedSelectedValue(value);
332
263
  }
333
-
334
264
  this.resetFocus();
335
265
  this.clearInputValue();
336
266
  this.clickConfirmButton = false;
337
267
  }
338
-
339
268
  resetFocus(e) {
340
269
  this._adapter.setRangeInputFocus(false);
341
-
342
270
  this._adapter.notifyBlur(e);
343
271
  }
344
272
  /**
345
273
  * cachedSelectedValue can be `(Date|null)[]` or `null`
346
274
  */
347
-
348
-
349
275
  isCachedSelectedValueValid(dates) {
350
276
  const cachedSelectedValue = dates || this._adapter.getState('cachedSelectedValue');
351
-
352
277
  const {
353
278
  type
354
279
  } = this._adapter.getProps();
355
-
356
280
  let isValid = true;
357
-
358
281
  switch (true) {
359
282
  case type === 'dateRange':
360
283
  case type === 'dateTimeRange':
361
284
  if (!this._isRangeValueComplete(cachedSelectedValue)) {
362
285
  isValid = false;
363
286
  }
364
-
365
287
  break;
366
-
367
288
  default:
368
289
  const value = cachedSelectedValue === null || cachedSelectedValue === void 0 ? void 0 : cachedSelectedValue.filter(item => item);
369
-
370
290
  if (!(Array.isArray(value) && value.length)) {
371
291
  isValid = false;
372
292
  }
373
-
374
293
  break;
375
294
  }
376
-
377
295
  return isValid;
378
296
  }
379
297
  /**
380
298
  * 将输入框内容置空
381
299
  */
382
-
383
-
384
300
  clearInputValue() {
385
301
  this._adapter.updateInputValue(null);
386
-
387
302
  this._adapter.updateInsetInputValue(null);
388
303
  }
389
304
  /**
@@ -392,30 +307,22 @@ export default class DatePickerFoundation extends BaseFoundation {
392
307
  * @param {String} input The value of the input box after the change
393
308
  * @param {Event} e
394
309
  */
395
-
396
-
397
310
  handleInputChange(input, e) {
398
311
  const result = this._isMultiple() ? this.parseMultipleInput(input) : this.parseInput(input);
399
312
  const {
400
313
  value: stateValue
401
314
  } = this.getStates();
402
-
403
- this._updateCachedSelectedValueFromInput(input); // Enter a valid date or empty
404
-
405
-
315
+ this._updateCachedSelectedValueFromInput(input);
316
+ // Enter a valid date or empty
406
317
  if (result && result.length || input === '') {
407
318
  // If you click the clear button
408
319
  if (_get(e, inputStrings.CLEARBTN_CLICKED_EVENT_FLAG) && this._isControlledComponent('value')) {
409
320
  this._notifyChange(result);
410
-
411
321
  return;
412
322
  }
413
-
414
- this._updateValueAndInput(result, input === '', input); // Updates the selected value when entering a valid date
415
-
416
-
323
+ this._updateValueAndInput(result, input === '', input);
324
+ // Updates the selected value when entering a valid date
417
325
  const changedDates = this._getChangedDates(result);
418
-
419
326
  if (!this._someDateDisabled(changedDates, result)) {
420
327
  if (!_isEqual(result, stateValue)) {
421
328
  this._notifyChange(result);
@@ -431,54 +338,39 @@ export default class DatePickerFoundation extends BaseFoundation {
431
338
  * - inputValue(可以解析为合法日期时)
432
339
  * - value(可以解析为合法日期时)
433
340
  */
434
-
435
-
436
341
  handleInsetInputChange(options) {
437
342
  const {
438
343
  insetInputStr,
439
344
  format,
440
345
  insetInputValue
441
346
  } = options;
442
-
443
347
  const _isMultiple = this._isMultiple();
444
-
445
348
  const result = _isMultiple ? this.parseMultipleInput(insetInputStr, format) : this.parseInput(insetInputStr, format);
446
349
  const {
447
350
  value: stateValue
448
351
  } = this.getStates();
449
-
450
352
  this._updateCachedSelectedValueFromInput(insetInputStr);
451
-
452
353
  if (result && result.length) {
453
354
  const changedDates = this._getChangedDates(result);
454
-
455
355
  if (!this._someDateDisabled(changedDates, result)) {
456
356
  if (!_isEqual(result, stateValue)) {
457
357
  if (!this._isControlledComponent() && !this._adapter.needConfirm()) {
458
358
  this._adapter.updateValue(result);
459
359
  }
460
-
461
360
  this._notifyChange(result);
462
361
  }
463
-
464
362
  const triggerInput = _isMultiple ? this.formatMultipleDates(result) : this.formatDates(result);
465
-
466
363
  this._adapter.updateInputValue(triggerInput);
467
364
  }
468
365
  }
469
-
470
366
  this._adapter.updateInsetInputValue(insetInputValue);
471
367
  }
472
368
  /**
473
369
  * when input change we reset cached selected value
474
370
  */
475
-
476
-
477
371
  _updateCachedSelectedValueFromInput(input) {
478
372
  const looseResult = this.getLooseDateFromInput(input);
479
-
480
373
  const changedLooseResult = this._getChangedDates(looseResult);
481
-
482
374
  if (!this._someDateDisabled(changedLooseResult, looseResult)) {
483
375
  this.resetCachedSelectedValue(looseResult);
484
376
  }
@@ -489,8 +381,6 @@ export default class DatePickerFoundation extends BaseFoundation {
489
381
  * @param {Event} e
490
382
  */
491
383
  // eslint-disable-next-line @typescript-eslint/no-empty-function
492
-
493
-
494
384
  handleInputBlur() {
495
385
  let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
496
386
  let e = arguments.length > 1 ? arguments[1] : undefined;
@@ -499,8 +389,6 @@ export default class DatePickerFoundation extends BaseFoundation {
499
389
  * called when range type rangeEnd input tab press
500
390
  * @param {Event} e
501
391
  */
502
-
503
-
504
392
  handleRangeEndTabPress(e) {
505
393
  this._adapter.setRangeInputFocus(false);
506
394
  }
@@ -509,26 +397,20 @@ export default class DatePickerFoundation extends BaseFoundation {
509
397
  * @param {Event} e input focus event
510
398
  * @param {String} range 'rangeStart' or 'rangeEnd', use when type is range
511
399
  */
512
-
513
-
514
400
  handleInputFocus(e, range) {
515
401
  const rangeInputFocus = this._adapter.getState('rangeInputFocus');
516
-
517
402
  range && this._adapter.setRangeInputFocus(range);
518
403
  /**
519
404
  * rangeType: only notify when range is false
520
405
  * not rangeType: notify when focus
521
406
  */
522
-
523
407
  if (!range || !['rangeStart', 'rangeEnd'].includes(rangeInputFocus)) {
524
408
  this._adapter.notifyFocus(e, range);
525
409
  }
526
410
  }
527
-
528
411
  handleSetRangeFocus(rangeInputFocus) {
529
412
  this._adapter.setRangeInputFocus(rangeInputFocus);
530
413
  }
531
-
532
414
  handleInputClear(e) {
533
415
  this._adapter.notifyClear(e);
534
416
  }
@@ -539,51 +421,38 @@ export default class DatePickerFoundation extends BaseFoundation {
539
421
  * callback of range input clear button
540
422
  * Since the clear button is not integrated in Input, you need to manually clear value, inputValue, cachedValue
541
423
  */
542
-
543
-
544
424
  handleRangeInputClear(e) {
545
425
  const value = [];
546
426
  const inputValue = '';
547
-
548
427
  if (!this._isControlledComponent('value')) {
549
428
  this._updateValueAndInput(value, true, inputValue);
550
-
551
429
  this.resetCachedSelectedValue(value);
552
430
  }
553
-
554
431
  this._notifyChange(value);
555
-
556
432
  this._adapter.notifyClear(e);
557
- } // eslint-disable-next-line @typescript-eslint/no-empty-function
558
-
559
-
560
- handleRangeInputBlur(value, e) {} // Parses input only after user returns
561
-
562
-
433
+ }
434
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
435
+ handleRangeInputBlur(value, e) {}
436
+ // Parses input only after user returns
563
437
  handleInputComplete() {
564
438
  let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
565
439
  // console.log(input);
566
440
  let parsedResult = input ? this._isMultiple() ? this.parseMultipleInput(input, ',', true) : this.parseInput(input) : [];
567
- parsedResult = parsedResult && parsedResult.length ? parsedResult : this.getState('value'); // Use the current date as the value when the current input is empty and the last input is also empty
568
-
441
+ parsedResult = parsedResult && parsedResult.length ? parsedResult : this.getState('value');
442
+ // Use the current date as the value when the current input is empty and the last input is also empty
569
443
  if (!parsedResult || !parsedResult.length) {
570
444
  const nowDate = new Date();
571
-
572
445
  if (this._isRangeType()) {
573
446
  parsedResult = [nowDate, nowDate];
574
447
  } else {
575
448
  parsedResult = [nowDate];
576
449
  }
577
450
  }
578
-
579
451
  this._updateValueAndInput(parsedResult);
580
-
581
452
  const {
582
453
  value: stateValue
583
454
  } = this.getStates();
584
-
585
455
  const changedDates = this._getChangedDates(parsedResult);
586
-
587
456
  if (!this._someDateDisabled(changedDates, parsedResult) && !_isEqual(parsedResult, stateValue)) {
588
457
  this._notifyChange(parsedResult);
589
458
  }
@@ -595,37 +464,30 @@ export default class DatePickerFoundation extends BaseFoundation {
595
464
  * @param {string} input
596
465
  * @returns {Date [] | '}
597
466
  */
598
-
599
-
600
467
  parseInput() {
601
468
  let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
602
469
  let format = arguments.length > 1 ? arguments[1] : undefined;
603
- let result = []; // console.log(input);
604
-
470
+ let result = [];
471
+ // console.log(input);
605
472
  const {
606
473
  dateFnsLocale,
607
474
  rangeSeparator
608
475
  } = this.getProps();
609
-
610
476
  if (input && input.length) {
611
477
  const type = this.getProp('type');
612
478
  const formatToken = format || this.getProp('format') || getDefaultFormatTokenByType(type);
613
479
  let parsedResult, formatedInput;
614
480
  const nowDate = new Date();
615
-
616
481
  switch (type) {
617
482
  case 'date':
618
483
  case 'dateTime':
619
484
  case 'month':
620
485
  parsedResult = input ? compatibleParse(input, formatToken, nowDate, dateFnsLocale) : '';
621
486
  formatedInput = parsedResult && isValid(parsedResult) && this.localeFormat(parsedResult, formatToken);
622
-
623
487
  if (parsedResult && formatedInput === input) {
624
488
  result = [parsedResult];
625
489
  }
626
-
627
490
  break;
628
-
629
491
  case 'dateRange':
630
492
  case 'dateTimeRange':
631
493
  case 'monthRange':
@@ -637,26 +499,20 @@ export default class DatePickerFoundation extends BaseFoundation {
637
499
  return arr;
638
500
  }, []);
639
501
  formatedInput = parsedResult && parsedResult.map(v => v && isValid(v) && this.localeFormat(v, formatToken)).join(separator);
640
-
641
502
  if (parsedResult && formatedInput === input) {
642
503
  parsedResult.sort((d1, d2) => d1.getTime() - d2.getTime());
643
504
  result = parsedResult;
644
505
  }
645
-
646
506
  break;
647
-
648
507
  default:
649
508
  break;
650
509
  }
651
510
  }
652
-
653
511
  return result;
654
512
  }
655
513
  /**
656
514
  * get date which may include null from input
657
515
  */
658
-
659
-
660
516
  getLooseDateFromInput(input) {
661
517
  const value = this._isMultiple() ? this.parseMultipleInputLoose(input) : this.parseInputLoose(input);
662
518
  return value;
@@ -672,8 +528,6 @@ export default class DatePickerFoundation extends BaseFoundation {
672
528
  * parseInputLoose('2022-03- ~ 2022-0'); // [null, null]
673
529
  * ```
674
530
  */
675
-
676
-
677
531
  parseInputLoose() {
678
532
  let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
679
533
  let result = [];
@@ -683,64 +537,50 @@ export default class DatePickerFoundation extends BaseFoundation {
683
537
  type,
684
538
  format
685
539
  } = this.getProps();
686
-
687
540
  if (input && input.length) {
688
541
  const formatToken = format || getDefaultFormatTokenByType(type);
689
542
  let parsedResult, formatedInput;
690
543
  const nowDate = new Date();
691
-
692
544
  switch (type) {
693
545
  case 'date':
694
546
  case 'dateTime':
695
547
  case 'month':
696
548
  const _parsedResult = compatibleParse(input, formatToken, nowDate, dateFnsLocale);
697
-
698
549
  if (isValidDate(_parsedResult)) {
699
550
  formatedInput = this.localeFormat(_parsedResult, formatToken);
700
-
701
551
  if (formatedInput === input) {
702
552
  parsedResult = _parsedResult;
703
553
  }
704
554
  } else {
705
555
  parsedResult = null;
706
556
  }
707
-
708
557
  result = [parsedResult];
709
558
  break;
710
-
711
559
  case 'dateRange':
712
560
  case 'dateTimeRange':
713
561
  const separator = rangeSeparator;
714
562
  const values = input.split(separator);
715
563
  parsedResult = values && values.reduce((arr, cur) => {
716
564
  let parsedVal = null;
717
-
718
565
  const _parsedResult = compatibleParse(cur, formatToken, nowDate, dateFnsLocale);
719
-
720
566
  if (isValidDate(_parsedResult)) {
721
567
  formatedInput = this.localeFormat(_parsedResult, formatToken);
722
-
723
568
  if (formatedInput === cur) {
724
569
  parsedVal = _parsedResult;
725
570
  }
726
571
  }
727
-
728
572
  arr.push(parsedVal);
729
573
  return arr;
730
574
  }, []);
731
-
732
575
  if (Array.isArray(parsedResult) && parsedResult.every(item => isValid(item))) {
733
576
  parsedResult.sort((d1, d2) => d1.getTime() - d2.getTime());
734
577
  }
735
-
736
578
  result = parsedResult;
737
579
  break;
738
-
739
580
  default:
740
581
  break;
741
582
  }
742
583
  }
743
-
744
584
  return result;
745
585
  }
746
586
  /**
@@ -753,8 +593,6 @@ export default class DatePickerFoundation extends BaseFoundation {
753
593
  * parseMultipleInputLoose(''); // [];
754
594
  * ```
755
595
  */
756
-
757
-
758
596
  parseMultipleInputLoose() {
759
597
  let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
760
598
  let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : strings.DEFAULT_SEPARATOR_MULTIPLE;
@@ -762,11 +600,9 @@ export default class DatePickerFoundation extends BaseFoundation {
762
600
  const max = this.getProp('max');
763
601
  const inputArr = input.split(separator);
764
602
  const result = [];
765
-
766
603
  for (const curInput of inputArr) {
767
604
  let tmpParsed = curInput && this.parseInputLoose(curInput);
768
605
  tmpParsed = Array.isArray(tmpParsed) ? tmpParsed : tmpParsed && [tmpParsed];
769
-
770
606
  if (tmpParsed && tmpParsed.length) {
771
607
  if (needDedupe) {
772
608
  !result.filter(r => Boolean(tmpParsed.find(tp => isSameSecond(r, tp)))) && result.push(...tmpParsed);
@@ -776,12 +612,10 @@ export default class DatePickerFoundation extends BaseFoundation {
776
612
  } else {
777
613
  return [];
778
614
  }
779
-
780
615
  if (max && max > 0 && result.length > max) {
781
616
  return [];
782
617
  }
783
618
  }
784
-
785
619
  return result;
786
620
  }
787
621
  /**
@@ -793,8 +627,6 @@ export default class DatePickerFoundation extends BaseFoundation {
793
627
  * @param {boolean} [needDedupe=false]
794
628
  * @returns {Date[]}
795
629
  */
796
-
797
-
798
630
  parseMultipleInput() {
799
631
  let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
800
632
  let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : strings.DEFAULT_SEPARATOR_MULTIPLE;
@@ -802,11 +634,9 @@ export default class DatePickerFoundation extends BaseFoundation {
802
634
  const max = this.getProp('max');
803
635
  const inputArr = input.split(separator);
804
636
  const result = [];
805
-
806
637
  for (const curInput of inputArr) {
807
638
  let tmpParsed = curInput && this.parseInput(curInput);
808
639
  tmpParsed = Array.isArray(tmpParsed) ? tmpParsed : tmpParsed && [tmpParsed];
809
-
810
640
  if (tmpParsed && tmpParsed.length) {
811
641
  if (needDedupe) {
812
642
  // 20190519 TODO: needs to determine the case where multiple is true and range
@@ -817,12 +647,10 @@ export default class DatePickerFoundation extends BaseFoundation {
817
647
  } else {
818
648
  return [];
819
649
  }
820
-
821
650
  if (max && max > 0 && result.length > max) {
822
651
  return [];
823
652
  }
824
653
  }
825
-
826
654
  return result;
827
655
  }
828
656
  /**
@@ -831,31 +659,25 @@ export default class DatePickerFoundation extends BaseFoundation {
831
659
  * @param {Date[]} dates
832
660
  * @returns {string}
833
661
  */
834
-
835
-
836
662
  formatDates() {
837
663
  let dates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
838
664
  let customFormat = arguments.length > 1 ? arguments[1] : undefined;
839
665
  let str = '';
840
666
  const rangeSeparator = this.getProp('rangeSeparator');
841
-
842
667
  if (Array.isArray(dates) && dates.length) {
843
668
  const type = this.getProp('type');
844
669
  const formatToken = customFormat || this.getProp('format') || getDefaultFormatTokenByType(type);
845
-
846
670
  switch (type) {
847
671
  case 'date':
848
672
  case 'dateTime':
849
673
  case 'month':
850
674
  str = this.localeFormat(dates[0], formatToken);
851
675
  break;
852
-
853
676
  case 'dateRange':
854
677
  case 'dateTimeRange':
855
678
  case 'monthRange':
856
679
  const startIsTruthy = !isNullOrUndefined(dates[0]);
857
680
  const endIsTruthy = !isNullOrUndefined(dates[1]);
858
-
859
681
  if (startIsTruthy && endIsTruthy) {
860
682
  str = `${this.localeFormat(dates[0], formatToken)}${rangeSeparator}${this.localeFormat(dates[1], formatToken)}`;
861
683
  } else {
@@ -865,14 +687,11 @@ export default class DatePickerFoundation extends BaseFoundation {
865
687
  str = `${rangeSeparator}${this.localeFormat(dates[1], formatToken)}`;
866
688
  }
867
689
  }
868
-
869
690
  break;
870
-
871
691
  default:
872
692
  break;
873
693
  }
874
694
  }
875
-
876
695
  return str;
877
696
  }
878
697
  /**
@@ -881,38 +700,30 @@ export default class DatePickerFoundation extends BaseFoundation {
881
700
  * @param {Date[]} dates
882
701
  * @returns {string}
883
702
  */
884
-
885
-
886
703
  formatMultipleDates() {
887
704
  let dates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
888
705
  let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : strings.DEFAULT_SEPARATOR_MULTIPLE;
889
706
  let customFormat = arguments.length > 2 ? arguments[2] : undefined;
890
707
  const strs = [];
891
-
892
708
  if (Array.isArray(dates) && dates.length) {
893
709
  const type = this.getProp('type');
894
-
895
710
  switch (type) {
896
711
  case 'date':
897
712
  case 'dateTime':
898
713
  case 'month':
899
714
  dates.forEach(date => strs.push(this.formatDates([date], customFormat)));
900
715
  break;
901
-
902
716
  case 'dateRange':
903
717
  case 'dateTimeRange':
904
718
  case 'monthRange':
905
719
  for (let i = 0; i < dates.length; i += 2) {
906
720
  strs.push(this.formatDates(dates.slice(i, i + 2), customFormat));
907
721
  }
908
-
909
722
  break;
910
-
911
723
  default:
912
724
  break;
913
725
  }
914
726
  }
915
-
916
727
  return strs.join(separator);
917
728
  }
918
729
  /**
@@ -923,26 +734,20 @@ export default class DatePickerFoundation extends BaseFoundation {
923
734
  * @param {Boolean} forceUpdateValue
924
735
  * @param {String} input
925
736
  */
926
-
927
-
928
737
  _updateValueAndInput(value, forceUpdateValue, input) {
929
738
  let _value;
930
-
931
739
  if (forceUpdateValue || value) {
932
740
  if (!Array.isArray(value)) {
933
741
  _value = value ? [value] : [];
934
742
  } else {
935
743
  _value = value;
936
744
  }
937
-
938
- const changedDates = this._getChangedDates(_value); // You cannot update the value directly when needConfirm, you can only change the value through handleConfirm
939
-
940
-
745
+ const changedDates = this._getChangedDates(_value);
746
+ // You cannot update the value directly when needConfirm, you can only change the value through handleConfirm
941
747
  if (!this._isControlledComponent() && !this._someDateDisabled(changedDates, _value) && !this._adapter.needConfirm()) {
942
748
  this._adapter.updateValue(_value);
943
749
  }
944
750
  }
945
-
946
751
  this._adapter.updateInputValue(input);
947
752
  }
948
753
  /**
@@ -950,8 +755,6 @@ export default class DatePickerFoundation extends BaseFoundation {
950
755
  * @param {*} value
951
756
  * @param {*} options
952
757
  */
953
-
954
-
955
758
  handleSelectedChange(value, options) {
956
759
  const {
957
760
  type,
@@ -959,35 +762,24 @@ export default class DatePickerFoundation extends BaseFoundation {
959
762
  rangeSeparator,
960
763
  insetInput
961
764
  } = this._adapter.getProps();
962
-
963
765
  const {
964
766
  value: stateValue
965
767
  } = this.getStates();
966
-
967
768
  const controlled = this._isControlledComponent();
968
-
969
769
  const fromPreset = _isObject(options) ? options.fromPreset : options;
970
-
971
770
  const closePanel = _get(options, 'closePanel', true);
972
771
  /**
973
772
  * It is used to determine whether the panel can be stowed. In a Range type component, it is necessary to select both starting Time and endTime before stowing.
974
773
  * To determine whether both starting Time and endTime have been selected, it is used to judge whether the two inputs have been Focused.
975
774
  * This variable is used to indicate whether such a judgment is required. In the scene with shortcut operations, it is not required.
976
775
  */
977
-
978
-
979
776
  const needCheckFocusRecord = _get(options, 'needCheckFocusRecord', true);
980
-
981
777
  const dates = Array.isArray(value) ? [...value] : value ? [value] : [];
982
-
983
778
  const changedDates = this._getChangedDates(dates);
984
-
985
779
  let inputValue, insetInputValue;
986
-
987
780
  if (!this._someDateDisabled(changedDates, dates)) {
988
781
  this.resetCachedSelectedValue(dates);
989
782
  inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
990
-
991
783
  if (insetInput) {
992
784
  const insetInputFormatToken = getInsetInputFormatToken({
993
785
  format,
@@ -1000,7 +792,6 @@ export default class DatePickerFoundation extends BaseFoundation {
1000
792
  rangeSeparator
1001
793
  });
1002
794
  }
1003
-
1004
795
  const isRangeTypeAndInputIncomplete = this._isRangeType() && !this._isRangeValueComplete(dates);
1005
796
  /**
1006
797
  * If the input is incomplete when under control, the notifyChange is not triggered because
@@ -1009,43 +800,33 @@ export default class DatePickerFoundation extends BaseFoundation {
1009
800
  * 受控时如果输入不完整,由于没有触发 notifyChange
1010
801
  * 需要组件内更新一下输入框的值,否则会出现选了一个日期但是输入框没有回显日期的问题 #1357
1011
802
  */
1012
-
1013
803
  if (!this._adapter.needConfirm() || fromPreset) {
1014
804
  if (isRangeTypeAndInputIncomplete) {
1015
805
  // do not change value when selected value is incomplete
1016
806
  this._adapter.updateInputValue(inputValue);
1017
-
1018
807
  this._adapter.updateInsetInputValue(insetInputValue);
1019
-
1020
808
  return;
1021
809
  } else {
1022
810
  if (!controlled || fromPreset) {
1023
811
  this._updateValueAndInput(dates, true, inputValue);
1024
-
1025
812
  this._adapter.updateInsetInputValue(insetInputValue);
1026
813
  }
1027
814
  }
1028
815
  }
1029
-
1030
816
  if (!controlled && this._adapter.needConfirm()) {
1031
817
  // select date only change inputValue when needConfirm is true
1032
818
  this._adapter.updateInputValue(inputValue);
1033
-
1034
- this._adapter.updateInsetInputValue(insetInputValue); // if inputValue is not complete, don't notifyChange
1035
-
1036
-
819
+ this._adapter.updateInsetInputValue(insetInputValue);
820
+ // if inputValue is not complete, don't notifyChange
1037
821
  if (isRangeTypeAndInputIncomplete) {
1038
822
  return;
1039
823
  }
1040
824
  }
1041
-
1042
825
  if (!_isEqual(value, stateValue)) {
1043
826
  this._notifyChange(value);
1044
827
  }
1045
828
  }
1046
-
1047
829
  const focusRecordChecked = !needCheckFocusRecord || needCheckFocusRecord && this._adapter.couldPanelClosed();
1048
-
1049
830
  if (type === 'date' && !this._isMultiple() && closePanel || type === 'dateRange' && this._isRangeValueComplete(dates) && closePanel && focusRecordChecked) {
1050
831
  this.closePanel(undefined, inputValue, dates);
1051
832
  }
@@ -1054,8 +835,6 @@ export default class DatePickerFoundation extends BaseFoundation {
1054
835
  * when changing the year and month through the panel when the type is year or month or monthRange
1055
836
  * @param {*} item
1056
837
  */
1057
-
1058
-
1059
838
  handleYMSelectedChange() {
1060
839
  let item = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1061
840
  // console.log(item);
@@ -1066,7 +845,6 @@ export default class DatePickerFoundation extends BaseFoundation {
1066
845
  const {
1067
846
  type
1068
847
  } = this.getProps();
1069
-
1070
848
  if (type === 'month') {
1071
849
  const date = new Date(currentYear['left'], currentMonth['left'] - 1);
1072
850
  this.handleSelectedChange([date]);
@@ -1076,36 +854,27 @@ export default class DatePickerFoundation extends BaseFoundation {
1076
854
  this.handleSelectedChange([dateLeft, dateRight]);
1077
855
  }
1078
856
  }
1079
-
1080
857
  handleConfirm() {
1081
858
  this.clickConfirmButton = true;
1082
-
1083
859
  const {
1084
860
  cachedSelectedValue,
1085
861
  value
1086
862
  } = this._adapter.getStates();
1087
-
1088
863
  const isRangeValueComplete = this._isRangeValueComplete(cachedSelectedValue);
1089
-
1090
864
  const newValue = isRangeValueComplete ? cachedSelectedValue : value;
1091
-
1092
865
  if (this._adapter.needConfirm() && !this._isControlledComponent()) {
1093
866
  this._adapter.updateValue(newValue);
1094
- } // If the input is incomplete, the legal date of the last input is used
1095
-
1096
-
867
+ }
868
+ // If the input is incomplete, the legal date of the last input is used
1097
869
  this.closePanel(undefined, undefined, newValue);
1098
-
1099
870
  if (isRangeValueComplete) {
1100
871
  const {
1101
872
  notifyValue,
1102
873
  notifyDate
1103
874
  } = this.disposeCallbackArgs(cachedSelectedValue);
1104
-
1105
875
  this._adapter.notifyConfirm(notifyDate, notifyValue);
1106
876
  }
1107
877
  }
1108
-
1109
878
  handleCancel() {
1110
879
  this.closePanel();
1111
880
  const value = this.getState('value');
@@ -1113,10 +882,8 @@ export default class DatePickerFoundation extends BaseFoundation {
1113
882
  notifyValue,
1114
883
  notifyDate
1115
884
  } = this.disposeCallbackArgs(value);
1116
-
1117
885
  this._adapter.notifyCancel(notifyDate, notifyValue);
1118
886
  }
1119
-
1120
887
  handlePresetClick(item, e) {
1121
888
  const {
1122
889
  type,
@@ -1124,7 +891,6 @@ export default class DatePickerFoundation extends BaseFoundation {
1124
891
  } = this.getProps();
1125
892
  const prevTimeZone = this.getState('prevTimezone');
1126
893
  let value;
1127
-
1128
894
  switch (type) {
1129
895
  case 'month':
1130
896
  case 'dateTime':
@@ -1132,7 +898,6 @@ export default class DatePickerFoundation extends BaseFoundation {
1132
898
  value = this.parseWithTimezone([item.start], timeZone, prevTimeZone);
1133
899
  this.handleSelectedChange(value);
1134
900
  break;
1135
-
1136
901
  case 'dateTimeRange':
1137
902
  case 'dateRange':
1138
903
  value = this.parseWithTimezone([item.start, item.end], timeZone, prevTimeZone);
@@ -1140,11 +905,9 @@ export default class DatePickerFoundation extends BaseFoundation {
1140
905
  needCheckFocusRecord: false
1141
906
  });
1142
907
  break;
1143
-
1144
908
  default:
1145
909
  break;
1146
910
  }
1147
-
1148
911
  this._adapter.notifyPresetsClick(item, e);
1149
912
  }
1150
913
  /**
@@ -1175,21 +938,15 @@ export default class DatePickerFoundation extends BaseFoundation {
1175
938
  * @param {Date|Date[]} value
1176
939
  * @return {{ notifyDate: Date|Date[], notifyValue: string|string[]}}
1177
940
  */
1178
-
1179
-
1180
941
  disposeCallbackArgs(value) {
1181
942
  let _value = Array.isArray(value) ? value : value && [value] || [];
1182
-
1183
943
  const timeZone = this.getProp('timeZone');
1184
-
1185
944
  if (isValidTimeZone(timeZone)) {
1186
945
  _value = _value.map(date => zonedTimeToUtc(date, timeZone));
1187
946
  }
1188
-
1189
947
  const type = this.getProp('type');
1190
948
  const formatToken = this.getProp('format') || getDefaultFormatTokenByType(type);
1191
949
  let notifyValue, notifyDate;
1192
-
1193
950
  switch (type) {
1194
951
  case 'date':
1195
952
  case 'dateTime':
@@ -1201,20 +958,16 @@ export default class DatePickerFoundation extends BaseFoundation {
1201
958
  notifyValue = _value.map(v => v && this.localeFormat(v, formatToken));
1202
959
  notifyDate = [..._value];
1203
960
  }
1204
-
1205
961
  break;
1206
-
1207
962
  case 'dateRange':
1208
963
  case 'dateTimeRange':
1209
964
  case 'monthRange':
1210
965
  notifyValue = _value.map(v => v && this.localeFormat(v, formatToken));
1211
966
  notifyDate = [..._value];
1212
967
  break;
1213
-
1214
968
  default:
1215
969
  break;
1216
970
  }
1217
-
1218
971
  return {
1219
972
  notifyValue,
1220
973
  notifyDate
@@ -1224,13 +977,10 @@ export default class DatePickerFoundation extends BaseFoundation {
1224
977
  * Notice: Check whether the date is the same as the state value before calling
1225
978
  * @param {Date[]} value
1226
979
  */
1227
-
1228
-
1229
980
  _notifyChange(value) {
1230
981
  if (this._isRangeType() && !this._isRangeValueComplete(value)) {
1231
982
  return;
1232
983
  }
1233
-
1234
984
  const {
1235
985
  onChangeWithDateFirst
1236
986
  } = this.getProps();
@@ -1238,7 +988,6 @@ export default class DatePickerFoundation extends BaseFoundation {
1238
988
  notifyValue,
1239
989
  notifyDate
1240
990
  } = this.disposeCallbackArgs(value);
1241
-
1242
991
  if (onChangeWithDateFirst) {
1243
992
  this._adapter.notifyChange(notifyDate, notifyValue);
1244
993
  } else {
@@ -1248,45 +997,33 @@ export default class DatePickerFoundation extends BaseFoundation {
1248
997
  /**
1249
998
  * Get the date changed through the date panel or enter
1250
999
  */
1251
-
1252
-
1253
1000
  _getChangedDates(dates) {
1254
1001
  const type = this._adapter.getProp('type');
1255
-
1256
1002
  const {
1257
1003
  cachedSelectedValue: lastDate
1258
1004
  } = this._adapter.getStates();
1259
-
1260
1005
  const changedDates = [];
1261
-
1262
1006
  switch (type) {
1263
1007
  case 'dateRange':
1264
1008
  case 'dateTimeRange':
1265
1009
  const [lastStart, lastEnd] = lastDate;
1266
1010
  const [start, end] = dates;
1267
-
1268
1011
  if (!isDateEqual(start, lastStart)) {
1269
1012
  changedDates.push(start);
1270
1013
  }
1271
-
1272
1014
  if (!isDateEqual(end, lastEnd)) {
1273
1015
  changedDates.push(end);
1274
1016
  }
1275
-
1276
1017
  break;
1277
-
1278
1018
  default:
1279
1019
  const lastValueSet = new Set();
1280
1020
  lastDate.forEach(value => lastValueSet.add(isDate(value) && value.valueOf()));
1281
-
1282
1021
  for (const date of dates) {
1283
1022
  if (!lastValueSet.has(isDate(date) && date.valueOf())) {
1284
1023
  changedDates.push(date);
1285
1024
  }
1286
1025
  }
1287
-
1288
1026
  }
1289
-
1290
1027
  return changedDates;
1291
1028
  }
1292
1029
  /**
@@ -1294,8 +1031,6 @@ export default class DatePickerFoundation extends BaseFoundation {
1294
1031
  * @param value The date that needs to be judged whether to disable
1295
1032
  * @param selectedValue Selected date, when selecting a range, pass this date to the second parameter of `disabledDate`
1296
1033
  */
1297
-
1298
-
1299
1034
  _someDateDisabled(value, selectedValue) {
1300
1035
  const {
1301
1036
  rangeInputFocus
@@ -1304,22 +1039,19 @@ export default class DatePickerFoundation extends BaseFoundation {
1304
1039
  rangeStart: '',
1305
1040
  rangeEnd: '',
1306
1041
  rangeInputFocus
1307
- }; // DisabledDate needs to pass the second parameter
1308
-
1042
+ };
1043
+ // DisabledDate needs to pass the second parameter
1309
1044
  if (this._isRangeType() && Array.isArray(selectedValue)) {
1310
1045
  if (isValid(selectedValue[0])) {
1311
1046
  const rangeStart = format(selectedValue[0], 'yyyy-MM-dd');
1312
1047
  disabledOptions.rangeStart = rangeStart;
1313
1048
  }
1314
-
1315
1049
  if (isValid(selectedValue[1])) {
1316
1050
  const rangeEnd = format(selectedValue[1], 'yyyy-MM-dd');
1317
1051
  disabledOptions.rangeEnd = rangeEnd;
1318
1052
  }
1319
1053
  }
1320
-
1321
1054
  let isSomeDateDisabled = false;
1322
-
1323
1055
  for (const date of value) {
1324
1056
  // skip check if date is null
1325
1057
  if (!isNullOrUndefined(date) && this.disabledDisposeDate(date, disabledOptions)) {
@@ -1327,7 +1059,6 @@ export default class DatePickerFoundation extends BaseFoundation {
1327
1059
  break;
1328
1060
  }
1329
1061
  }
1330
-
1331
1062
  return isSomeDateDisabled;
1332
1063
  }
1333
1064
  /**
@@ -1336,11 +1067,8 @@ export default class DatePickerFoundation extends BaseFoundation {
1336
1067
  * @param {Date} date
1337
1068
  * @param {String} token
1338
1069
  */
1339
-
1340
-
1341
1070
  localeFormat(date, token) {
1342
1071
  const dateFnsLocale = this._adapter.getProp('dateFnsLocale');
1343
-
1344
1072
  return format(date, token, {
1345
1073
  locale: dateFnsLocale
1346
1074
  });
@@ -1354,8 +1082,6 @@ export default class DatePickerFoundation extends BaseFoundation {
1354
1082
  * @param {Date|Date[]} date
1355
1083
  * @returns {Boolean}
1356
1084
  */
1357
-
1358
-
1359
1085
  disposeDateFn(fn, date) {
1360
1086
  const {
1361
1087
  notifyDate
@@ -1363,17 +1089,14 @@ export default class DatePickerFoundation extends BaseFoundation {
1363
1089
  const dateIsArray = Array.isArray(date);
1364
1090
  const notifyDateIsArray = Array.isArray(notifyDate);
1365
1091
  let disposeDate;
1366
-
1367
1092
  if (dateIsArray === notifyDateIsArray) {
1368
1093
  disposeDate = notifyDate;
1369
1094
  } else {
1370
1095
  disposeDate = dateIsArray ? [notifyDate] : notifyDate[0];
1371
1096
  }
1372
-
1373
1097
  for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1374
1098
  rest[_key - 2] = arguments[_key];
1375
1099
  }
1376
-
1377
1100
  return fn(disposeDate, ...rest);
1378
1101
  }
1379
1102
  /**
@@ -1382,17 +1105,13 @@ export default class DatePickerFoundation extends BaseFoundation {
1382
1105
  * @param {Date} date
1383
1106
  * @returns {Boolean}
1384
1107
  */
1385
-
1386
-
1387
1108
  disabledDisposeDate(date) {
1388
1109
  const {
1389
1110
  disabledDate
1390
1111
  } = this.getProps();
1391
-
1392
1112
  for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1393
1113
  rest[_key2 - 1] = arguments[_key2];
1394
1114
  }
1395
-
1396
1115
  return this.disposeDateFn(disabledDate, date, ...rest);
1397
1116
  }
1398
1117
  /**
@@ -1401,17 +1120,13 @@ export default class DatePickerFoundation extends BaseFoundation {
1401
1120
  * @param {Date|Date[]} date
1402
1121
  * @returns {Object}
1403
1122
  */
1404
-
1405
-
1406
1123
  disabledDisposeTime(date) {
1407
1124
  const {
1408
1125
  disabledTime
1409
1126
  } = this.getProps();
1410
-
1411
1127
  for (var _len3 = arguments.length, rest = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
1412
1128
  rest[_key3 - 1] = arguments[_key3];
1413
1129
  }
1414
-
1415
1130
  return this.disposeDateFn(disabledTime, date, ...rest);
1416
1131
  }
1417
1132
  /**
@@ -1422,18 +1137,14 @@ export default class DatePickerFoundation extends BaseFoundation {
1422
1137
  * @param {Event} e
1423
1138
  * @returns
1424
1139
  */
1425
-
1426
-
1427
1140
  handleTriggerWrapperClick(e) {
1428
1141
  const {
1429
1142
  disabled,
1430
1143
  triggerRender
1431
1144
  } = this._adapter.getProps();
1432
-
1433
1145
  const {
1434
1146
  rangeInputFocus
1435
1147
  } = this._adapter.getStates();
1436
-
1437
1148
  if (disabled) {
1438
1149
  return;
1439
1150
  }
@@ -1444,8 +1155,6 @@ export default class DatePickerFoundation extends BaseFoundation {
1444
1155
  * - When type is not range type, Input component will automatically focus in the same case
1445
1156
  * - isEventTarget is used to judge whether the event is a bubbling event
1446
1157
  */
1447
-
1448
-
1449
1158
  if (this._isRangeType() && !rangeInputFocus) {
1450
1159
  if (this._adapter.isEventTarget(e)) {
1451
1160
  setTimeout(() => {
@@ -1457,13 +1166,11 @@ export default class DatePickerFoundation extends BaseFoundation {
1457
1166
  // If it is a triggerRender scene, because there is no input, the default focus is rangeStart when the panel is opened
1458
1167
  this._adapter.setRangeInputFocus('rangeStart');
1459
1168
  }
1460
-
1461
1169
  this.openPanel();
1462
1170
  } else {
1463
1171
  this.openPanel();
1464
1172
  }
1465
1173
  }
1466
-
1467
1174
  handlePanelVisibleChange(visible) {
1468
1175
  if (visible) {
1469
1176
  this._adapter.setInsetInputFocus();
@@ -1471,8 +1178,6 @@ export default class DatePickerFoundation extends BaseFoundation {
1471
1178
  * After the panel is closed, the trigger input is disabled
1472
1179
  * 面板关闭后,trigger input 禁用
1473
1180
  */
1474
-
1475
-
1476
1181
  setTimeout(() => {
1477
1182
  this._adapter.setTriggerDisabled(true);
1478
1183
  }, 0);
@@ -1480,5 +1185,4 @@ export default class DatePickerFoundation extends BaseFoundation {
1480
1185
  this._adapter.setTriggerDisabled(false);
1481
1186
  }
1482
1187
  }
1483
-
1484
1188
  }