@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.
- package/LICENSE.md +9 -0
- package/README.md +154 -0
- package/assets/index.css +407 -0
- package/assets/index.less +570 -0
- package/es/PickerInput/Popup/Footer.d.ts +19 -0
- package/es/PickerInput/Popup/Footer.js +78 -0
- package/es/PickerInput/Popup/PopupPanel.d.ts +10 -0
- package/es/PickerInput/Popup/PopupPanel.js +84 -0
- package/es/PickerInput/Popup/PresetPanel.d.ts +9 -0
- package/es/PickerInput/Popup/PresetPanel.js +31 -0
- package/es/PickerInput/Popup/index.d.ts +20 -0
- package/es/PickerInput/Popup/index.js +198 -0
- package/es/PickerInput/RangePicker.d.ts +54 -0
- package/es/PickerInput/RangePicker.js +641 -0
- package/es/PickerInput/Selector/Icon.d.ts +10 -0
- package/es/PickerInput/Selector/Icon.js +32 -0
- package/es/PickerInput/Selector/Input.d.ts +28 -0
- package/es/PickerInput/Selector/Input.js +377 -0
- package/es/PickerInput/Selector/MaskFormat.d.ts +22 -0
- package/es/PickerInput/Selector/MaskFormat.js +107 -0
- package/es/PickerInput/Selector/RangeSelector.d.ts +26 -0
- package/es/PickerInput/Selector/RangeSelector.js +218 -0
- package/es/PickerInput/Selector/SingleSelector/MultipleDates.d.ts +12 -0
- package/es/PickerInput/Selector/SingleSelector/MultipleDates.js +66 -0
- package/es/PickerInput/Selector/SingleSelector/index.d.ts +18 -0
- package/es/PickerInput/Selector/SingleSelector/index.js +187 -0
- package/es/PickerInput/Selector/hooks/useClearIcon.d.ts +8 -0
- package/es/PickerInput/Selector/hooks/useClearIcon.js +19 -0
- package/es/PickerInput/Selector/hooks/useInputProps.d.ts +16 -0
- package/es/PickerInput/Selector/hooks/useInputProps.js +178 -0
- package/es/PickerInput/Selector/hooks/useRootProps.d.ts +2 -0
- package/es/PickerInput/Selector/hooks/useRootProps.js +8 -0
- package/es/PickerInput/Selector/util.d.ts +1 -0
- package/es/PickerInput/Selector/util.js +12 -0
- package/es/PickerInput/SinglePicker.d.ts +51 -0
- package/es/PickerInput/SinglePicker.js +545 -0
- package/es/PickerInput/context.d.ts +13 -0
- package/es/PickerInput/context.js +3 -0
- package/es/PickerInput/hooks/useCellRender.d.ts +2 -0
- package/es/PickerInput/hooks/useCellRender.js +41 -0
- package/es/PickerInput/hooks/useDelayState.d.ts +5 -0
- package/es/PickerInput/hooks/useDelayState.js +48 -0
- package/es/PickerInput/hooks/useDisabledBoundary.d.ts +7 -0
- package/es/PickerInput/hooks/useDisabledBoundary.js +20 -0
- package/es/PickerInput/hooks/useFieldFormat.d.ts +2 -0
- package/es/PickerInput/hooks/useFieldFormat.js +18 -0
- package/es/PickerInput/hooks/useFieldsInvalidate.d.ts +5 -0
- package/es/PickerInput/hooks/useFieldsInvalidate.js +55 -0
- package/es/PickerInput/hooks/useFilledProps.d.ts +37 -0
- package/es/PickerInput/hooks/useFilledProps.js +155 -0
- package/es/PickerInput/hooks/useInputReadOnly.d.ts +2 -0
- package/es/PickerInput/hooks/useInputReadOnly.js +6 -0
- package/es/PickerInput/hooks/useInvalidate.d.ts +9 -0
- package/es/PickerInput/hooks/useInvalidate.js +61 -0
- package/es/PickerInput/hooks/useLockEffect.d.ts +5 -0
- package/es/PickerInput/hooks/useLockEffect.js +25 -0
- package/es/PickerInput/hooks/useOpen.d.ts +6 -0
- package/es/PickerInput/hooks/useOpen.js +33 -0
- package/es/PickerInput/hooks/usePickerRef.d.ts +7 -0
- package/es/PickerInput/hooks/usePickerRef.js +19 -0
- package/es/PickerInput/hooks/usePresets.d.ts +2 -0
- package/es/PickerInput/hooks/usePresets.js +28 -0
- package/es/PickerInput/hooks/useRangeActive.d.ts +19 -0
- package/es/PickerInput/hooks/useRangeActive.js +74 -0
- package/es/PickerInput/hooks/useRangeDisabledDate.d.ts +8 -0
- package/es/PickerInput/hooks/useRangeDisabledDate.js +53 -0
- package/es/PickerInput/hooks/useRangePickerValue.d.ts +5 -0
- package/es/PickerInput/hooks/useRangePickerValue.js +192 -0
- package/es/PickerInput/hooks/useRangeValue.d.ts +28 -0
- package/es/PickerInput/hooks/useRangeValue.js +297 -0
- package/es/PickerInput/hooks/useShowNow.d.ts +2 -0
- package/es/PickerInput/hooks/useShowNow.js +14 -0
- package/es/PickerPanel/DatePanel/index.d.ts +10 -0
- package/es/PickerPanel/DatePanel/index.js +190 -0
- package/es/PickerPanel/DateTimePanel/index.d.ts +3 -0
- package/es/PickerPanel/DateTimePanel/index.js +55 -0
- package/es/PickerPanel/DecadePanel/index.d.ts +3 -0
- package/es/PickerPanel/DecadePanel/index.js +113 -0
- package/es/PickerPanel/MonthPanel/index.d.ts +3 -0
- package/es/PickerPanel/MonthPanel/index.js +106 -0
- package/es/PickerPanel/PanelBody.d.ts +17 -0
- package/es/PickerPanel/PanelBody.js +153 -0
- package/es/PickerPanel/PanelHeader.d.ts +11 -0
- package/es/PickerPanel/PanelHeader.js +133 -0
- package/es/PickerPanel/QuarterPanel/index.d.ts +3 -0
- package/es/PickerPanel/QuarterPanel/index.js +92 -0
- package/es/PickerPanel/TimePanel/TimePanelBody/TimeColumn.d.ts +17 -0
- package/es/PickerPanel/TimePanel/TimePanelBody/TimeColumn.js +149 -0
- package/es/PickerPanel/TimePanel/TimePanelBody/index.d.ts +4 -0
- package/es/PickerPanel/TimePanel/TimePanelBody/index.js +283 -0
- package/es/PickerPanel/TimePanel/TimePanelBody/useScrollTo.d.ts +2 -0
- package/es/PickerPanel/TimePanel/TimePanelBody/useScrollTo.js +72 -0
- package/es/PickerPanel/TimePanel/TimePanelBody/util.d.ts +3 -0
- package/es/PickerPanel/TimePanel/TimePanelBody/util.js +43 -0
- package/es/PickerPanel/TimePanel/index.d.ts +4 -0
- package/es/PickerPanel/TimePanel/index.js +38 -0
- package/es/PickerPanel/WeekPanel/index.d.ts +3 -0
- package/es/PickerPanel/WeekPanel/index.js +55 -0
- package/es/PickerPanel/YearPanel/index.d.ts +3 -0
- package/es/PickerPanel/YearPanel/index.js +116 -0
- package/es/PickerPanel/context.d.ts +24 -0
- package/es/PickerPanel/context.js +67 -0
- package/es/PickerPanel/index.d.ts +60 -0
- package/es/PickerPanel/index.js +315 -0
- package/es/PickerTrigger/index.d.ts +19 -0
- package/es/PickerTrigger/index.js +86 -0
- package/es/PickerTrigger/util.d.ts +2 -0
- package/es/PickerTrigger/util.js +4 -0
- package/es/generate/dateFns.d.ts +3 -0
- package/es/generate/dateFns.js +163 -0
- package/es/generate/dayjs.d.ts +4 -0
- package/es/generate/dayjs.js +233 -0
- package/es/generate/index.d.ts +37 -0
- package/es/generate/index.js +1 -0
- package/es/generate/luxon.d.ts +4 -0
- package/es/generate/luxon.js +197 -0
- package/es/generate/moment.d.ts +4 -0
- package/es/generate/moment.js +152 -0
- package/es/hooks/useLocale.d.ts +6 -0
- package/es/hooks/useLocale.js +82 -0
- package/es/hooks/useSyncState.d.ts +6 -0
- package/es/hooks/useSyncState.js +27 -0
- package/es/hooks/useTimeConfig.d.ts +18 -0
- package/es/hooks/useTimeConfig.js +166 -0
- package/es/hooks/useTimeInfo.d.ts +12 -0
- package/es/hooks/useTimeInfo.js +164 -0
- package/es/hooks/useToggleDates.d.ts +8 -0
- package/es/hooks/useToggleDates.js +26 -0
- package/es/index.d.ts +35 -0
- package/es/index.js +34 -0
- package/es/interface.d.ts +365 -0
- package/es/interface.js +1 -0
- package/es/locale/am_ET.d.ts +3 -0
- package/es/locale/am_ET.js +31 -0
- package/es/locale/ar_EG.d.ts +3 -0
- package/es/locale/ar_EG.js +34 -0
- package/es/locale/az_AZ.d.ts +3 -0
- package/es/locale/az_AZ.js +35 -0
- package/es/locale/bg_BG.d.ts +3 -0
- package/es/locale/bg_BG.js +34 -0
- package/es/locale/bn_BD.d.ts +3 -0
- package/es/locale/bn_BD.js +35 -0
- package/es/locale/by_BY.d.ts +3 -0
- package/es/locale/by_BY.js +35 -0
- package/es/locale/ca_ES.d.ts +3 -0
- package/es/locale/ca_ES.js +34 -0
- package/es/locale/common.d.ts +2 -0
- package/es/locale/common.js +6 -0
- package/es/locale/cs_CZ.d.ts +3 -0
- package/es/locale/cs_CZ.js +34 -0
- package/es/locale/da_DK.d.ts +3 -0
- package/es/locale/da_DK.js +34 -0
- package/es/locale/de_DE.d.ts +3 -0
- package/es/locale/de_DE.js +34 -0
- package/es/locale/el_GR.d.ts +3 -0
- package/es/locale/el_GR.js +34 -0
- package/es/locale/en_GB.d.ts +3 -0
- package/es/locale/en_GB.js +34 -0
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/en_US.js +35 -0
- package/es/locale/es_ES.d.ts +3 -0
- package/es/locale/es_ES.js +34 -0
- package/es/locale/es_MX.d.ts +3 -0
- package/es/locale/es_MX.js +35 -0
- package/es/locale/et_EE.d.ts +3 -0
- package/es/locale/et_EE.js +34 -0
- package/es/locale/eu_ES.d.ts +3 -0
- package/es/locale/eu_ES.js +36 -0
- package/es/locale/fa_IR.d.ts +3 -0
- package/es/locale/fa_IR.js +34 -0
- package/es/locale/fi_FI.d.ts +3 -0
- package/es/locale/fi_FI.js +34 -0
- package/es/locale/fr_BE.d.ts +3 -0
- package/es/locale/fr_BE.js +34 -0
- package/es/locale/fr_CA.d.ts +3 -0
- package/es/locale/fr_CA.js +35 -0
- package/es/locale/fr_FR.d.ts +3 -0
- package/es/locale/fr_FR.js +35 -0
- package/es/locale/ga_IE.d.ts +3 -0
- package/es/locale/ga_IE.js +35 -0
- package/es/locale/gl_ES.d.ts +3 -0
- package/es/locale/gl_ES.js +34 -0
- package/es/locale/he_IL.d.ts +3 -0
- package/es/locale/he_IL.js +35 -0
- package/es/locale/hi_IN.d.ts +3 -0
- package/es/locale/hi_IN.js +35 -0
- package/es/locale/hr_HR.d.ts +3 -0
- package/es/locale/hr_HR.js +35 -0
- package/es/locale/hu_HU.d.ts +3 -0
- package/es/locale/hu_HU.js +58 -0
- package/es/locale/id_ID.d.ts +3 -0
- package/es/locale/id_ID.js +35 -0
- package/es/locale/is_IS.d.ts +3 -0
- package/es/locale/is_IS.js +34 -0
- package/es/locale/it_IT.d.ts +3 -0
- package/es/locale/it_IT.js +34 -0
- package/es/locale/ja_JP.d.ts +3 -0
- package/es/locale/ja_JP.js +37 -0
- package/es/locale/ka_GE.d.ts +3 -0
- package/es/locale/ka_GE.js +35 -0
- package/es/locale/kk_KZ.d.ts +3 -0
- package/es/locale/kk_KZ.js +34 -0
- package/es/locale/km_KH.d.ts +3 -0
- package/es/locale/km_KH.js +36 -0
- package/es/locale/kmr_IQ.d.ts +3 -0
- package/es/locale/kmr_IQ.js +34 -0
- package/es/locale/kn_IN.d.ts +3 -0
- package/es/locale/kn_IN.js +35 -0
- package/es/locale/ko_KR.d.ts +3 -0
- package/es/locale/ko_KR.js +36 -0
- package/es/locale/lt_LT.d.ts +3 -0
- package/es/locale/lt_LT.js +36 -0
- package/es/locale/lv_LV.d.ts +3 -0
- package/es/locale/lv_LV.js +34 -0
- package/es/locale/mk_MK.d.ts +3 -0
- package/es/locale/mk_MK.js +34 -0
- package/es/locale/ml_IN.d.ts +3 -0
- package/es/locale/ml_IN.js +35 -0
- package/es/locale/mn_MN.d.ts +3 -0
- package/es/locale/mn_MN.js +36 -0
- package/es/locale/ms_MY.d.ts +3 -0
- package/es/locale/ms_MY.js +36 -0
- package/es/locale/my_MM.d.ts +3 -0
- package/es/locale/my_MM.js +35 -0
- package/es/locale/nb_NO.d.ts +3 -0
- package/es/locale/nb_NO.js +36 -0
- package/es/locale/ne_NP.d.ts +3 -0
- package/es/locale/ne_NP.js +35 -0
- package/es/locale/nl_BE.d.ts +3 -0
- package/es/locale/nl_BE.js +34 -0
- package/es/locale/nl_NL.d.ts +3 -0
- package/es/locale/nl_NL.js +34 -0
- package/es/locale/pl_PL.d.ts +3 -0
- package/es/locale/pl_PL.js +34 -0
- package/es/locale/pt_BR.d.ts +3 -0
- package/es/locale/pt_BR.js +37 -0
- package/es/locale/pt_PT.d.ts +3 -0
- package/es/locale/pt_PT.js +36 -0
- package/es/locale/ro_RO.d.ts +3 -0
- package/es/locale/ro_RO.js +35 -0
- package/es/locale/ru_RU.d.ts +3 -0
- package/es/locale/ru_RU.js +34 -0
- package/es/locale/si_LK.d.ts +3 -0
- package/es/locale/si_LK.js +36 -0
- package/es/locale/sk_SK.d.ts +3 -0
- package/es/locale/sk_SK.js +34 -0
- package/es/locale/sl_SI.d.ts +3 -0
- package/es/locale/sl_SI.js +34 -0
- package/es/locale/sr_Cyrl_RS.d.ts +3 -0
- package/es/locale/sr_Cyrl_RS.js +34 -0
- package/es/locale/sr_RS.d.ts +3 -0
- package/es/locale/sr_RS.js +34 -0
- package/es/locale/sv_SE.d.ts +3 -0
- package/es/locale/sv_SE.js +34 -0
- package/es/locale/ta_IN.d.ts +3 -0
- package/es/locale/ta_IN.js +35 -0
- package/es/locale/th_TH.d.ts +3 -0
- package/es/locale/th_TH.js +34 -0
- package/es/locale/tk_TK.d.ts +3 -0
- package/es/locale/tk_TK.js +34 -0
- package/es/locale/tr_TR.d.ts +3 -0
- package/es/locale/tr_TR.js +36 -0
- package/es/locale/ug_CN.d.ts +3 -0
- package/es/locale/ug_CN.js +37 -0
- package/es/locale/uk_UA.d.ts +3 -0
- package/es/locale/uk_UA.js +34 -0
- package/es/locale/ur_PK.d.ts +3 -0
- package/es/locale/ur_PK.js +35 -0
- package/es/locale/uz_UZ.d.ts +3 -0
- package/es/locale/uz_UZ.js +35 -0
- package/es/locale/vi_VN.d.ts +3 -0
- package/es/locale/vi_VN.js +35 -0
- package/es/locale/zh_CN.d.ts +3 -0
- package/es/locale/zh_CN.js +36 -0
- package/es/locale/zh_TW.d.ts +3 -0
- package/es/locale/zh_TW.js +38 -0
- package/es/utils/dateUtil.d.ts +29 -0
- package/es/utils/dateUtil.js +140 -0
- package/es/utils/getClearIcon.d.ts +5 -0
- package/es/utils/getClearIcon.js +8 -0
- package/es/utils/miscUtil.d.ts +14 -0
- package/es/utils/miscUtil.js +70 -0
- package/es/utils/uiUtil.d.ts +1 -0
- package/es/utils/uiUtil.js +7 -0
- package/es/utils/warnUtil.d.ts +5 -0
- package/es/utils/warnUtil.js +10 -0
- package/lib/PickerInput/Popup/Footer.d.ts +19 -0
- package/lib/PickerInput/Popup/Footer.js +88 -0
- package/lib/PickerInput/Popup/PopupPanel.d.ts +10 -0
- package/lib/PickerInput/Popup/PopupPanel.js +93 -0
- package/lib/PickerInput/Popup/PresetPanel.d.ts +9 -0
- package/lib/PickerInput/Popup/PresetPanel.js +40 -0
- package/lib/PickerInput/Popup/index.d.ts +20 -0
- package/lib/PickerInput/Popup/index.js +207 -0
- package/lib/PickerInput/RangePicker.d.ts +54 -0
- package/lib/PickerInput/RangePicker.js +650 -0
- package/lib/PickerInput/Selector/Icon.d.ts +10 -0
- package/lib/PickerInput/Selector/Icon.js +43 -0
- package/lib/PickerInput/Selector/Input.d.ts +28 -0
- package/lib/PickerInput/Selector/Input.js +385 -0
- package/lib/PickerInput/Selector/MaskFormat.d.ts +22 -0
- package/lib/PickerInput/Selector/MaskFormat.js +112 -0
- package/lib/PickerInput/Selector/RangeSelector.d.ts +26 -0
- package/lib/PickerInput/Selector/RangeSelector.js +227 -0
- package/lib/PickerInput/Selector/SingleSelector/MultipleDates.d.ts +12 -0
- package/lib/PickerInput/Selector/SingleSelector/MultipleDates.js +76 -0
- package/lib/PickerInput/Selector/SingleSelector/index.d.ts +18 -0
- package/lib/PickerInput/Selector/SingleSelector/index.js +196 -0
- package/lib/PickerInput/Selector/hooks/useClearIcon.d.ts +8 -0
- package/lib/PickerInput/Selector/hooks/useClearIcon.js +27 -0
- package/lib/PickerInput/Selector/hooks/useInputProps.d.ts +16 -0
- package/lib/PickerInput/Selector/hooks/useInputProps.js +187 -0
- package/lib/PickerInput/Selector/hooks/useRootProps.d.ts +2 -0
- package/lib/PickerInput/Selector/hooks/useRootProps.js +17 -0
- package/lib/PickerInput/Selector/util.d.ts +1 -0
- package/lib/PickerInput/Selector/util.js +18 -0
- package/lib/PickerInput/SinglePicker.d.ts +51 -0
- package/lib/PickerInput/SinglePicker.js +553 -0
- package/lib/PickerInput/context.d.ts +13 -0
- package/lib/PickerInput/context.js +12 -0
- package/lib/PickerInput/hooks/useCellRender.d.ts +2 -0
- package/lib/PickerInput/hooks/useCellRender.js +49 -0
- package/lib/PickerInput/hooks/useDelayState.d.ts +5 -0
- package/lib/PickerInput/hooks/useDelayState.js +54 -0
- package/lib/PickerInput/hooks/useDisabledBoundary.d.ts +7 -0
- package/lib/PickerInput/hooks/useDisabledBoundary.js +26 -0
- package/lib/PickerInput/hooks/useFieldFormat.d.ts +2 -0
- package/lib/PickerInput/hooks/useFieldFormat.js +26 -0
- package/lib/PickerInput/hooks/useFieldsInvalidate.d.ts +5 -0
- package/lib/PickerInput/hooks/useFieldsInvalidate.js +64 -0
- package/lib/PickerInput/hooks/useFilledProps.d.ts +37 -0
- package/lib/PickerInput/hooks/useFilledProps.js +164 -0
- package/lib/PickerInput/hooks/useInputReadOnly.d.ts +2 -0
- package/lib/PickerInput/hooks/useInputReadOnly.js +12 -0
- package/lib/PickerInput/hooks/useInvalidate.d.ts +9 -0
- package/lib/PickerInput/hooks/useInvalidate.js +67 -0
- package/lib/PickerInput/hooks/useLockEffect.d.ts +5 -0
- package/lib/PickerInput/hooks/useLockEffect.js +34 -0
- package/lib/PickerInput/hooks/useOpen.d.ts +6 -0
- package/lib/PickerInput/hooks/useOpen.js +39 -0
- package/lib/PickerInput/hooks/usePickerRef.d.ts +7 -0
- package/lib/PickerInput/hooks/usePickerRef.js +28 -0
- package/lib/PickerInput/hooks/usePresets.d.ts +2 -0
- package/lib/PickerInput/hooks/usePresets.js +38 -0
- package/lib/PickerInput/hooks/useRangeActive.d.ts +19 -0
- package/lib/PickerInput/hooks/useRangeActive.js +84 -0
- package/lib/PickerInput/hooks/useRangeDisabledDate.d.ts +8 -0
- package/lib/PickerInput/hooks/useRangeDisabledDate.js +58 -0
- package/lib/PickerInput/hooks/useRangePickerValue.d.ts +5 -0
- package/lib/PickerInput/hooks/useRangePickerValue.js +203 -0
- package/lib/PickerInput/hooks/useRangeValue.d.ts +28 -0
- package/lib/PickerInput/hooks/useRangeValue.js +308 -0
- package/lib/PickerInput/hooks/useShowNow.d.ts +2 -0
- package/lib/PickerInput/hooks/useShowNow.js +20 -0
- package/lib/PickerPanel/DatePanel/index.d.ts +10 -0
- package/lib/PickerPanel/DatePanel/index.js +199 -0
- package/lib/PickerPanel/DateTimePanel/index.d.ts +3 -0
- package/lib/PickerPanel/DateTimePanel/index.js +65 -0
- package/lib/PickerPanel/DecadePanel/index.d.ts +3 -0
- package/lib/PickerPanel/DecadePanel/index.js +122 -0
- package/lib/PickerPanel/MonthPanel/index.d.ts +3 -0
- package/lib/PickerPanel/MonthPanel/index.js +115 -0
- package/lib/PickerPanel/PanelBody.d.ts +17 -0
- package/lib/PickerPanel/PanelBody.js +162 -0
- package/lib/PickerPanel/PanelHeader.d.ts +11 -0
- package/lib/PickerPanel/PanelHeader.js +143 -0
- package/lib/PickerPanel/QuarterPanel/index.d.ts +3 -0
- package/lib/PickerPanel/QuarterPanel/index.js +101 -0
- package/lib/PickerPanel/TimePanel/TimePanelBody/TimeColumn.d.ts +17 -0
- package/lib/PickerPanel/TimePanel/TimePanelBody/TimeColumn.js +158 -0
- package/lib/PickerPanel/TimePanel/TimePanelBody/index.d.ts +4 -0
- package/lib/PickerPanel/TimePanel/TimePanelBody/index.js +293 -0
- package/lib/PickerPanel/TimePanel/TimePanelBody/useScrollTo.d.ts +2 -0
- package/lib/PickerPanel/TimePanel/TimePanelBody/useScrollTo.js +82 -0
- package/lib/PickerPanel/TimePanel/TimePanelBody/util.d.ts +3 -0
- package/lib/PickerPanel/TimePanel/TimePanelBody/util.js +49 -0
- package/lib/PickerPanel/TimePanel/index.d.ts +4 -0
- package/lib/PickerPanel/TimePanel/index.js +48 -0
- package/lib/PickerPanel/WeekPanel/index.d.ts +3 -0
- package/lib/PickerPanel/WeekPanel/index.js +64 -0
- package/lib/PickerPanel/YearPanel/index.d.ts +3 -0
- package/lib/PickerPanel/YearPanel/index.js +125 -0
- package/lib/PickerPanel/context.d.ts +24 -0
- package/lib/PickerPanel/context.js +78 -0
- package/lib/PickerPanel/index.d.ts +60 -0
- package/lib/PickerPanel/index.js +324 -0
- package/lib/PickerTrigger/index.d.ts +19 -0
- package/lib/PickerTrigger/index.js +95 -0
- package/lib/PickerTrigger/util.d.ts +2 -0
- package/lib/PickerTrigger/util.js +10 -0
- package/lib/generate/dateFns.d.ts +3 -0
- package/lib/generate/dateFns.js +172 -0
- package/lib/generate/dayjs.d.ts +4 -0
- package/lib/generate/dayjs.js +240 -0
- package/lib/generate/index.d.ts +37 -0
- package/lib/generate/index.js +5 -0
- package/lib/generate/luxon.d.ts +4 -0
- package/lib/generate/luxon.js +203 -0
- package/lib/generate/moment.d.ts +4 -0
- package/lib/generate/moment.js +159 -0
- package/lib/hooks/useLocale.d.ts +6 -0
- package/lib/hooks/useLocale.js +90 -0
- package/lib/hooks/useSyncState.d.ts +6 -0
- package/lib/hooks/useSyncState.js +35 -0
- package/lib/hooks/useTimeConfig.d.ts +18 -0
- package/lib/hooks/useTimeConfig.js +173 -0
- package/lib/hooks/useTimeInfo.d.ts +12 -0
- package/lib/hooks/useTimeInfo.js +172 -0
- package/lib/hooks/useToggleDates.d.ts +8 -0
- package/lib/hooks/useToggleDates.js +32 -0
- package/lib/index.d.ts +35 -0
- package/lib/index.js +57 -0
- package/lib/interface.d.ts +365 -0
- package/lib/interface.js +5 -0
- package/lib/locale/am_ET.d.ts +3 -0
- package/lib/locale/am_ET.js +37 -0
- package/lib/locale/ar_EG.d.ts +3 -0
- package/lib/locale/ar_EG.js +40 -0
- package/lib/locale/az_AZ.d.ts +3 -0
- package/lib/locale/az_AZ.js +41 -0
- package/lib/locale/bg_BG.d.ts +3 -0
- package/lib/locale/bg_BG.js +40 -0
- package/lib/locale/bn_BD.d.ts +3 -0
- package/lib/locale/bn_BD.js +41 -0
- package/lib/locale/by_BY.d.ts +3 -0
- package/lib/locale/by_BY.js +41 -0
- package/lib/locale/ca_ES.d.ts +3 -0
- package/lib/locale/ca_ES.js +40 -0
- package/lib/locale/common.d.ts +2 -0
- package/lib/locale/common.js +12 -0
- package/lib/locale/cs_CZ.d.ts +3 -0
- package/lib/locale/cs_CZ.js +40 -0
- package/lib/locale/da_DK.d.ts +3 -0
- package/lib/locale/da_DK.js +40 -0
- package/lib/locale/de_DE.d.ts +3 -0
- package/lib/locale/de_DE.js +40 -0
- package/lib/locale/el_GR.d.ts +3 -0
- package/lib/locale/el_GR.js +40 -0
- package/lib/locale/en_GB.d.ts +3 -0
- package/lib/locale/en_GB.js +40 -0
- package/lib/locale/en_US.d.ts +3 -0
- package/lib/locale/en_US.js +41 -0
- package/lib/locale/es_ES.d.ts +3 -0
- package/lib/locale/es_ES.js +40 -0
- package/lib/locale/es_MX.d.ts +3 -0
- package/lib/locale/es_MX.js +41 -0
- package/lib/locale/et_EE.d.ts +3 -0
- package/lib/locale/et_EE.js +40 -0
- package/lib/locale/eu_ES.d.ts +3 -0
- package/lib/locale/eu_ES.js +42 -0
- package/lib/locale/fa_IR.d.ts +3 -0
- package/lib/locale/fa_IR.js +40 -0
- package/lib/locale/fi_FI.d.ts +3 -0
- package/lib/locale/fi_FI.js +40 -0
- package/lib/locale/fr_BE.d.ts +3 -0
- package/lib/locale/fr_BE.js +40 -0
- package/lib/locale/fr_CA.d.ts +3 -0
- package/lib/locale/fr_CA.js +41 -0
- package/lib/locale/fr_FR.d.ts +3 -0
- package/lib/locale/fr_FR.js +41 -0
- package/lib/locale/ga_IE.d.ts +3 -0
- package/lib/locale/ga_IE.js +41 -0
- package/lib/locale/gl_ES.d.ts +3 -0
- package/lib/locale/gl_ES.js +40 -0
- package/lib/locale/he_IL.d.ts +3 -0
- package/lib/locale/he_IL.js +41 -0
- package/lib/locale/hi_IN.d.ts +3 -0
- package/lib/locale/hi_IN.js +41 -0
- package/lib/locale/hr_HR.d.ts +3 -0
- package/lib/locale/hr_HR.js +41 -0
- package/lib/locale/hu_HU.d.ts +3 -0
- package/lib/locale/hu_HU.js +64 -0
- package/lib/locale/id_ID.d.ts +3 -0
- package/lib/locale/id_ID.js +41 -0
- package/lib/locale/is_IS.d.ts +3 -0
- package/lib/locale/is_IS.js +40 -0
- package/lib/locale/it_IT.d.ts +3 -0
- package/lib/locale/it_IT.js +40 -0
- package/lib/locale/ja_JP.d.ts +3 -0
- package/lib/locale/ja_JP.js +43 -0
- package/lib/locale/ka_GE.d.ts +3 -0
- package/lib/locale/ka_GE.js +41 -0
- package/lib/locale/kk_KZ.d.ts +3 -0
- package/lib/locale/kk_KZ.js +40 -0
- package/lib/locale/km_KH.d.ts +3 -0
- package/lib/locale/km_KH.js +42 -0
- package/lib/locale/kmr_IQ.d.ts +3 -0
- package/lib/locale/kmr_IQ.js +40 -0
- package/lib/locale/kn_IN.d.ts +3 -0
- package/lib/locale/kn_IN.js +41 -0
- package/lib/locale/ko_KR.d.ts +3 -0
- package/lib/locale/ko_KR.js +42 -0
- package/lib/locale/lt_LT.d.ts +3 -0
- package/lib/locale/lt_LT.js +42 -0
- package/lib/locale/lv_LV.d.ts +3 -0
- package/lib/locale/lv_LV.js +40 -0
- package/lib/locale/mk_MK.d.ts +3 -0
- package/lib/locale/mk_MK.js +40 -0
- package/lib/locale/ml_IN.d.ts +3 -0
- package/lib/locale/ml_IN.js +41 -0
- package/lib/locale/mn_MN.d.ts +3 -0
- package/lib/locale/mn_MN.js +42 -0
- package/lib/locale/ms_MY.d.ts +3 -0
- package/lib/locale/ms_MY.js +42 -0
- package/lib/locale/my_MM.d.ts +3 -0
- package/lib/locale/my_MM.js +41 -0
- package/lib/locale/nb_NO.d.ts +3 -0
- package/lib/locale/nb_NO.js +42 -0
- package/lib/locale/ne_NP.d.ts +3 -0
- package/lib/locale/ne_NP.js +41 -0
- package/lib/locale/nl_BE.d.ts +3 -0
- package/lib/locale/nl_BE.js +40 -0
- package/lib/locale/nl_NL.d.ts +3 -0
- package/lib/locale/nl_NL.js +40 -0
- package/lib/locale/pl_PL.d.ts +3 -0
- package/lib/locale/pl_PL.js +40 -0
- package/lib/locale/pt_BR.d.ts +3 -0
- package/lib/locale/pt_BR.js +43 -0
- package/lib/locale/pt_PT.d.ts +3 -0
- package/lib/locale/pt_PT.js +42 -0
- package/lib/locale/ro_RO.d.ts +3 -0
- package/lib/locale/ro_RO.js +41 -0
- package/lib/locale/ru_RU.d.ts +3 -0
- package/lib/locale/ru_RU.js +40 -0
- package/lib/locale/si_LK.d.ts +3 -0
- package/lib/locale/si_LK.js +42 -0
- package/lib/locale/sk_SK.d.ts +3 -0
- package/lib/locale/sk_SK.js +40 -0
- package/lib/locale/sl_SI.d.ts +3 -0
- package/lib/locale/sl_SI.js +40 -0
- package/lib/locale/sr_Cyrl_RS.d.ts +3 -0
- package/lib/locale/sr_Cyrl_RS.js +40 -0
- package/lib/locale/sr_RS.d.ts +3 -0
- package/lib/locale/sr_RS.js +40 -0
- package/lib/locale/sv_SE.d.ts +3 -0
- package/lib/locale/sv_SE.js +40 -0
- package/lib/locale/ta_IN.d.ts +3 -0
- package/lib/locale/ta_IN.js +41 -0
- package/lib/locale/th_TH.d.ts +3 -0
- package/lib/locale/th_TH.js +40 -0
- package/lib/locale/tk_TK.d.ts +3 -0
- package/lib/locale/tk_TK.js +40 -0
- package/lib/locale/tr_TR.d.ts +3 -0
- package/lib/locale/tr_TR.js +42 -0
- package/lib/locale/ug_CN.d.ts +3 -0
- package/lib/locale/ug_CN.js +43 -0
- package/lib/locale/uk_UA.d.ts +3 -0
- package/lib/locale/uk_UA.js +40 -0
- package/lib/locale/ur_PK.d.ts +3 -0
- package/lib/locale/ur_PK.js +41 -0
- package/lib/locale/uz_UZ.d.ts +3 -0
- package/lib/locale/uz_UZ.js +41 -0
- package/lib/locale/vi_VN.d.ts +3 -0
- package/lib/locale/vi_VN.js +41 -0
- package/lib/locale/zh_CN.d.ts +3 -0
- package/lib/locale/zh_CN.js +42 -0
- package/lib/locale/zh_TW.d.ts +3 -0
- package/lib/locale/zh_TW.js +44 -0
- package/lib/utils/dateUtil.d.ts +29 -0
- package/lib/utils/dateUtil.js +161 -0
- package/lib/utils/getClearIcon.d.ts +5 -0
- package/lib/utils/getClearIcon.js +15 -0
- package/lib/utils/miscUtil.d.ts +14 -0
- package/lib/utils/miscUtil.js +81 -0
- package/lib/utils/uiUtil.d.ts +1 -0
- package/lib/utils/uiUtil.js +13 -0
- package/lib/utils/warnUtil.d.ts +5 -0
- package/lib/utils/warnUtil.js +17 -0
- package/package.json +107 -0
|
@@ -0,0 +1,545 @@
|
|
|
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 * as React from 'react';
|
|
23
|
+
import useToggleDates from "../hooks/useToggleDates";
|
|
24
|
+
import PickerTrigger from "../PickerTrigger";
|
|
25
|
+
import { pickTriggerProps } from "../PickerTrigger/util";
|
|
26
|
+
import { 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 useRangePickerValue from "./hooks/useRangePickerValue";
|
|
36
|
+
import useRangeValue, { useInnerValue } from "./hooks/useRangeValue";
|
|
37
|
+
import useShowNow from "./hooks/useShowNow";
|
|
38
|
+
import Popup from "./Popup";
|
|
39
|
+
import SingleSelector from "./Selector/SingleSelector";
|
|
40
|
+
|
|
41
|
+
// TODO: isInvalidateDate with showTime.disabledTime should not provide `range` prop
|
|
42
|
+
|
|
43
|
+
/** Internal usage. For cross function get same aligned props */
|
|
44
|
+
|
|
45
|
+
function Picker(props, ref) {
|
|
46
|
+
// ========================= Prop =========================
|
|
47
|
+
var _useFilledProps = useFilledProps(props),
|
|
48
|
+
_useFilledProps2 = _slicedToArray(_useFilledProps, 6),
|
|
49
|
+
filledProps = _useFilledProps2[0],
|
|
50
|
+
internalPicker = _useFilledProps2[1],
|
|
51
|
+
complexPicker = _useFilledProps2[2],
|
|
52
|
+
formatList = _useFilledProps2[3],
|
|
53
|
+
maskFormat = _useFilledProps2[4],
|
|
54
|
+
isInvalidateDate = _useFilledProps2[5];
|
|
55
|
+
var _ref = filledProps,
|
|
56
|
+
prefixCls = _ref.prefixCls,
|
|
57
|
+
styles = _ref.styles,
|
|
58
|
+
classNames = _ref.classNames,
|
|
59
|
+
order = _ref.order,
|
|
60
|
+
defaultValue = _ref.defaultValue,
|
|
61
|
+
value = _ref.value,
|
|
62
|
+
needConfirm = _ref.needConfirm,
|
|
63
|
+
onChange = _ref.onChange,
|
|
64
|
+
onKeyDown = _ref.onKeyDown,
|
|
65
|
+
disabled = _ref.disabled,
|
|
66
|
+
disabledDate = _ref.disabledDate,
|
|
67
|
+
minDate = _ref.minDate,
|
|
68
|
+
maxDate = _ref.maxDate,
|
|
69
|
+
defaultOpen = _ref.defaultOpen,
|
|
70
|
+
open = _ref.open,
|
|
71
|
+
onOpenChange = _ref.onOpenChange,
|
|
72
|
+
locale = _ref.locale,
|
|
73
|
+
generateConfig = _ref.generateConfig,
|
|
74
|
+
picker = _ref.picker,
|
|
75
|
+
showNow = _ref.showNow,
|
|
76
|
+
showToday = _ref.showToday,
|
|
77
|
+
showTime = _ref.showTime,
|
|
78
|
+
mode = _ref.mode,
|
|
79
|
+
onPanelChange = _ref.onPanelChange,
|
|
80
|
+
onCalendarChange = _ref.onCalendarChange,
|
|
81
|
+
onOk = _ref.onOk,
|
|
82
|
+
multiple = _ref.multiple,
|
|
83
|
+
defaultPickerValue = _ref.defaultPickerValue,
|
|
84
|
+
pickerValue = _ref.pickerValue,
|
|
85
|
+
onPickerValueChange = _ref.onPickerValueChange,
|
|
86
|
+
inputReadOnly = _ref.inputReadOnly,
|
|
87
|
+
suffixIcon = _ref.suffixIcon,
|
|
88
|
+
removeIcon = _ref.removeIcon,
|
|
89
|
+
onFocus = _ref.onFocus,
|
|
90
|
+
onBlur = _ref.onBlur,
|
|
91
|
+
presets = _ref.presets,
|
|
92
|
+
components = _ref.components,
|
|
93
|
+
cellRender = _ref.cellRender,
|
|
94
|
+
dateRender = _ref.dateRender,
|
|
95
|
+
monthCellRender = _ref.monthCellRender,
|
|
96
|
+
onClick = _ref.onClick;
|
|
97
|
+
|
|
98
|
+
// ========================= Refs =========================
|
|
99
|
+
var selectorRef = usePickerRef(ref);
|
|
100
|
+
|
|
101
|
+
// ========================= Util =========================
|
|
102
|
+
function pickerParam(values) {
|
|
103
|
+
if (values === null) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return multiple ? values : values[0];
|
|
107
|
+
}
|
|
108
|
+
var toggleDates = useToggleDates(generateConfig, locale, internalPicker);
|
|
109
|
+
|
|
110
|
+
// ========================= Open =========================
|
|
111
|
+
var _useOpen = useOpen(open, defaultOpen, [disabled], onOpenChange),
|
|
112
|
+
_useOpen2 = _slicedToArray(_useOpen, 2),
|
|
113
|
+
mergedOpen = _useOpen2[0],
|
|
114
|
+
triggerOpen = _useOpen2[1];
|
|
115
|
+
|
|
116
|
+
// ======================= Calendar =======================
|
|
117
|
+
var onInternalCalendarChange = function onInternalCalendarChange(dates, dateStrings, info) {
|
|
118
|
+
if (onCalendarChange) {
|
|
119
|
+
var filteredInfo = _objectSpread({}, info);
|
|
120
|
+
delete filteredInfo.range;
|
|
121
|
+
onCalendarChange(pickerParam(dates), pickerParam(dateStrings), filteredInfo);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var onInternalOk = function onInternalOk(dates) {
|
|
125
|
+
onOk === null || onOk === void 0 || onOk(pickerParam(dates));
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// ======================== Values ========================
|
|
129
|
+
var _useInnerValue = useInnerValue(generateConfig, locale, formatList, false, order, defaultValue, value, onInternalCalendarChange, onInternalOk),
|
|
130
|
+
_useInnerValue2 = _slicedToArray(_useInnerValue, 5),
|
|
131
|
+
mergedValue = _useInnerValue2[0],
|
|
132
|
+
setInnerValue = _useInnerValue2[1],
|
|
133
|
+
getCalendarValue = _useInnerValue2[2],
|
|
134
|
+
triggerCalendarChange = _useInnerValue2[3],
|
|
135
|
+
triggerOk = _useInnerValue2[4];
|
|
136
|
+
var calendarValue = getCalendarValue();
|
|
137
|
+
|
|
138
|
+
// ======================== Active ========================
|
|
139
|
+
// In SinglePicker, we will always get `activeIndex` is 0.
|
|
140
|
+
var _useRangeActive = useRangeActive([disabled]),
|
|
141
|
+
_useRangeActive2 = _slicedToArray(_useRangeActive, 4),
|
|
142
|
+
focused = _useRangeActive2[0],
|
|
143
|
+
triggerFocus = _useRangeActive2[1],
|
|
144
|
+
lastOperation = _useRangeActive2[2],
|
|
145
|
+
activeIndex = _useRangeActive2[3];
|
|
146
|
+
var onSharedFocus = function onSharedFocus(event) {
|
|
147
|
+
triggerFocus(true);
|
|
148
|
+
onFocus === null || onFocus === void 0 || onFocus(event, {});
|
|
149
|
+
};
|
|
150
|
+
var onSharedBlur = function onSharedBlur(event) {
|
|
151
|
+
triggerFocus(false);
|
|
152
|
+
onBlur === null || onBlur === void 0 || onBlur(event, {});
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// ========================= Mode =========================
|
|
156
|
+
var _useMergedState = useMergedState(picker, {
|
|
157
|
+
value: mode
|
|
158
|
+
}),
|
|
159
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
160
|
+
mergedMode = _useMergedState2[0],
|
|
161
|
+
setMode = _useMergedState2[1];
|
|
162
|
+
|
|
163
|
+
/** Extends from `mergedMode` to patch `datetime` mode */
|
|
164
|
+
var internalMode = mergedMode === 'date' && showTime ? 'datetime' : mergedMode;
|
|
165
|
+
|
|
166
|
+
// ======================= Show Now =======================
|
|
167
|
+
var mergedShowNow = useShowNow(picker, mergedMode, showNow, showToday);
|
|
168
|
+
|
|
169
|
+
// ======================== Value =========================
|
|
170
|
+
var onInternalChange = onChange && function (dates, dateStrings) {
|
|
171
|
+
onChange(pickerParam(dates), pickerParam(dateStrings));
|
|
172
|
+
};
|
|
173
|
+
var _useRangeValue = useRangeValue(_objectSpread(_objectSpread({}, filledProps), {}, {
|
|
174
|
+
onChange: onInternalChange
|
|
175
|
+
}), mergedValue, setInnerValue, getCalendarValue, triggerCalendarChange, [],
|
|
176
|
+
//disabled,
|
|
177
|
+
formatList, focused, mergedOpen, isInvalidateDate),
|
|
178
|
+
_useRangeValue2 = _slicedToArray(_useRangeValue, 2),
|
|
179
|
+
/** Trigger `onChange` directly without check `disabledDate` */
|
|
180
|
+
triggerSubmitChange = _useRangeValue2[1];
|
|
181
|
+
|
|
182
|
+
// ======================= Validate =======================
|
|
183
|
+
var _useFieldsInvalidate = useFieldsInvalidate(calendarValue, isInvalidateDate),
|
|
184
|
+
_useFieldsInvalidate2 = _slicedToArray(_useFieldsInvalidate, 2),
|
|
185
|
+
submitInvalidates = _useFieldsInvalidate2[0],
|
|
186
|
+
onSelectorInvalid = _useFieldsInvalidate2[1];
|
|
187
|
+
var submitInvalidate = React.useMemo(function () {
|
|
188
|
+
return submitInvalidates.some(function (invalidated) {
|
|
189
|
+
return invalidated;
|
|
190
|
+
});
|
|
191
|
+
}, [submitInvalidates]);
|
|
192
|
+
|
|
193
|
+
// ===================== Picker Value =====================
|
|
194
|
+
// Proxy to single pickerValue
|
|
195
|
+
var onInternalPickerValueChange = function onInternalPickerValueChange(dates, info) {
|
|
196
|
+
if (onPickerValueChange) {
|
|
197
|
+
var cleanInfo = _objectSpread(_objectSpread({}, info), {}, {
|
|
198
|
+
mode: info.mode[0]
|
|
199
|
+
});
|
|
200
|
+
delete cleanInfo.range;
|
|
201
|
+
onPickerValueChange(dates[0], cleanInfo);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
var _useRangePickerValue = useRangePickerValue(generateConfig, locale, calendarValue, [mergedMode], mergedOpen, activeIndex, internalPicker, false,
|
|
205
|
+
// multiplePanel,
|
|
206
|
+
defaultPickerValue, pickerValue, toArray(showTime === null || showTime === void 0 ? void 0 : showTime.defaultOpenValue), onInternalPickerValueChange, minDate, maxDate),
|
|
207
|
+
_useRangePickerValue2 = _slicedToArray(_useRangePickerValue, 2),
|
|
208
|
+
currentPickerValue = _useRangePickerValue2[0],
|
|
209
|
+
setCurrentPickerValue = _useRangePickerValue2[1];
|
|
210
|
+
|
|
211
|
+
// >>> Mode need wait for `pickerValue`
|
|
212
|
+
var triggerModeChange = useEvent(function (nextPickerValue, nextMode, triggerEvent) {
|
|
213
|
+
setMode(nextMode);
|
|
214
|
+
|
|
215
|
+
// Compatible with `onPanelChange`
|
|
216
|
+
if (onPanelChange && triggerEvent !== false) {
|
|
217
|
+
var lastPickerValue = nextPickerValue || calendarValue[calendarValue.length - 1];
|
|
218
|
+
onPanelChange(lastPickerValue, nextMode);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// ======================== Submit ========================
|
|
223
|
+
/**
|
|
224
|
+
* Different with RangePicker, confirm should check `multiple` logic.
|
|
225
|
+
* This will never provide `date` instead.
|
|
226
|
+
*/
|
|
227
|
+
var triggerConfirm = function triggerConfirm() {
|
|
228
|
+
triggerSubmitChange(getCalendarValue());
|
|
229
|
+
triggerOpen(false, {
|
|
230
|
+
force: true
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// ======================== Click =========================
|
|
235
|
+
var onSelectorClick = function onSelectorClick(event) {
|
|
236
|
+
if (!disabled && !selectorRef.current.nativeElement.contains(document.activeElement)) {
|
|
237
|
+
// Click to focus the enabled input
|
|
238
|
+
selectorRef.current.focus();
|
|
239
|
+
}
|
|
240
|
+
triggerOpen(true);
|
|
241
|
+
onClick === null || onClick === void 0 || onClick(event);
|
|
242
|
+
};
|
|
243
|
+
var onSelectorClear = function onSelectorClear() {
|
|
244
|
+
triggerSubmitChange(null);
|
|
245
|
+
triggerOpen(false, {
|
|
246
|
+
force: true
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
// ======================== Hover =========================
|
|
251
|
+
var _React$useState = React.useState(null),
|
|
252
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
253
|
+
hoverSource = _React$useState2[0],
|
|
254
|
+
setHoverSource = _React$useState2[1];
|
|
255
|
+
var _React$useState3 = React.useState(null),
|
|
256
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
257
|
+
internalHoverValue = _React$useState4[0],
|
|
258
|
+
setInternalHoverValue = _React$useState4[1];
|
|
259
|
+
var hoverValues = React.useMemo(function () {
|
|
260
|
+
var values = [internalHoverValue].concat(_toConsumableArray(calendarValue)).filter(function (date) {
|
|
261
|
+
return date;
|
|
262
|
+
});
|
|
263
|
+
return multiple ? values : values.slice(0, 1);
|
|
264
|
+
}, [calendarValue, internalHoverValue, multiple]);
|
|
265
|
+
|
|
266
|
+
// Selector values is different with RangePicker
|
|
267
|
+
// which can not use `hoverValue` directly
|
|
268
|
+
var selectorValues = React.useMemo(function () {
|
|
269
|
+
if (!multiple && internalHoverValue) {
|
|
270
|
+
return [internalHoverValue];
|
|
271
|
+
}
|
|
272
|
+
return calendarValue.filter(function (date) {
|
|
273
|
+
return date;
|
|
274
|
+
});
|
|
275
|
+
}, [calendarValue, internalHoverValue, multiple]);
|
|
276
|
+
|
|
277
|
+
// Clean up `internalHoverValues` when closed
|
|
278
|
+
React.useEffect(function () {
|
|
279
|
+
if (!mergedOpen) {
|
|
280
|
+
setInternalHoverValue(null);
|
|
281
|
+
}
|
|
282
|
+
}, [mergedOpen]);
|
|
283
|
+
|
|
284
|
+
// ========================================================
|
|
285
|
+
// == Panels ==
|
|
286
|
+
// ========================================================
|
|
287
|
+
// ======================= Presets ========================
|
|
288
|
+
var presetList = usePresets(presets);
|
|
289
|
+
var onPresetHover = function onPresetHover(nextValue) {
|
|
290
|
+
setInternalHoverValue(nextValue);
|
|
291
|
+
setHoverSource('preset');
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// TODO: handle this
|
|
295
|
+
var onPresetSubmit = function onPresetSubmit(nextValue) {
|
|
296
|
+
var nextCalendarValues = multiple ? toggleDates(getCalendarValue(), nextValue) : [nextValue];
|
|
297
|
+
var passed = triggerSubmitChange(nextCalendarValues);
|
|
298
|
+
if (passed && !multiple) {
|
|
299
|
+
triggerOpen(false, {
|
|
300
|
+
force: true
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
var onNow = function onNow(now) {
|
|
305
|
+
onPresetSubmit(now);
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
// ======================== Panel =========================
|
|
309
|
+
var onPanelHover = function onPanelHover(date) {
|
|
310
|
+
setInternalHoverValue(date);
|
|
311
|
+
setHoverSource('cell');
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
// >>> Focus
|
|
315
|
+
var onPanelFocus = function onPanelFocus(event) {
|
|
316
|
+
triggerOpen(true);
|
|
317
|
+
onSharedFocus(event);
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
// >>> Calendar
|
|
321
|
+
var onPanelSelect = function onPanelSelect(date) {
|
|
322
|
+
lastOperation('panel');
|
|
323
|
+
|
|
324
|
+
// Not change values if multiple and current panel is to match with picker
|
|
325
|
+
if (multiple && internalMode !== picker) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
var nextValues = multiple ? toggleDates(getCalendarValue(), date) : [date];
|
|
329
|
+
|
|
330
|
+
// Only trigger calendar event but not update internal `calendarValue` state
|
|
331
|
+
triggerCalendarChange(nextValues);
|
|
332
|
+
|
|
333
|
+
// >>> Trigger next active if !needConfirm
|
|
334
|
+
// Fully logic check `useRangeValue` hook
|
|
335
|
+
if (!needConfirm && !complexPicker && internalPicker === internalMode) {
|
|
336
|
+
triggerConfirm();
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
// >>> Close
|
|
341
|
+
var onPopupClose = function onPopupClose() {
|
|
342
|
+
// Close popup
|
|
343
|
+
triggerOpen(false);
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// >>> cellRender
|
|
347
|
+
var onInternalCellRender = useCellRender(cellRender, dateRender, monthCellRender);
|
|
348
|
+
|
|
349
|
+
// >>> invalid
|
|
350
|
+
|
|
351
|
+
var panelProps = React.useMemo(function () {
|
|
352
|
+
var domProps = pickAttrs(filledProps, false);
|
|
353
|
+
var restProps = omit(filledProps, [].concat(_toConsumableArray(Object.keys(domProps)), ['onChange', 'onCalendarChange', 'style', 'className', 'onPanelChange']));
|
|
354
|
+
return _objectSpread(_objectSpread({}, restProps), {}, {
|
|
355
|
+
multiple: filledProps.multiple
|
|
356
|
+
});
|
|
357
|
+
}, [filledProps]);
|
|
358
|
+
|
|
359
|
+
// >>> Render
|
|
360
|
+
var panel = /*#__PURE__*/React.createElement(Popup, _extends({}, panelProps, {
|
|
361
|
+
showNow: mergedShowNow,
|
|
362
|
+
showTime: showTime
|
|
363
|
+
// Disabled
|
|
364
|
+
,
|
|
365
|
+
disabledDate: disabledDate
|
|
366
|
+
// Focus
|
|
367
|
+
,
|
|
368
|
+
onFocus: onPanelFocus,
|
|
369
|
+
onBlur: onSharedBlur
|
|
370
|
+
// Mode
|
|
371
|
+
,
|
|
372
|
+
picker: picker,
|
|
373
|
+
mode: mergedMode,
|
|
374
|
+
internalMode: internalMode,
|
|
375
|
+
onPanelChange: triggerModeChange
|
|
376
|
+
// Value
|
|
377
|
+
,
|
|
378
|
+
format: maskFormat,
|
|
379
|
+
value: calendarValue,
|
|
380
|
+
isInvalid: isInvalidateDate,
|
|
381
|
+
onChange: null,
|
|
382
|
+
onSelect: onPanelSelect
|
|
383
|
+
// PickerValue
|
|
384
|
+
,
|
|
385
|
+
pickerValue: currentPickerValue,
|
|
386
|
+
defaultOpenValue: showTime === null || showTime === void 0 ? void 0 : showTime.defaultOpenValue,
|
|
387
|
+
onPickerValueChange: setCurrentPickerValue
|
|
388
|
+
// Hover
|
|
389
|
+
,
|
|
390
|
+
hoverValue: hoverValues,
|
|
391
|
+
onHover: onPanelHover
|
|
392
|
+
// Submit
|
|
393
|
+
,
|
|
394
|
+
needConfirm: needConfirm,
|
|
395
|
+
onSubmit: triggerConfirm,
|
|
396
|
+
onOk: triggerOk
|
|
397
|
+
// Preset
|
|
398
|
+
,
|
|
399
|
+
presets: presetList,
|
|
400
|
+
onPresetHover: onPresetHover,
|
|
401
|
+
onPresetSubmit: onPresetSubmit,
|
|
402
|
+
onNow: onNow
|
|
403
|
+
// Render
|
|
404
|
+
,
|
|
405
|
+
cellRender: onInternalCellRender
|
|
406
|
+
}));
|
|
407
|
+
|
|
408
|
+
// ========================================================
|
|
409
|
+
// == Selector ==
|
|
410
|
+
// ========================================================
|
|
411
|
+
|
|
412
|
+
// ======================== Change ========================
|
|
413
|
+
var onSelectorChange = function onSelectorChange(date) {
|
|
414
|
+
triggerCalendarChange(date);
|
|
415
|
+
};
|
|
416
|
+
var onSelectorInputChange = function onSelectorInputChange() {
|
|
417
|
+
lastOperation('input');
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
// ======================= Selector =======================
|
|
421
|
+
var onSelectorFocus = function onSelectorFocus(event) {
|
|
422
|
+
lastOperation('input');
|
|
423
|
+
triggerOpen(true, {
|
|
424
|
+
inherit: true
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
// setActiveIndex(index);
|
|
428
|
+
|
|
429
|
+
onSharedFocus(event);
|
|
430
|
+
};
|
|
431
|
+
var onSelectorBlur = function onSelectorBlur(event) {
|
|
432
|
+
triggerOpen(false);
|
|
433
|
+
onSharedBlur(event);
|
|
434
|
+
};
|
|
435
|
+
var onSelectorKeyDown = function onSelectorKeyDown(event, preventDefault) {
|
|
436
|
+
if (event.key === 'Tab') {
|
|
437
|
+
triggerConfirm();
|
|
438
|
+
}
|
|
439
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event, preventDefault);
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
// ======================= Context ========================
|
|
443
|
+
var context = React.useMemo(function () {
|
|
444
|
+
return {
|
|
445
|
+
prefixCls: prefixCls,
|
|
446
|
+
locale: locale,
|
|
447
|
+
generateConfig: generateConfig,
|
|
448
|
+
button: components.button,
|
|
449
|
+
input: components.input
|
|
450
|
+
};
|
|
451
|
+
}, [prefixCls, locale, generateConfig, components.button, components.input]);
|
|
452
|
+
|
|
453
|
+
// ======================== Effect ========================
|
|
454
|
+
// >>> Mode
|
|
455
|
+
// Reset for every active
|
|
456
|
+
useLayoutEffect(function () {
|
|
457
|
+
if (mergedOpen && activeIndex !== undefined) {
|
|
458
|
+
// Legacy compatible. This effect update should not trigger `onPanelChange`
|
|
459
|
+
triggerModeChange(null, picker, false);
|
|
460
|
+
}
|
|
461
|
+
}, [mergedOpen, activeIndex, picker]);
|
|
462
|
+
|
|
463
|
+
// >>> For complex picker, we need check if need to focus next one
|
|
464
|
+
useLayoutEffect(function () {
|
|
465
|
+
var lastOp = lastOperation();
|
|
466
|
+
|
|
467
|
+
// Trade as confirm on field leave
|
|
468
|
+
if (!mergedOpen && lastOp === 'input') {
|
|
469
|
+
triggerOpen(false);
|
|
470
|
+
triggerConfirm();
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// Submit with complex picker
|
|
474
|
+
if (!mergedOpen && complexPicker && !needConfirm && lastOp === 'panel') {
|
|
475
|
+
triggerOpen(true);
|
|
476
|
+
triggerConfirm();
|
|
477
|
+
}
|
|
478
|
+
}, [mergedOpen]);
|
|
479
|
+
|
|
480
|
+
// ======================== Render ========================
|
|
481
|
+
return /*#__PURE__*/React.createElement(PickerContext.Provider, {
|
|
482
|
+
value: context
|
|
483
|
+
}, /*#__PURE__*/React.createElement(PickerTrigger, _extends({}, pickTriggerProps(filledProps), {
|
|
484
|
+
popupElement: panel,
|
|
485
|
+
popupStyle: styles.popup,
|
|
486
|
+
popupClassName: classNames.popup
|
|
487
|
+
// Visible
|
|
488
|
+
,
|
|
489
|
+
visible: mergedOpen,
|
|
490
|
+
onClose: onPopupClose
|
|
491
|
+
}), /*#__PURE__*/React.createElement(SingleSelector
|
|
492
|
+
// Shared
|
|
493
|
+
, _extends({}, filledProps, {
|
|
494
|
+
// Ref
|
|
495
|
+
ref: selectorRef
|
|
496
|
+
// Icon
|
|
497
|
+
,
|
|
498
|
+
suffixIcon: suffixIcon,
|
|
499
|
+
removeIcon: removeIcon
|
|
500
|
+
// Active
|
|
501
|
+
,
|
|
502
|
+
activeHelp: !!internalHoverValue,
|
|
503
|
+
allHelp: !!internalHoverValue && hoverSource === 'preset',
|
|
504
|
+
focused: focused,
|
|
505
|
+
onFocus: onSelectorFocus,
|
|
506
|
+
onBlur: onSelectorBlur,
|
|
507
|
+
onKeyDown: onSelectorKeyDown,
|
|
508
|
+
onSubmit: triggerConfirm
|
|
509
|
+
// Change
|
|
510
|
+
,
|
|
511
|
+
value: selectorValues,
|
|
512
|
+
maskFormat: maskFormat,
|
|
513
|
+
onChange: onSelectorChange,
|
|
514
|
+
onInputChange: onSelectorInputChange,
|
|
515
|
+
internalPicker: internalPicker
|
|
516
|
+
// Format
|
|
517
|
+
,
|
|
518
|
+
format: formatList,
|
|
519
|
+
inputReadOnly: inputReadOnly
|
|
520
|
+
// Disabled
|
|
521
|
+
,
|
|
522
|
+
disabled: disabled
|
|
523
|
+
// Open
|
|
524
|
+
,
|
|
525
|
+
open: mergedOpen,
|
|
526
|
+
onOpenChange: triggerOpen
|
|
527
|
+
// Click
|
|
528
|
+
,
|
|
529
|
+
onClick: onSelectorClick,
|
|
530
|
+
onClear: onSelectorClear
|
|
531
|
+
// Invalid
|
|
532
|
+
,
|
|
533
|
+
invalid: submitInvalidate,
|
|
534
|
+
onInvalid: function onInvalid(invalid) {
|
|
535
|
+
// Only `single` mode support type date.
|
|
536
|
+
// `multiple` mode can not typing.
|
|
537
|
+
onSelectorInvalid(invalid, 0);
|
|
538
|
+
}
|
|
539
|
+
}))));
|
|
540
|
+
}
|
|
541
|
+
var RefPicker = /*#__PURE__*/React.forwardRef(Picker);
|
|
542
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
543
|
+
RefPicker.displayName = 'RefPicker';
|
|
544
|
+
}
|
|
545
|
+
export default RefPicker;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { GenerateConfig } from '../generate';
|
|
3
|
+
import type { Components, Locale } from '../interface';
|
|
4
|
+
export interface PickerContextProps<DateType = any> {
|
|
5
|
+
prefixCls: string;
|
|
6
|
+
locale: Locale;
|
|
7
|
+
generateConfig: GenerateConfig<DateType>;
|
|
8
|
+
/** Customize button component */
|
|
9
|
+
button?: Components['button'];
|
|
10
|
+
input?: Components['input'];
|
|
11
|
+
}
|
|
12
|
+
declare const PickerContext: React.Context<PickerContextProps<any>>;
|
|
13
|
+
export default PickerContext;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { CellRender, CellRenderInfo, SharedPickerProps } from '../../interface';
|
|
2
|
+
export default function useCellRender<DateType extends object = any>(cellRender: SharedPickerProps<DateType>['cellRender'], dateRender?: SharedPickerProps<DateType>['dateRender'], monthCellRender?: SharedPickerProps<DateType>['monthCellRender'], range?: CellRenderInfo<DateType>['range']): CellRender<DateType>;
|
|
@@ -0,0 +1,41 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
import { warning } from '@rc-component/util';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
export default function useCellRender(cellRender, dateRender, monthCellRender, range) {
|
|
10
|
+
// ========================= Warn =========================
|
|
11
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
12
|
+
warning(!dateRender, "'dateRender' is deprecated. Please use 'cellRender' instead.");
|
|
13
|
+
warning(!monthCellRender, "'monthCellRender' is deprecated. Please use 'cellRender' instead.");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// ======================== Render ========================
|
|
17
|
+
// Merged render
|
|
18
|
+
var mergedCellRender = React.useMemo(function () {
|
|
19
|
+
if (cellRender) {
|
|
20
|
+
return cellRender;
|
|
21
|
+
}
|
|
22
|
+
return function (current, info) {
|
|
23
|
+
var date = current;
|
|
24
|
+
if (dateRender && info.type === 'date') {
|
|
25
|
+
return dateRender(date, info.today);
|
|
26
|
+
}
|
|
27
|
+
if (monthCellRender && info.type === 'month') {
|
|
28
|
+
return monthCellRender(date, info.locale);
|
|
29
|
+
}
|
|
30
|
+
return info.originNode;
|
|
31
|
+
};
|
|
32
|
+
}, [cellRender, monthCellRender, dateRender]);
|
|
33
|
+
|
|
34
|
+
// Cell render
|
|
35
|
+
var onInternalCellRender = React.useCallback(function (date, info) {
|
|
36
|
+
return mergedCellRender(date, _objectSpread(_objectSpread({}, info), {}, {
|
|
37
|
+
range: range
|
|
38
|
+
}));
|
|
39
|
+
}, [mergedCellRender, range]);
|
|
40
|
+
return onInternalCellRender;
|
|
41
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Will be `true` immediately for next effect.
|
|
3
|
+
* But will be `false` for a delay of effect.
|
|
4
|
+
*/
|
|
5
|
+
export default function useDelayState<T>(value: T, defaultValue?: T, onChange?: (next: T) => void): [state: T, setState: (nextState: T, immediately?: boolean) => void];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useEvent, useMergedState } from '@rc-component/util';
|
|
8
|
+
import raf from "@rc-component/util/es/raf";
|
|
9
|
+
import React from 'react';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Will be `true` immediately for next effect.
|
|
13
|
+
* But will be `false` for a delay of effect.
|
|
14
|
+
*/
|
|
15
|
+
export default function useDelayState(value, defaultValue, onChange) {
|
|
16
|
+
var _useMergedState = useMergedState(defaultValue, {
|
|
17
|
+
value: value
|
|
18
|
+
}),
|
|
19
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
20
|
+
state = _useMergedState2[0],
|
|
21
|
+
setState = _useMergedState2[1];
|
|
22
|
+
var nextValueRef = React.useRef(value);
|
|
23
|
+
|
|
24
|
+
// ============================= Update =============================
|
|
25
|
+
var rafRef = React.useRef();
|
|
26
|
+
var cancelRaf = function cancelRaf() {
|
|
27
|
+
raf.cancel(rafRef.current);
|
|
28
|
+
};
|
|
29
|
+
var doUpdate = useEvent(function () {
|
|
30
|
+
setState(nextValueRef.current);
|
|
31
|
+
if (onChange && state !== nextValueRef.current) {
|
|
32
|
+
onChange(nextValueRef.current);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
var updateValue = useEvent(function (next, immediately) {
|
|
36
|
+
cancelRaf();
|
|
37
|
+
nextValueRef.current = next;
|
|
38
|
+
if (next || immediately) {
|
|
39
|
+
doUpdate();
|
|
40
|
+
} else {
|
|
41
|
+
rafRef.current = raf(doUpdate);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
React.useEffect(function () {
|
|
45
|
+
return cancelRaf;
|
|
46
|
+
}, []);
|
|
47
|
+
return [state, updateValue];
|
|
48
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GenerateConfig } from '../../generate';
|
|
2
|
+
import type { DisabledDate, InternalMode, Locale } from '../../interface';
|
|
3
|
+
export type IsInvalidBoundary<DateType> = (currentDate: DateType, type: InternalMode, fromDate?: DateType) => boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Merge `disabledDate` with `minDate` & `maxDate`.
|
|
6
|
+
*/
|
|
7
|
+
export default function useDisabledBoundary<DateType extends object = any>(generateConfig: GenerateConfig<DateType>, locale: Locale, disabledDate?: DisabledDate<DateType>, minDate?: DateType, maxDate?: DateType): DisabledDate<DateType>;
|