@rc-component/picker 1.0.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 (569) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +154 -0
  3. package/assets/index.css +407 -0
  4. package/assets/index.less +570 -0
  5. package/es/PickerInput/Popup/Footer.d.ts +19 -0
  6. package/es/PickerInput/Popup/Footer.js +78 -0
  7. package/es/PickerInput/Popup/PopupPanel.d.ts +10 -0
  8. package/es/PickerInput/Popup/PopupPanel.js +84 -0
  9. package/es/PickerInput/Popup/PresetPanel.d.ts +9 -0
  10. package/es/PickerInput/Popup/PresetPanel.js +31 -0
  11. package/es/PickerInput/Popup/index.d.ts +20 -0
  12. package/es/PickerInput/Popup/index.js +198 -0
  13. package/es/PickerInput/RangePicker.d.ts +54 -0
  14. package/es/PickerInput/RangePicker.js +641 -0
  15. package/es/PickerInput/Selector/Icon.d.ts +10 -0
  16. package/es/PickerInput/Selector/Icon.js +32 -0
  17. package/es/PickerInput/Selector/Input.d.ts +28 -0
  18. package/es/PickerInput/Selector/Input.js +377 -0
  19. package/es/PickerInput/Selector/MaskFormat.d.ts +22 -0
  20. package/es/PickerInput/Selector/MaskFormat.js +107 -0
  21. package/es/PickerInput/Selector/RangeSelector.d.ts +26 -0
  22. package/es/PickerInput/Selector/RangeSelector.js +218 -0
  23. package/es/PickerInput/Selector/SingleSelector/MultipleDates.d.ts +12 -0
  24. package/es/PickerInput/Selector/SingleSelector/MultipleDates.js +66 -0
  25. package/es/PickerInput/Selector/SingleSelector/index.d.ts +18 -0
  26. package/es/PickerInput/Selector/SingleSelector/index.js +187 -0
  27. package/es/PickerInput/Selector/hooks/useClearIcon.d.ts +8 -0
  28. package/es/PickerInput/Selector/hooks/useClearIcon.js +19 -0
  29. package/es/PickerInput/Selector/hooks/useInputProps.d.ts +16 -0
  30. package/es/PickerInput/Selector/hooks/useInputProps.js +178 -0
  31. package/es/PickerInput/Selector/hooks/useRootProps.d.ts +2 -0
  32. package/es/PickerInput/Selector/hooks/useRootProps.js +8 -0
  33. package/es/PickerInput/Selector/util.d.ts +1 -0
  34. package/es/PickerInput/Selector/util.js +12 -0
  35. package/es/PickerInput/SinglePicker.d.ts +51 -0
  36. package/es/PickerInput/SinglePicker.js +545 -0
  37. package/es/PickerInput/context.d.ts +13 -0
  38. package/es/PickerInput/context.js +3 -0
  39. package/es/PickerInput/hooks/useCellRender.d.ts +2 -0
  40. package/es/PickerInput/hooks/useCellRender.js +41 -0
  41. package/es/PickerInput/hooks/useDelayState.d.ts +5 -0
  42. package/es/PickerInput/hooks/useDelayState.js +48 -0
  43. package/es/PickerInput/hooks/useDisabledBoundary.d.ts +7 -0
  44. package/es/PickerInput/hooks/useDisabledBoundary.js +20 -0
  45. package/es/PickerInput/hooks/useFieldFormat.d.ts +2 -0
  46. package/es/PickerInput/hooks/useFieldFormat.js +18 -0
  47. package/es/PickerInput/hooks/useFieldsInvalidate.d.ts +5 -0
  48. package/es/PickerInput/hooks/useFieldsInvalidate.js +55 -0
  49. package/es/PickerInput/hooks/useFilledProps.d.ts +37 -0
  50. package/es/PickerInput/hooks/useFilledProps.js +155 -0
  51. package/es/PickerInput/hooks/useInputReadOnly.d.ts +2 -0
  52. package/es/PickerInput/hooks/useInputReadOnly.js +6 -0
  53. package/es/PickerInput/hooks/useInvalidate.d.ts +9 -0
  54. package/es/PickerInput/hooks/useInvalidate.js +61 -0
  55. package/es/PickerInput/hooks/useLockEffect.d.ts +5 -0
  56. package/es/PickerInput/hooks/useLockEffect.js +25 -0
  57. package/es/PickerInput/hooks/useOpen.d.ts +6 -0
  58. package/es/PickerInput/hooks/useOpen.js +33 -0
  59. package/es/PickerInput/hooks/usePickerRef.d.ts +7 -0
  60. package/es/PickerInput/hooks/usePickerRef.js +19 -0
  61. package/es/PickerInput/hooks/usePresets.d.ts +2 -0
  62. package/es/PickerInput/hooks/usePresets.js +28 -0
  63. package/es/PickerInput/hooks/useRangeActive.d.ts +19 -0
  64. package/es/PickerInput/hooks/useRangeActive.js +74 -0
  65. package/es/PickerInput/hooks/useRangeDisabledDate.d.ts +8 -0
  66. package/es/PickerInput/hooks/useRangeDisabledDate.js +53 -0
  67. package/es/PickerInput/hooks/useRangePickerValue.d.ts +5 -0
  68. package/es/PickerInput/hooks/useRangePickerValue.js +192 -0
  69. package/es/PickerInput/hooks/useRangeValue.d.ts +28 -0
  70. package/es/PickerInput/hooks/useRangeValue.js +297 -0
  71. package/es/PickerInput/hooks/useShowNow.d.ts +2 -0
  72. package/es/PickerInput/hooks/useShowNow.js +14 -0
  73. package/es/PickerPanel/DatePanel/index.d.ts +10 -0
  74. package/es/PickerPanel/DatePanel/index.js +190 -0
  75. package/es/PickerPanel/DateTimePanel/index.d.ts +3 -0
  76. package/es/PickerPanel/DateTimePanel/index.js +55 -0
  77. package/es/PickerPanel/DecadePanel/index.d.ts +3 -0
  78. package/es/PickerPanel/DecadePanel/index.js +113 -0
  79. package/es/PickerPanel/MonthPanel/index.d.ts +3 -0
  80. package/es/PickerPanel/MonthPanel/index.js +106 -0
  81. package/es/PickerPanel/PanelBody.d.ts +17 -0
  82. package/es/PickerPanel/PanelBody.js +153 -0
  83. package/es/PickerPanel/PanelHeader.d.ts +11 -0
  84. package/es/PickerPanel/PanelHeader.js +133 -0
  85. package/es/PickerPanel/QuarterPanel/index.d.ts +3 -0
  86. package/es/PickerPanel/QuarterPanel/index.js +92 -0
  87. package/es/PickerPanel/TimePanel/TimePanelBody/TimeColumn.d.ts +17 -0
  88. package/es/PickerPanel/TimePanel/TimePanelBody/TimeColumn.js +149 -0
  89. package/es/PickerPanel/TimePanel/TimePanelBody/index.d.ts +4 -0
  90. package/es/PickerPanel/TimePanel/TimePanelBody/index.js +283 -0
  91. package/es/PickerPanel/TimePanel/TimePanelBody/useScrollTo.d.ts +2 -0
  92. package/es/PickerPanel/TimePanel/TimePanelBody/useScrollTo.js +72 -0
  93. package/es/PickerPanel/TimePanel/TimePanelBody/util.d.ts +3 -0
  94. package/es/PickerPanel/TimePanel/TimePanelBody/util.js +43 -0
  95. package/es/PickerPanel/TimePanel/index.d.ts +4 -0
  96. package/es/PickerPanel/TimePanel/index.js +38 -0
  97. package/es/PickerPanel/WeekPanel/index.d.ts +3 -0
  98. package/es/PickerPanel/WeekPanel/index.js +55 -0
  99. package/es/PickerPanel/YearPanel/index.d.ts +3 -0
  100. package/es/PickerPanel/YearPanel/index.js +116 -0
  101. package/es/PickerPanel/context.d.ts +24 -0
  102. package/es/PickerPanel/context.js +67 -0
  103. package/es/PickerPanel/index.d.ts +60 -0
  104. package/es/PickerPanel/index.js +315 -0
  105. package/es/PickerTrigger/index.d.ts +19 -0
  106. package/es/PickerTrigger/index.js +86 -0
  107. package/es/PickerTrigger/util.d.ts +2 -0
  108. package/es/PickerTrigger/util.js +4 -0
  109. package/es/generate/dateFns.d.ts +3 -0
  110. package/es/generate/dateFns.js +163 -0
  111. package/es/generate/dayjs.d.ts +4 -0
  112. package/es/generate/dayjs.js +233 -0
  113. package/es/generate/index.d.ts +37 -0
  114. package/es/generate/index.js +1 -0
  115. package/es/generate/luxon.d.ts +4 -0
  116. package/es/generate/luxon.js +197 -0
  117. package/es/generate/moment.d.ts +4 -0
  118. package/es/generate/moment.js +152 -0
  119. package/es/hooks/useLocale.d.ts +6 -0
  120. package/es/hooks/useLocale.js +82 -0
  121. package/es/hooks/useSyncState.d.ts +6 -0
  122. package/es/hooks/useSyncState.js +27 -0
  123. package/es/hooks/useTimeConfig.d.ts +18 -0
  124. package/es/hooks/useTimeConfig.js +166 -0
  125. package/es/hooks/useTimeInfo.d.ts +12 -0
  126. package/es/hooks/useTimeInfo.js +164 -0
  127. package/es/hooks/useToggleDates.d.ts +8 -0
  128. package/es/hooks/useToggleDates.js +26 -0
  129. package/es/index.d.ts +35 -0
  130. package/es/index.js +34 -0
  131. package/es/interface.d.ts +365 -0
  132. package/es/interface.js +1 -0
  133. package/es/locale/am_ET.d.ts +3 -0
  134. package/es/locale/am_ET.js +31 -0
  135. package/es/locale/ar_EG.d.ts +3 -0
  136. package/es/locale/ar_EG.js +34 -0
  137. package/es/locale/az_AZ.d.ts +3 -0
  138. package/es/locale/az_AZ.js +35 -0
  139. package/es/locale/bg_BG.d.ts +3 -0
  140. package/es/locale/bg_BG.js +34 -0
  141. package/es/locale/bn_BD.d.ts +3 -0
  142. package/es/locale/bn_BD.js +35 -0
  143. package/es/locale/by_BY.d.ts +3 -0
  144. package/es/locale/by_BY.js +35 -0
  145. package/es/locale/ca_ES.d.ts +3 -0
  146. package/es/locale/ca_ES.js +34 -0
  147. package/es/locale/common.d.ts +2 -0
  148. package/es/locale/common.js +6 -0
  149. package/es/locale/cs_CZ.d.ts +3 -0
  150. package/es/locale/cs_CZ.js +34 -0
  151. package/es/locale/da_DK.d.ts +3 -0
  152. package/es/locale/da_DK.js +34 -0
  153. package/es/locale/de_DE.d.ts +3 -0
  154. package/es/locale/de_DE.js +34 -0
  155. package/es/locale/el_GR.d.ts +3 -0
  156. package/es/locale/el_GR.js +34 -0
  157. package/es/locale/en_GB.d.ts +3 -0
  158. package/es/locale/en_GB.js +34 -0
  159. package/es/locale/en_US.d.ts +3 -0
  160. package/es/locale/en_US.js +35 -0
  161. package/es/locale/es_ES.d.ts +3 -0
  162. package/es/locale/es_ES.js +34 -0
  163. package/es/locale/es_MX.d.ts +3 -0
  164. package/es/locale/es_MX.js +35 -0
  165. package/es/locale/et_EE.d.ts +3 -0
  166. package/es/locale/et_EE.js +34 -0
  167. package/es/locale/eu_ES.d.ts +3 -0
  168. package/es/locale/eu_ES.js +36 -0
  169. package/es/locale/fa_IR.d.ts +3 -0
  170. package/es/locale/fa_IR.js +34 -0
  171. package/es/locale/fi_FI.d.ts +3 -0
  172. package/es/locale/fi_FI.js +34 -0
  173. package/es/locale/fr_BE.d.ts +3 -0
  174. package/es/locale/fr_BE.js +34 -0
  175. package/es/locale/fr_CA.d.ts +3 -0
  176. package/es/locale/fr_CA.js +35 -0
  177. package/es/locale/fr_FR.d.ts +3 -0
  178. package/es/locale/fr_FR.js +35 -0
  179. package/es/locale/ga_IE.d.ts +3 -0
  180. package/es/locale/ga_IE.js +35 -0
  181. package/es/locale/gl_ES.d.ts +3 -0
  182. package/es/locale/gl_ES.js +34 -0
  183. package/es/locale/he_IL.d.ts +3 -0
  184. package/es/locale/he_IL.js +35 -0
  185. package/es/locale/hi_IN.d.ts +3 -0
  186. package/es/locale/hi_IN.js +35 -0
  187. package/es/locale/hr_HR.d.ts +3 -0
  188. package/es/locale/hr_HR.js +35 -0
  189. package/es/locale/hu_HU.d.ts +3 -0
  190. package/es/locale/hu_HU.js +58 -0
  191. package/es/locale/id_ID.d.ts +3 -0
  192. package/es/locale/id_ID.js +35 -0
  193. package/es/locale/is_IS.d.ts +3 -0
  194. package/es/locale/is_IS.js +34 -0
  195. package/es/locale/it_IT.d.ts +3 -0
  196. package/es/locale/it_IT.js +34 -0
  197. package/es/locale/ja_JP.d.ts +3 -0
  198. package/es/locale/ja_JP.js +37 -0
  199. package/es/locale/ka_GE.d.ts +3 -0
  200. package/es/locale/ka_GE.js +35 -0
  201. package/es/locale/kk_KZ.d.ts +3 -0
  202. package/es/locale/kk_KZ.js +34 -0
  203. package/es/locale/km_KH.d.ts +3 -0
  204. package/es/locale/km_KH.js +36 -0
  205. package/es/locale/kmr_IQ.d.ts +3 -0
  206. package/es/locale/kmr_IQ.js +34 -0
  207. package/es/locale/kn_IN.d.ts +3 -0
  208. package/es/locale/kn_IN.js +35 -0
  209. package/es/locale/ko_KR.d.ts +3 -0
  210. package/es/locale/ko_KR.js +36 -0
  211. package/es/locale/lt_LT.d.ts +3 -0
  212. package/es/locale/lt_LT.js +36 -0
  213. package/es/locale/lv_LV.d.ts +3 -0
  214. package/es/locale/lv_LV.js +34 -0
  215. package/es/locale/mk_MK.d.ts +3 -0
  216. package/es/locale/mk_MK.js +34 -0
  217. package/es/locale/ml_IN.d.ts +3 -0
  218. package/es/locale/ml_IN.js +35 -0
  219. package/es/locale/mn_MN.d.ts +3 -0
  220. package/es/locale/mn_MN.js +36 -0
  221. package/es/locale/ms_MY.d.ts +3 -0
  222. package/es/locale/ms_MY.js +36 -0
  223. package/es/locale/my_MM.d.ts +3 -0
  224. package/es/locale/my_MM.js +35 -0
  225. package/es/locale/nb_NO.d.ts +3 -0
  226. package/es/locale/nb_NO.js +36 -0
  227. package/es/locale/ne_NP.d.ts +3 -0
  228. package/es/locale/ne_NP.js +35 -0
  229. package/es/locale/nl_BE.d.ts +3 -0
  230. package/es/locale/nl_BE.js +34 -0
  231. package/es/locale/nl_NL.d.ts +3 -0
  232. package/es/locale/nl_NL.js +34 -0
  233. package/es/locale/pl_PL.d.ts +3 -0
  234. package/es/locale/pl_PL.js +34 -0
  235. package/es/locale/pt_BR.d.ts +3 -0
  236. package/es/locale/pt_BR.js +37 -0
  237. package/es/locale/pt_PT.d.ts +3 -0
  238. package/es/locale/pt_PT.js +36 -0
  239. package/es/locale/ro_RO.d.ts +3 -0
  240. package/es/locale/ro_RO.js +35 -0
  241. package/es/locale/ru_RU.d.ts +3 -0
  242. package/es/locale/ru_RU.js +34 -0
  243. package/es/locale/si_LK.d.ts +3 -0
  244. package/es/locale/si_LK.js +36 -0
  245. package/es/locale/sk_SK.d.ts +3 -0
  246. package/es/locale/sk_SK.js +34 -0
  247. package/es/locale/sl_SI.d.ts +3 -0
  248. package/es/locale/sl_SI.js +34 -0
  249. package/es/locale/sr_Cyrl_RS.d.ts +3 -0
  250. package/es/locale/sr_Cyrl_RS.js +34 -0
  251. package/es/locale/sr_RS.d.ts +3 -0
  252. package/es/locale/sr_RS.js +34 -0
  253. package/es/locale/sv_SE.d.ts +3 -0
  254. package/es/locale/sv_SE.js +34 -0
  255. package/es/locale/ta_IN.d.ts +3 -0
  256. package/es/locale/ta_IN.js +35 -0
  257. package/es/locale/th_TH.d.ts +3 -0
  258. package/es/locale/th_TH.js +34 -0
  259. package/es/locale/tk_TK.d.ts +3 -0
  260. package/es/locale/tk_TK.js +34 -0
  261. package/es/locale/tr_TR.d.ts +3 -0
  262. package/es/locale/tr_TR.js +36 -0
  263. package/es/locale/ug_CN.d.ts +3 -0
  264. package/es/locale/ug_CN.js +37 -0
  265. package/es/locale/uk_UA.d.ts +3 -0
  266. package/es/locale/uk_UA.js +34 -0
  267. package/es/locale/ur_PK.d.ts +3 -0
  268. package/es/locale/ur_PK.js +35 -0
  269. package/es/locale/uz_UZ.d.ts +3 -0
  270. package/es/locale/uz_UZ.js +35 -0
  271. package/es/locale/vi_VN.d.ts +3 -0
  272. package/es/locale/vi_VN.js +35 -0
  273. package/es/locale/zh_CN.d.ts +3 -0
  274. package/es/locale/zh_CN.js +36 -0
  275. package/es/locale/zh_TW.d.ts +3 -0
  276. package/es/locale/zh_TW.js +38 -0
  277. package/es/utils/dateUtil.d.ts +29 -0
  278. package/es/utils/dateUtil.js +140 -0
  279. package/es/utils/getClearIcon.d.ts +5 -0
  280. package/es/utils/getClearIcon.js +8 -0
  281. package/es/utils/miscUtil.d.ts +14 -0
  282. package/es/utils/miscUtil.js +70 -0
  283. package/es/utils/uiUtil.d.ts +1 -0
  284. package/es/utils/uiUtil.js +7 -0
  285. package/es/utils/warnUtil.d.ts +5 -0
  286. package/es/utils/warnUtil.js +10 -0
  287. package/lib/PickerInput/Popup/Footer.d.ts +19 -0
  288. package/lib/PickerInput/Popup/Footer.js +88 -0
  289. package/lib/PickerInput/Popup/PopupPanel.d.ts +10 -0
  290. package/lib/PickerInput/Popup/PopupPanel.js +93 -0
  291. package/lib/PickerInput/Popup/PresetPanel.d.ts +9 -0
  292. package/lib/PickerInput/Popup/PresetPanel.js +40 -0
  293. package/lib/PickerInput/Popup/index.d.ts +20 -0
  294. package/lib/PickerInput/Popup/index.js +207 -0
  295. package/lib/PickerInput/RangePicker.d.ts +54 -0
  296. package/lib/PickerInput/RangePicker.js +650 -0
  297. package/lib/PickerInput/Selector/Icon.d.ts +10 -0
  298. package/lib/PickerInput/Selector/Icon.js +43 -0
  299. package/lib/PickerInput/Selector/Input.d.ts +28 -0
  300. package/lib/PickerInput/Selector/Input.js +385 -0
  301. package/lib/PickerInput/Selector/MaskFormat.d.ts +22 -0
  302. package/lib/PickerInput/Selector/MaskFormat.js +112 -0
  303. package/lib/PickerInput/Selector/RangeSelector.d.ts +26 -0
  304. package/lib/PickerInput/Selector/RangeSelector.js +227 -0
  305. package/lib/PickerInput/Selector/SingleSelector/MultipleDates.d.ts +12 -0
  306. package/lib/PickerInput/Selector/SingleSelector/MultipleDates.js +76 -0
  307. package/lib/PickerInput/Selector/SingleSelector/index.d.ts +18 -0
  308. package/lib/PickerInput/Selector/SingleSelector/index.js +196 -0
  309. package/lib/PickerInput/Selector/hooks/useClearIcon.d.ts +8 -0
  310. package/lib/PickerInput/Selector/hooks/useClearIcon.js +27 -0
  311. package/lib/PickerInput/Selector/hooks/useInputProps.d.ts +16 -0
  312. package/lib/PickerInput/Selector/hooks/useInputProps.js +187 -0
  313. package/lib/PickerInput/Selector/hooks/useRootProps.d.ts +2 -0
  314. package/lib/PickerInput/Selector/hooks/useRootProps.js +17 -0
  315. package/lib/PickerInput/Selector/util.d.ts +1 -0
  316. package/lib/PickerInput/Selector/util.js +18 -0
  317. package/lib/PickerInput/SinglePicker.d.ts +51 -0
  318. package/lib/PickerInput/SinglePicker.js +553 -0
  319. package/lib/PickerInput/context.d.ts +13 -0
  320. package/lib/PickerInput/context.js +12 -0
  321. package/lib/PickerInput/hooks/useCellRender.d.ts +2 -0
  322. package/lib/PickerInput/hooks/useCellRender.js +49 -0
  323. package/lib/PickerInput/hooks/useDelayState.d.ts +5 -0
  324. package/lib/PickerInput/hooks/useDelayState.js +54 -0
  325. package/lib/PickerInput/hooks/useDisabledBoundary.d.ts +7 -0
  326. package/lib/PickerInput/hooks/useDisabledBoundary.js +26 -0
  327. package/lib/PickerInput/hooks/useFieldFormat.d.ts +2 -0
  328. package/lib/PickerInput/hooks/useFieldFormat.js +26 -0
  329. package/lib/PickerInput/hooks/useFieldsInvalidate.d.ts +5 -0
  330. package/lib/PickerInput/hooks/useFieldsInvalidate.js +64 -0
  331. package/lib/PickerInput/hooks/useFilledProps.d.ts +37 -0
  332. package/lib/PickerInput/hooks/useFilledProps.js +164 -0
  333. package/lib/PickerInput/hooks/useInputReadOnly.d.ts +2 -0
  334. package/lib/PickerInput/hooks/useInputReadOnly.js +12 -0
  335. package/lib/PickerInput/hooks/useInvalidate.d.ts +9 -0
  336. package/lib/PickerInput/hooks/useInvalidate.js +67 -0
  337. package/lib/PickerInput/hooks/useLockEffect.d.ts +5 -0
  338. package/lib/PickerInput/hooks/useLockEffect.js +34 -0
  339. package/lib/PickerInput/hooks/useOpen.d.ts +6 -0
  340. package/lib/PickerInput/hooks/useOpen.js +39 -0
  341. package/lib/PickerInput/hooks/usePickerRef.d.ts +7 -0
  342. package/lib/PickerInput/hooks/usePickerRef.js +28 -0
  343. package/lib/PickerInput/hooks/usePresets.d.ts +2 -0
  344. package/lib/PickerInput/hooks/usePresets.js +38 -0
  345. package/lib/PickerInput/hooks/useRangeActive.d.ts +19 -0
  346. package/lib/PickerInput/hooks/useRangeActive.js +84 -0
  347. package/lib/PickerInput/hooks/useRangeDisabledDate.d.ts +8 -0
  348. package/lib/PickerInput/hooks/useRangeDisabledDate.js +58 -0
  349. package/lib/PickerInput/hooks/useRangePickerValue.d.ts +5 -0
  350. package/lib/PickerInput/hooks/useRangePickerValue.js +203 -0
  351. package/lib/PickerInput/hooks/useRangeValue.d.ts +28 -0
  352. package/lib/PickerInput/hooks/useRangeValue.js +308 -0
  353. package/lib/PickerInput/hooks/useShowNow.d.ts +2 -0
  354. package/lib/PickerInput/hooks/useShowNow.js +20 -0
  355. package/lib/PickerPanel/DatePanel/index.d.ts +10 -0
  356. package/lib/PickerPanel/DatePanel/index.js +199 -0
  357. package/lib/PickerPanel/DateTimePanel/index.d.ts +3 -0
  358. package/lib/PickerPanel/DateTimePanel/index.js +65 -0
  359. package/lib/PickerPanel/DecadePanel/index.d.ts +3 -0
  360. package/lib/PickerPanel/DecadePanel/index.js +122 -0
  361. package/lib/PickerPanel/MonthPanel/index.d.ts +3 -0
  362. package/lib/PickerPanel/MonthPanel/index.js +115 -0
  363. package/lib/PickerPanel/PanelBody.d.ts +17 -0
  364. package/lib/PickerPanel/PanelBody.js +162 -0
  365. package/lib/PickerPanel/PanelHeader.d.ts +11 -0
  366. package/lib/PickerPanel/PanelHeader.js +143 -0
  367. package/lib/PickerPanel/QuarterPanel/index.d.ts +3 -0
  368. package/lib/PickerPanel/QuarterPanel/index.js +101 -0
  369. package/lib/PickerPanel/TimePanel/TimePanelBody/TimeColumn.d.ts +17 -0
  370. package/lib/PickerPanel/TimePanel/TimePanelBody/TimeColumn.js +158 -0
  371. package/lib/PickerPanel/TimePanel/TimePanelBody/index.d.ts +4 -0
  372. package/lib/PickerPanel/TimePanel/TimePanelBody/index.js +293 -0
  373. package/lib/PickerPanel/TimePanel/TimePanelBody/useScrollTo.d.ts +2 -0
  374. package/lib/PickerPanel/TimePanel/TimePanelBody/useScrollTo.js +82 -0
  375. package/lib/PickerPanel/TimePanel/TimePanelBody/util.d.ts +3 -0
  376. package/lib/PickerPanel/TimePanel/TimePanelBody/util.js +49 -0
  377. package/lib/PickerPanel/TimePanel/index.d.ts +4 -0
  378. package/lib/PickerPanel/TimePanel/index.js +48 -0
  379. package/lib/PickerPanel/WeekPanel/index.d.ts +3 -0
  380. package/lib/PickerPanel/WeekPanel/index.js +64 -0
  381. package/lib/PickerPanel/YearPanel/index.d.ts +3 -0
  382. package/lib/PickerPanel/YearPanel/index.js +125 -0
  383. package/lib/PickerPanel/context.d.ts +24 -0
  384. package/lib/PickerPanel/context.js +78 -0
  385. package/lib/PickerPanel/index.d.ts +60 -0
  386. package/lib/PickerPanel/index.js +324 -0
  387. package/lib/PickerTrigger/index.d.ts +19 -0
  388. package/lib/PickerTrigger/index.js +95 -0
  389. package/lib/PickerTrigger/util.d.ts +2 -0
  390. package/lib/PickerTrigger/util.js +10 -0
  391. package/lib/generate/dateFns.d.ts +3 -0
  392. package/lib/generate/dateFns.js +172 -0
  393. package/lib/generate/dayjs.d.ts +4 -0
  394. package/lib/generate/dayjs.js +240 -0
  395. package/lib/generate/index.d.ts +37 -0
  396. package/lib/generate/index.js +5 -0
  397. package/lib/generate/luxon.d.ts +4 -0
  398. package/lib/generate/luxon.js +203 -0
  399. package/lib/generate/moment.d.ts +4 -0
  400. package/lib/generate/moment.js +159 -0
  401. package/lib/hooks/useLocale.d.ts +6 -0
  402. package/lib/hooks/useLocale.js +90 -0
  403. package/lib/hooks/useSyncState.d.ts +6 -0
  404. package/lib/hooks/useSyncState.js +35 -0
  405. package/lib/hooks/useTimeConfig.d.ts +18 -0
  406. package/lib/hooks/useTimeConfig.js +173 -0
  407. package/lib/hooks/useTimeInfo.d.ts +12 -0
  408. package/lib/hooks/useTimeInfo.js +172 -0
  409. package/lib/hooks/useToggleDates.d.ts +8 -0
  410. package/lib/hooks/useToggleDates.js +32 -0
  411. package/lib/index.d.ts +35 -0
  412. package/lib/index.js +57 -0
  413. package/lib/interface.d.ts +365 -0
  414. package/lib/interface.js +5 -0
  415. package/lib/locale/am_ET.d.ts +3 -0
  416. package/lib/locale/am_ET.js +37 -0
  417. package/lib/locale/ar_EG.d.ts +3 -0
  418. package/lib/locale/ar_EG.js +40 -0
  419. package/lib/locale/az_AZ.d.ts +3 -0
  420. package/lib/locale/az_AZ.js +41 -0
  421. package/lib/locale/bg_BG.d.ts +3 -0
  422. package/lib/locale/bg_BG.js +40 -0
  423. package/lib/locale/bn_BD.d.ts +3 -0
  424. package/lib/locale/bn_BD.js +41 -0
  425. package/lib/locale/by_BY.d.ts +3 -0
  426. package/lib/locale/by_BY.js +41 -0
  427. package/lib/locale/ca_ES.d.ts +3 -0
  428. package/lib/locale/ca_ES.js +40 -0
  429. package/lib/locale/common.d.ts +2 -0
  430. package/lib/locale/common.js +12 -0
  431. package/lib/locale/cs_CZ.d.ts +3 -0
  432. package/lib/locale/cs_CZ.js +40 -0
  433. package/lib/locale/da_DK.d.ts +3 -0
  434. package/lib/locale/da_DK.js +40 -0
  435. package/lib/locale/de_DE.d.ts +3 -0
  436. package/lib/locale/de_DE.js +40 -0
  437. package/lib/locale/el_GR.d.ts +3 -0
  438. package/lib/locale/el_GR.js +40 -0
  439. package/lib/locale/en_GB.d.ts +3 -0
  440. package/lib/locale/en_GB.js +40 -0
  441. package/lib/locale/en_US.d.ts +3 -0
  442. package/lib/locale/en_US.js +41 -0
  443. package/lib/locale/es_ES.d.ts +3 -0
  444. package/lib/locale/es_ES.js +40 -0
  445. package/lib/locale/es_MX.d.ts +3 -0
  446. package/lib/locale/es_MX.js +41 -0
  447. package/lib/locale/et_EE.d.ts +3 -0
  448. package/lib/locale/et_EE.js +40 -0
  449. package/lib/locale/eu_ES.d.ts +3 -0
  450. package/lib/locale/eu_ES.js +42 -0
  451. package/lib/locale/fa_IR.d.ts +3 -0
  452. package/lib/locale/fa_IR.js +40 -0
  453. package/lib/locale/fi_FI.d.ts +3 -0
  454. package/lib/locale/fi_FI.js +40 -0
  455. package/lib/locale/fr_BE.d.ts +3 -0
  456. package/lib/locale/fr_BE.js +40 -0
  457. package/lib/locale/fr_CA.d.ts +3 -0
  458. package/lib/locale/fr_CA.js +41 -0
  459. package/lib/locale/fr_FR.d.ts +3 -0
  460. package/lib/locale/fr_FR.js +41 -0
  461. package/lib/locale/ga_IE.d.ts +3 -0
  462. package/lib/locale/ga_IE.js +41 -0
  463. package/lib/locale/gl_ES.d.ts +3 -0
  464. package/lib/locale/gl_ES.js +40 -0
  465. package/lib/locale/he_IL.d.ts +3 -0
  466. package/lib/locale/he_IL.js +41 -0
  467. package/lib/locale/hi_IN.d.ts +3 -0
  468. package/lib/locale/hi_IN.js +41 -0
  469. package/lib/locale/hr_HR.d.ts +3 -0
  470. package/lib/locale/hr_HR.js +41 -0
  471. package/lib/locale/hu_HU.d.ts +3 -0
  472. package/lib/locale/hu_HU.js +64 -0
  473. package/lib/locale/id_ID.d.ts +3 -0
  474. package/lib/locale/id_ID.js +41 -0
  475. package/lib/locale/is_IS.d.ts +3 -0
  476. package/lib/locale/is_IS.js +40 -0
  477. package/lib/locale/it_IT.d.ts +3 -0
  478. package/lib/locale/it_IT.js +40 -0
  479. package/lib/locale/ja_JP.d.ts +3 -0
  480. package/lib/locale/ja_JP.js +43 -0
  481. package/lib/locale/ka_GE.d.ts +3 -0
  482. package/lib/locale/ka_GE.js +41 -0
  483. package/lib/locale/kk_KZ.d.ts +3 -0
  484. package/lib/locale/kk_KZ.js +40 -0
  485. package/lib/locale/km_KH.d.ts +3 -0
  486. package/lib/locale/km_KH.js +42 -0
  487. package/lib/locale/kmr_IQ.d.ts +3 -0
  488. package/lib/locale/kmr_IQ.js +40 -0
  489. package/lib/locale/kn_IN.d.ts +3 -0
  490. package/lib/locale/kn_IN.js +41 -0
  491. package/lib/locale/ko_KR.d.ts +3 -0
  492. package/lib/locale/ko_KR.js +42 -0
  493. package/lib/locale/lt_LT.d.ts +3 -0
  494. package/lib/locale/lt_LT.js +42 -0
  495. package/lib/locale/lv_LV.d.ts +3 -0
  496. package/lib/locale/lv_LV.js +40 -0
  497. package/lib/locale/mk_MK.d.ts +3 -0
  498. package/lib/locale/mk_MK.js +40 -0
  499. package/lib/locale/ml_IN.d.ts +3 -0
  500. package/lib/locale/ml_IN.js +41 -0
  501. package/lib/locale/mn_MN.d.ts +3 -0
  502. package/lib/locale/mn_MN.js +42 -0
  503. package/lib/locale/ms_MY.d.ts +3 -0
  504. package/lib/locale/ms_MY.js +42 -0
  505. package/lib/locale/my_MM.d.ts +3 -0
  506. package/lib/locale/my_MM.js +41 -0
  507. package/lib/locale/nb_NO.d.ts +3 -0
  508. package/lib/locale/nb_NO.js +42 -0
  509. package/lib/locale/ne_NP.d.ts +3 -0
  510. package/lib/locale/ne_NP.js +41 -0
  511. package/lib/locale/nl_BE.d.ts +3 -0
  512. package/lib/locale/nl_BE.js +40 -0
  513. package/lib/locale/nl_NL.d.ts +3 -0
  514. package/lib/locale/nl_NL.js +40 -0
  515. package/lib/locale/pl_PL.d.ts +3 -0
  516. package/lib/locale/pl_PL.js +40 -0
  517. package/lib/locale/pt_BR.d.ts +3 -0
  518. package/lib/locale/pt_BR.js +43 -0
  519. package/lib/locale/pt_PT.d.ts +3 -0
  520. package/lib/locale/pt_PT.js +42 -0
  521. package/lib/locale/ro_RO.d.ts +3 -0
  522. package/lib/locale/ro_RO.js +41 -0
  523. package/lib/locale/ru_RU.d.ts +3 -0
  524. package/lib/locale/ru_RU.js +40 -0
  525. package/lib/locale/si_LK.d.ts +3 -0
  526. package/lib/locale/si_LK.js +42 -0
  527. package/lib/locale/sk_SK.d.ts +3 -0
  528. package/lib/locale/sk_SK.js +40 -0
  529. package/lib/locale/sl_SI.d.ts +3 -0
  530. package/lib/locale/sl_SI.js +40 -0
  531. package/lib/locale/sr_Cyrl_RS.d.ts +3 -0
  532. package/lib/locale/sr_Cyrl_RS.js +40 -0
  533. package/lib/locale/sr_RS.d.ts +3 -0
  534. package/lib/locale/sr_RS.js +40 -0
  535. package/lib/locale/sv_SE.d.ts +3 -0
  536. package/lib/locale/sv_SE.js +40 -0
  537. package/lib/locale/ta_IN.d.ts +3 -0
  538. package/lib/locale/ta_IN.js +41 -0
  539. package/lib/locale/th_TH.d.ts +3 -0
  540. package/lib/locale/th_TH.js +40 -0
  541. package/lib/locale/tk_TK.d.ts +3 -0
  542. package/lib/locale/tk_TK.js +40 -0
  543. package/lib/locale/tr_TR.d.ts +3 -0
  544. package/lib/locale/tr_TR.js +42 -0
  545. package/lib/locale/ug_CN.d.ts +3 -0
  546. package/lib/locale/ug_CN.js +43 -0
  547. package/lib/locale/uk_UA.d.ts +3 -0
  548. package/lib/locale/uk_UA.js +40 -0
  549. package/lib/locale/ur_PK.d.ts +3 -0
  550. package/lib/locale/ur_PK.js +41 -0
  551. package/lib/locale/uz_UZ.d.ts +3 -0
  552. package/lib/locale/uz_UZ.js +41 -0
  553. package/lib/locale/vi_VN.d.ts +3 -0
  554. package/lib/locale/vi_VN.js +41 -0
  555. package/lib/locale/zh_CN.d.ts +3 -0
  556. package/lib/locale/zh_CN.js +42 -0
  557. package/lib/locale/zh_TW.d.ts +3 -0
  558. package/lib/locale/zh_TW.js +44 -0
  559. package/lib/utils/dateUtil.d.ts +29 -0
  560. package/lib/utils/dateUtil.js +161 -0
  561. package/lib/utils/getClearIcon.d.ts +5 -0
  562. package/lib/utils/getClearIcon.js +15 -0
  563. package/lib/utils/miscUtil.d.ts +14 -0
  564. package/lib/utils/miscUtil.js +81 -0
  565. package/lib/utils/uiUtil.d.ts +1 -0
  566. package/lib/utils/uiUtil.js +13 -0
  567. package/lib/utils/warnUtil.d.ts +5 -0
  568. package/lib/utils/warnUtil.js +17 -0
  569. package/package.json +107 -0
@@ -0,0 +1,641 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
11
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
12
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
15
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
16
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
17
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
+ import { useEvent, useMergedState } from '@rc-component/util';
19
+ import useLayoutEffect from "@rc-component/util/es/hooks/useLayoutEffect";
20
+ import omit from "@rc-component/util/es/omit";
21
+ import pickAttrs from "@rc-component/util/es/pickAttrs";
22
+ import warning from "@rc-component/util/es/warning";
23
+ import * as React from 'react';
24
+ import PickerTrigger from "../PickerTrigger";
25
+ import { pickTriggerProps } from "../PickerTrigger/util";
26
+ import { fillIndex, getFromDate, toArray } from "../utils/miscUtil";
27
+ import PickerContext from "./context";
28
+ import useCellRender from "./hooks/useCellRender";
29
+ import useFieldsInvalidate from "./hooks/useFieldsInvalidate";
30
+ import useFilledProps from "./hooks/useFilledProps";
31
+ import useOpen from "./hooks/useOpen";
32
+ import usePickerRef from "./hooks/usePickerRef";
33
+ import usePresets from "./hooks/usePresets";
34
+ import useRangeActive from "./hooks/useRangeActive";
35
+ import useRangeDisabledDate from "./hooks/useRangeDisabledDate";
36
+ import useRangePickerValue from "./hooks/useRangePickerValue";
37
+ import useRangeValue, { useInnerValue } from "./hooks/useRangeValue";
38
+ import useShowNow from "./hooks/useShowNow";
39
+ import Popup from "./Popup";
40
+ import RangeSelector from "./Selector/RangeSelector";
41
+ function separateConfig(config, defaultConfig) {
42
+ var singleConfig = config !== null && config !== void 0 ? config : defaultConfig;
43
+ if (Array.isArray(singleConfig)) {
44
+ return singleConfig;
45
+ }
46
+ return [singleConfig, singleConfig];
47
+ }
48
+
49
+ /** Used for change event, it should always be not undefined */
50
+
51
+ function getActiveRange(activeIndex) {
52
+ return activeIndex === 1 ? 'end' : 'start';
53
+ }
54
+ function RangePicker(props, ref) {
55
+ // ========================= Prop =========================
56
+ var _useFilledProps = useFilledProps(props, function () {
57
+ var disabled = props.disabled,
58
+ allowEmpty = props.allowEmpty;
59
+ var mergedDisabled = separateConfig(disabled, false);
60
+ var mergedAllowEmpty = separateConfig(allowEmpty, false);
61
+ return {
62
+ disabled: mergedDisabled,
63
+ allowEmpty: mergedAllowEmpty
64
+ };
65
+ }),
66
+ _useFilledProps2 = _slicedToArray(_useFilledProps, 6),
67
+ filledProps = _useFilledProps2[0],
68
+ internalPicker = _useFilledProps2[1],
69
+ complexPicker = _useFilledProps2[2],
70
+ formatList = _useFilledProps2[3],
71
+ maskFormat = _useFilledProps2[4],
72
+ isInvalidateDate = _useFilledProps2[5];
73
+ var prefixCls = filledProps.prefixCls,
74
+ styles = filledProps.styles,
75
+ classNames = filledProps.classNames,
76
+ defaultValue = filledProps.defaultValue,
77
+ value = filledProps.value,
78
+ needConfirm = filledProps.needConfirm,
79
+ onKeyDown = filledProps.onKeyDown,
80
+ disabled = filledProps.disabled,
81
+ allowEmpty = filledProps.allowEmpty,
82
+ disabledDate = filledProps.disabledDate,
83
+ minDate = filledProps.minDate,
84
+ maxDate = filledProps.maxDate,
85
+ defaultOpen = filledProps.defaultOpen,
86
+ open = filledProps.open,
87
+ onOpenChange = filledProps.onOpenChange,
88
+ locale = filledProps.locale,
89
+ generateConfig = filledProps.generateConfig,
90
+ picker = filledProps.picker,
91
+ showNow = filledProps.showNow,
92
+ showToday = filledProps.showToday,
93
+ showTime = filledProps.showTime,
94
+ mode = filledProps.mode,
95
+ onPanelChange = filledProps.onPanelChange,
96
+ onCalendarChange = filledProps.onCalendarChange,
97
+ onOk = filledProps.onOk,
98
+ defaultPickerValue = filledProps.defaultPickerValue,
99
+ pickerValue = filledProps.pickerValue,
100
+ onPickerValueChange = filledProps.onPickerValueChange,
101
+ inputReadOnly = filledProps.inputReadOnly,
102
+ suffixIcon = filledProps.suffixIcon,
103
+ onFocus = filledProps.onFocus,
104
+ onBlur = filledProps.onBlur,
105
+ presets = filledProps.presets,
106
+ ranges = filledProps.ranges,
107
+ components = filledProps.components,
108
+ cellRender = filledProps.cellRender,
109
+ dateRender = filledProps.dateRender,
110
+ monthCellRender = filledProps.monthCellRender,
111
+ onClick = filledProps.onClick;
112
+
113
+ // ========================= Refs =========================
114
+ var selectorRef = usePickerRef(ref);
115
+
116
+ // ========================= Open =========================
117
+ var _useOpen = useOpen(open, defaultOpen, disabled, onOpenChange),
118
+ _useOpen2 = _slicedToArray(_useOpen, 2),
119
+ mergedOpen = _useOpen2[0],
120
+ setMergeOpen = _useOpen2[1];
121
+ var triggerOpen = function triggerOpen(nextOpen, config) {
122
+ // No need to open if all disabled
123
+ if (disabled.some(function (fieldDisabled) {
124
+ return !fieldDisabled;
125
+ }) || !nextOpen) {
126
+ setMergeOpen(nextOpen, config);
127
+ }
128
+ };
129
+
130
+ // ======================== Values ========================
131
+ var _useInnerValue = useInnerValue(generateConfig, locale, formatList, true, false, defaultValue, value, onCalendarChange, onOk),
132
+ _useInnerValue2 = _slicedToArray(_useInnerValue, 5),
133
+ mergedValue = _useInnerValue2[0],
134
+ setInnerValue = _useInnerValue2[1],
135
+ getCalendarValue = _useInnerValue2[2],
136
+ triggerCalendarChange = _useInnerValue2[3],
137
+ triggerOk = _useInnerValue2[4];
138
+ var calendarValue = getCalendarValue();
139
+
140
+ // ======================== Active ========================
141
+ var _useRangeActive = useRangeActive(disabled, allowEmpty, mergedOpen),
142
+ _useRangeActive2 = _slicedToArray(_useRangeActive, 9),
143
+ focused = _useRangeActive2[0],
144
+ triggerFocus = _useRangeActive2[1],
145
+ lastOperation = _useRangeActive2[2],
146
+ activeIndex = _useRangeActive2[3],
147
+ setActiveIndex = _useRangeActive2[4],
148
+ nextActiveIndex = _useRangeActive2[5],
149
+ activeIndexList = _useRangeActive2[6],
150
+ updateSubmitIndex = _useRangeActive2[7],
151
+ hasActiveSubmitValue = _useRangeActive2[8];
152
+ var onSharedFocus = function onSharedFocus(event, index) {
153
+ triggerFocus(true);
154
+ onFocus === null || onFocus === void 0 || onFocus(event, {
155
+ range: getActiveRange(index !== null && index !== void 0 ? index : activeIndex)
156
+ });
157
+ };
158
+ var onSharedBlur = function onSharedBlur(event, index) {
159
+ triggerFocus(false);
160
+ onBlur === null || onBlur === void 0 || onBlur(event, {
161
+ range: getActiveRange(index !== null && index !== void 0 ? index : activeIndex)
162
+ });
163
+ };
164
+
165
+ // ======================= ShowTime =======================
166
+ /** Used for Popup panel */
167
+ var mergedShowTime = React.useMemo(function () {
168
+ if (!showTime) {
169
+ return null;
170
+ }
171
+ var disabledTime = showTime.disabledTime;
172
+ var proxyDisabledTime = disabledTime ? function (date) {
173
+ var range = getActiveRange(activeIndex);
174
+ var fromDate = getFromDate(calendarValue, activeIndexList, activeIndex);
175
+ return disabledTime(date, range, {
176
+ from: fromDate
177
+ });
178
+ } : undefined;
179
+ return _objectSpread(_objectSpread({}, showTime), {}, {
180
+ disabledTime: proxyDisabledTime
181
+ });
182
+ }, [showTime, activeIndex, calendarValue, activeIndexList]);
183
+
184
+ // ========================= Mode =========================
185
+ var _useMergedState = useMergedState([picker, picker], {
186
+ value: mode
187
+ }),
188
+ _useMergedState2 = _slicedToArray(_useMergedState, 2),
189
+ modes = _useMergedState2[0],
190
+ setModes = _useMergedState2[1];
191
+ var mergedMode = modes[activeIndex] || picker;
192
+
193
+ /** Extends from `mergedMode` to patch `datetime` mode */
194
+ var internalMode = mergedMode === 'date' && mergedShowTime ? 'datetime' : mergedMode;
195
+
196
+ // ====================== PanelCount ======================
197
+ var multiplePanel = internalMode === picker && internalMode !== 'time';
198
+
199
+ // ======================= Show Now =======================
200
+ var mergedShowNow = useShowNow(picker, mergedMode, showNow, showToday, true);
201
+
202
+ // ======================== Value =========================
203
+ var _useRangeValue = useRangeValue(filledProps, mergedValue, setInnerValue, getCalendarValue, triggerCalendarChange, disabled, formatList, focused, mergedOpen, isInvalidateDate),
204
+ _useRangeValue2 = _slicedToArray(_useRangeValue, 2),
205
+ /** Trigger `onChange` by check `disabledDate` */
206
+ flushSubmit = _useRangeValue2[0],
207
+ /** Trigger `onChange` directly without check `disabledDate` */
208
+ triggerSubmitChange = _useRangeValue2[1];
209
+
210
+ // ===================== DisabledDate =====================
211
+ var mergedDisabledDate = useRangeDisabledDate(calendarValue, disabled, activeIndexList, generateConfig, locale, disabledDate);
212
+
213
+ // ======================= Validate =======================
214
+ var _useFieldsInvalidate = useFieldsInvalidate(calendarValue, isInvalidateDate, allowEmpty),
215
+ _useFieldsInvalidate2 = _slicedToArray(_useFieldsInvalidate, 2),
216
+ submitInvalidates = _useFieldsInvalidate2[0],
217
+ onSelectorInvalid = _useFieldsInvalidate2[1];
218
+
219
+ // ===================== Picker Value =====================
220
+ var _useRangePickerValue = useRangePickerValue(generateConfig, locale, calendarValue, modes, mergedOpen, activeIndex, internalPicker, multiplePanel, defaultPickerValue, pickerValue, mergedShowTime === null || mergedShowTime === void 0 ? void 0 : mergedShowTime.defaultOpenValue, onPickerValueChange, minDate, maxDate),
221
+ _useRangePickerValue2 = _slicedToArray(_useRangePickerValue, 2),
222
+ currentPickerValue = _useRangePickerValue2[0],
223
+ setCurrentPickerValue = _useRangePickerValue2[1];
224
+
225
+ // >>> Mode need wait for `pickerValue`
226
+ var triggerModeChange = useEvent(function (nextPickerValue, nextMode, triggerEvent) {
227
+ var clone = fillIndex(modes, activeIndex, nextMode);
228
+ if (clone[0] !== modes[0] || clone[1] !== modes[1]) {
229
+ setModes(clone);
230
+ }
231
+
232
+ // Compatible with `onPanelChange`
233
+ if (onPanelChange && triggerEvent !== false) {
234
+ var clonePickerValue = _toConsumableArray(calendarValue);
235
+ if (nextPickerValue) {
236
+ clonePickerValue[activeIndex] = nextPickerValue;
237
+ }
238
+ onPanelChange(clonePickerValue, clone);
239
+ }
240
+ });
241
+
242
+ // ======================== Change ========================
243
+ var fillCalendarValue = function fillCalendarValue(date, index) {
244
+ return (
245
+ // Trigger change only when date changed
246
+ fillIndex(calendarValue, index, date)
247
+ );
248
+ };
249
+
250
+ // ======================== Submit ========================
251
+ /**
252
+ * Trigger by confirm operation.
253
+ * This function has already handle the `needConfirm` check logic.
254
+ * - Selector: enter key
255
+ * - Panel: OK button
256
+ */
257
+ var triggerPartConfirm = function triggerPartConfirm(date, skipFocus) {
258
+ var nextValue = calendarValue;
259
+ if (date) {
260
+ nextValue = fillCalendarValue(date, activeIndex);
261
+ }
262
+ updateSubmitIndex(activeIndex);
263
+ // Get next focus index
264
+ var nextIndex = nextActiveIndex(nextValue);
265
+
266
+ // Change calendar value and tell flush it
267
+ triggerCalendarChange(nextValue);
268
+ flushSubmit(activeIndex, nextIndex === null);
269
+ if (nextIndex === null) {
270
+ triggerOpen(false, {
271
+ force: true
272
+ });
273
+ } else if (!skipFocus) {
274
+ selectorRef.current.focus({
275
+ index: nextIndex
276
+ });
277
+ }
278
+ };
279
+
280
+ // ======================== Click =========================
281
+ var onSelectorClick = function onSelectorClick(event) {
282
+ var _activeElement;
283
+ var rootNode = event.target.getRootNode();
284
+ if (!selectorRef.current.nativeElement.contains((_activeElement = rootNode.activeElement) !== null && _activeElement !== void 0 ? _activeElement : document.activeElement)) {
285
+ // Click to focus the enabled input
286
+ var enabledIndex = disabled.findIndex(function (d) {
287
+ return !d;
288
+ });
289
+ if (enabledIndex >= 0) {
290
+ selectorRef.current.focus({
291
+ index: enabledIndex
292
+ });
293
+ }
294
+ }
295
+ triggerOpen(true);
296
+ onClick === null || onClick === void 0 || onClick(event);
297
+ };
298
+ var onSelectorClear = function onSelectorClear() {
299
+ triggerSubmitChange(null);
300
+ triggerOpen(false, {
301
+ force: true
302
+ });
303
+ };
304
+
305
+ // ======================== Hover =========================
306
+ var _React$useState = React.useState(null),
307
+ _React$useState2 = _slicedToArray(_React$useState, 2),
308
+ hoverSource = _React$useState2[0],
309
+ setHoverSource = _React$useState2[1];
310
+ var _React$useState3 = React.useState(null),
311
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
312
+ internalHoverValues = _React$useState4[0],
313
+ setInternalHoverValues = _React$useState4[1];
314
+ var hoverValues = React.useMemo(function () {
315
+ return internalHoverValues || calendarValue;
316
+ }, [calendarValue, internalHoverValues]);
317
+
318
+ // Clean up `internalHoverValues` when closed
319
+ React.useEffect(function () {
320
+ if (!mergedOpen) {
321
+ setInternalHoverValues(null);
322
+ }
323
+ }, [mergedOpen]);
324
+
325
+ // ========================================================
326
+ // == Panels ==
327
+ // ========================================================
328
+ // Save the offset with active bar position
329
+ // const [activeOffset, setActiveOffset] = React.useState(0);
330
+ var _React$useState5 = React.useState([0, 0, 0]),
331
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
332
+ activeInfo = _React$useState6[0],
333
+ setActiveInfo = _React$useState6[1];
334
+
335
+ // ======================= Presets ========================
336
+ var presetList = usePresets(presets, ranges);
337
+ var onPresetHover = function onPresetHover(nextValues) {
338
+ setInternalHoverValues(nextValues);
339
+ setHoverSource('preset');
340
+ };
341
+ var onPresetSubmit = function onPresetSubmit(nextValues) {
342
+ var passed = triggerSubmitChange(nextValues);
343
+ if (passed) {
344
+ triggerOpen(false, {
345
+ force: true
346
+ });
347
+ }
348
+ };
349
+ var onNow = function onNow(now) {
350
+ triggerPartConfirm(now);
351
+ };
352
+
353
+ // ======================== Panel =========================
354
+ var onPanelHover = function onPanelHover(date) {
355
+ setInternalHoverValues(date ? fillCalendarValue(date, activeIndex) : null);
356
+ setHoverSource('cell');
357
+ };
358
+
359
+ // >>> Focus
360
+ var onPanelFocus = function onPanelFocus(event) {
361
+ triggerOpen(true);
362
+ onSharedFocus(event);
363
+ };
364
+
365
+ // >>> MouseDown
366
+ var onPanelMouseDown = function onPanelMouseDown() {
367
+ lastOperation('panel');
368
+ };
369
+
370
+ // >>> Calendar
371
+ var onPanelSelect = function onPanelSelect(date) {
372
+ var clone = fillIndex(calendarValue, activeIndex, date);
373
+
374
+ // Only trigger calendar event but not update internal `calendarValue` state
375
+ triggerCalendarChange(clone);
376
+
377
+ // >>> Trigger next active if !needConfirm
378
+ // Fully logic check `useRangeValue` hook
379
+ if (!needConfirm && !complexPicker && internalPicker === internalMode) {
380
+ triggerPartConfirm(date);
381
+ }
382
+ };
383
+
384
+ // >>> Close
385
+ var onPopupClose = function onPopupClose() {
386
+ // Close popup
387
+ triggerOpen(false);
388
+ };
389
+
390
+ // >>> cellRender
391
+ var onInternalCellRender = useCellRender(cellRender, dateRender, monthCellRender, getActiveRange(activeIndex));
392
+
393
+ // >>> Value
394
+ var panelValue = calendarValue[activeIndex] || null;
395
+
396
+ // >>> invalid
397
+ var isPopupInvalidateDate = useEvent(function (date) {
398
+ return isInvalidateDate(date, {
399
+ activeIndex: activeIndex
400
+ });
401
+ });
402
+ var panelProps = React.useMemo(function () {
403
+ var domProps = pickAttrs(filledProps, false);
404
+ var restProps = omit(filledProps, [].concat(_toConsumableArray(Object.keys(domProps)), ['onChange', 'onCalendarChange', 'style', 'className', 'onPanelChange', 'disabledTime']));
405
+ return restProps;
406
+ }, [filledProps]);
407
+
408
+ // >>> Render
409
+ var panel = /*#__PURE__*/React.createElement(Popup, _extends({}, panelProps, {
410
+ showNow: mergedShowNow,
411
+ showTime: mergedShowTime
412
+ // Range
413
+ ,
414
+ range: true,
415
+ multiplePanel: multiplePanel,
416
+ activeInfo: activeInfo
417
+ // Disabled
418
+ ,
419
+ disabledDate: mergedDisabledDate
420
+ // Focus
421
+ ,
422
+ onFocus: onPanelFocus,
423
+ onBlur: onSharedBlur,
424
+ onPanelMouseDown: onPanelMouseDown
425
+ // Mode
426
+ ,
427
+ picker: picker,
428
+ mode: mergedMode,
429
+ internalMode: internalMode,
430
+ onPanelChange: triggerModeChange
431
+ // Value
432
+ ,
433
+ format: maskFormat,
434
+ value: panelValue,
435
+ isInvalid: isPopupInvalidateDate,
436
+ onChange: null,
437
+ onSelect: onPanelSelect
438
+ // PickerValue
439
+ ,
440
+ pickerValue: currentPickerValue,
441
+ defaultOpenValue: toArray(showTime === null || showTime === void 0 ? void 0 : showTime.defaultOpenValue)[activeIndex],
442
+ onPickerValueChange: setCurrentPickerValue
443
+ // Hover
444
+ ,
445
+ hoverValue: hoverValues,
446
+ onHover: onPanelHover
447
+ // Submit
448
+ ,
449
+ needConfirm: needConfirm,
450
+ onSubmit: triggerPartConfirm,
451
+ onOk: triggerOk
452
+ // Preset
453
+ ,
454
+ presets: presetList,
455
+ onPresetHover: onPresetHover,
456
+ onPresetSubmit: onPresetSubmit
457
+ // Now
458
+ ,
459
+ onNow: onNow
460
+ // Render
461
+ ,
462
+ cellRender: onInternalCellRender
463
+ }));
464
+
465
+ // ========================================================
466
+ // == Selector ==
467
+ // ========================================================
468
+
469
+ // ======================== Change ========================
470
+ var onSelectorChange = function onSelectorChange(date, index) {
471
+ var clone = fillCalendarValue(date, index);
472
+ triggerCalendarChange(clone);
473
+ };
474
+ var onSelectorInputChange = function onSelectorInputChange() {
475
+ lastOperation('input');
476
+ };
477
+
478
+ // ======================= Selector =======================
479
+ var onSelectorFocus = function onSelectorFocus(event, index) {
480
+ // Check if `needConfirm` but user not submit yet
481
+ var activeListLen = activeIndexList.length;
482
+ var lastActiveIndex = activeIndexList[activeListLen - 1];
483
+ if (activeListLen && lastActiveIndex !== index && needConfirm &&
484
+ // Not change index if is not filled
485
+ !allowEmpty[lastActiveIndex] && !hasActiveSubmitValue(lastActiveIndex) && calendarValue[lastActiveIndex]) {
486
+ selectorRef.current.focus({
487
+ index: lastActiveIndex
488
+ });
489
+ return;
490
+ }
491
+ lastOperation('input');
492
+ triggerOpen(true, {
493
+ inherit: true
494
+ });
495
+
496
+ // When click input to switch the field, it will not trigger close.
497
+ // Which means it will lose the part confirm and we need fill back.
498
+ // ref: https://github.com/ant-design/ant-design/issues/49512
499
+ if (activeIndex !== index && mergedOpen && !needConfirm && complexPicker) {
500
+ triggerPartConfirm(null, true);
501
+ }
502
+ setActiveIndex(index);
503
+ onSharedFocus(event, index);
504
+ };
505
+ var onSelectorBlur = function onSelectorBlur(event, index) {
506
+ triggerOpen(false);
507
+ if (!needConfirm && lastOperation() === 'input') {
508
+ var nextIndex = nextActiveIndex(calendarValue);
509
+ flushSubmit(activeIndex, nextIndex === null);
510
+ }
511
+ onSharedBlur(event, index);
512
+ };
513
+ var onSelectorKeyDown = function onSelectorKeyDown(event, preventDefault) {
514
+ if (event.key === 'Tab') {
515
+ triggerPartConfirm(null, true);
516
+ }
517
+ onKeyDown === null || onKeyDown === void 0 || onKeyDown(event, preventDefault);
518
+ };
519
+
520
+ // ======================= Context ========================
521
+ var context = React.useMemo(function () {
522
+ return {
523
+ prefixCls: prefixCls,
524
+ locale: locale,
525
+ generateConfig: generateConfig,
526
+ button: components.button,
527
+ input: components.input
528
+ };
529
+ }, [prefixCls, locale, generateConfig, components.button, components.input]);
530
+
531
+ // ======================== Effect ========================
532
+ // >>> Mode
533
+ // Reset for every active
534
+ useLayoutEffect(function () {
535
+ if (mergedOpen && activeIndex !== undefined) {
536
+ // Legacy compatible. This effect update should not trigger `onPanelChange`
537
+ triggerModeChange(null, picker, false);
538
+ }
539
+ }, [mergedOpen, activeIndex, picker]);
540
+
541
+ // >>> For complex picker, we need check if need to focus next one
542
+ useLayoutEffect(function () {
543
+ var lastOp = lastOperation();
544
+
545
+ // Trade as confirm on field leave
546
+ if (!mergedOpen && lastOp === 'input') {
547
+ triggerOpen(false);
548
+ triggerPartConfirm(null, true);
549
+ }
550
+
551
+ // Submit with complex picker
552
+ if (!mergedOpen && complexPicker && !needConfirm && lastOp === 'panel') {
553
+ triggerOpen(true);
554
+ triggerPartConfirm();
555
+ }
556
+ }, [mergedOpen]);
557
+
558
+ // ====================== DevWarning ======================
559
+ if (process.env.NODE_ENV !== 'production') {
560
+ var isIndexEmpty = function isIndexEmpty(index) {
561
+ return (
562
+ // Value is empty
563
+ !(value !== null && value !== void 0 && value[index]) &&
564
+ // DefaultValue is empty
565
+ !(defaultValue !== null && defaultValue !== void 0 && defaultValue[index])
566
+ );
567
+ };
568
+ if (disabled.some(function (fieldDisabled, index) {
569
+ return fieldDisabled && isIndexEmpty(index) && !allowEmpty[index];
570
+ })) {
571
+ warning(false, '`disabled` should not set with empty `value`. You should set `allowEmpty` or `value` instead.');
572
+ }
573
+ }
574
+
575
+ // ======================== Render ========================
576
+ return /*#__PURE__*/React.createElement(PickerContext.Provider, {
577
+ value: context
578
+ }, /*#__PURE__*/React.createElement(PickerTrigger, _extends({}, pickTriggerProps(filledProps), {
579
+ popupElement: panel,
580
+ popupStyle: styles.popup,
581
+ popupClassName: classNames.popup
582
+ // Visible
583
+ ,
584
+ visible: mergedOpen,
585
+ onClose: onPopupClose
586
+ // Range
587
+ ,
588
+ range: true
589
+ }), /*#__PURE__*/React.createElement(RangeSelector
590
+ // Shared
591
+ , _extends({}, filledProps, {
592
+ // Ref
593
+ ref: selectorRef
594
+ // Icon
595
+ ,
596
+ suffixIcon: suffixIcon
597
+ // Active
598
+ ,
599
+ activeIndex: focused || mergedOpen ? activeIndex : null,
600
+ activeHelp: !!internalHoverValues,
601
+ allHelp: !!internalHoverValues && hoverSource === 'preset',
602
+ focused: focused,
603
+ onFocus: onSelectorFocus,
604
+ onBlur: onSelectorBlur,
605
+ onKeyDown: onSelectorKeyDown,
606
+ onSubmit: triggerPartConfirm
607
+ // Change
608
+ ,
609
+ value: hoverValues,
610
+ maskFormat: maskFormat,
611
+ onChange: onSelectorChange,
612
+ onInputChange: onSelectorInputChange
613
+ // Format
614
+ ,
615
+ format: formatList,
616
+ inputReadOnly: inputReadOnly
617
+ // Disabled
618
+ ,
619
+ disabled: disabled
620
+ // Open
621
+ ,
622
+ open: mergedOpen,
623
+ onOpenChange: triggerOpen
624
+ // Click
625
+ ,
626
+ onClick: onSelectorClick,
627
+ onClear: onSelectorClear
628
+ // Invalid
629
+ ,
630
+ invalid: submitInvalidates,
631
+ onInvalid: onSelectorInvalid
632
+ // Offset
633
+ ,
634
+ onActiveInfo: setActiveInfo
635
+ }))));
636
+ }
637
+ var RefRangePicker = /*#__PURE__*/React.forwardRef(RangePicker);
638
+ if (process.env.NODE_ENV !== 'production') {
639
+ RefRangePicker.displayName = 'RefRangePicker';
640
+ }
641
+ export default RefRangePicker;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ export interface IconProps extends React.HtmlHTMLAttributes<HTMLElement> {
3
+ icon?: React.ReactNode;
4
+ type: 'suffix' | 'clear';
5
+ }
6
+ export default function Icon(props: IconProps): React.JSX.Element;
7
+ export interface ClearIconProps extends Omit<IconProps, 'type'> {
8
+ onClear: VoidFunction;
9
+ }
10
+ export declare function ClearIcon({ onClear, ...restProps }: ClearIconProps): React.JSX.Element;
@@ -0,0 +1,32 @@
1
+ var _excluded = ["icon", "type"],
2
+ _excluded2 = ["onClear"];
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
+ import * as React from 'react';
7
+ import PickerContext from "../context";
8
+ export default function Icon(props) {
9
+ var icon = props.icon,
10
+ type = props.type,
11
+ restProps = _objectWithoutProperties(props, _excluded);
12
+ var _React$useContext = React.useContext(PickerContext),
13
+ prefixCls = _React$useContext.prefixCls;
14
+ return icon ? /*#__PURE__*/React.createElement("span", _extends({
15
+ className: "".concat(prefixCls, "-").concat(type)
16
+ }, restProps), icon) : null;
17
+ }
18
+ export function ClearIcon(_ref) {
19
+ var onClear = _ref.onClear,
20
+ restProps = _objectWithoutProperties(_ref, _excluded2);
21
+ return /*#__PURE__*/React.createElement(Icon, _extends({}, restProps, {
22
+ type: "clear",
23
+ role: "button",
24
+ onMouseDown: function onMouseDown(e) {
25
+ e.preventDefault();
26
+ },
27
+ onClick: function onClick(e) {
28
+ e.stopPropagation();
29
+ onClear();
30
+ }
31
+ }));
32
+ }