@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,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useDelayState;
|
|
7
|
+
var _util = require("@rc-component/util");
|
|
8
|
+
var _raf = _interopRequireDefault(require("@rc-component/util/lib/raf"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
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."); }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
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; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
/**
|
|
18
|
+
* Will be `true` immediately for next effect.
|
|
19
|
+
* But will be `false` for a delay of effect.
|
|
20
|
+
*/
|
|
21
|
+
function useDelayState(value, defaultValue, onChange) {
|
|
22
|
+
var _useMergedState = (0, _util.useMergedState)(defaultValue, {
|
|
23
|
+
value: value
|
|
24
|
+
}),
|
|
25
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
26
|
+
state = _useMergedState2[0],
|
|
27
|
+
setState = _useMergedState2[1];
|
|
28
|
+
var nextValueRef = _react.default.useRef(value);
|
|
29
|
+
|
|
30
|
+
// ============================= Update =============================
|
|
31
|
+
var rafRef = _react.default.useRef();
|
|
32
|
+
var cancelRaf = function cancelRaf() {
|
|
33
|
+
_raf.default.cancel(rafRef.current);
|
|
34
|
+
};
|
|
35
|
+
var doUpdate = (0, _util.useEvent)(function () {
|
|
36
|
+
setState(nextValueRef.current);
|
|
37
|
+
if (onChange && state !== nextValueRef.current) {
|
|
38
|
+
onChange(nextValueRef.current);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
var updateValue = (0, _util.useEvent)(function (next, immediately) {
|
|
42
|
+
cancelRaf();
|
|
43
|
+
nextValueRef.current = next;
|
|
44
|
+
if (next || immediately) {
|
|
45
|
+
doUpdate();
|
|
46
|
+
} else {
|
|
47
|
+
rafRef.current = (0, _raf.default)(doUpdate);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
_react.default.useEffect(function () {
|
|
51
|
+
return cancelRaf;
|
|
52
|
+
}, []);
|
|
53
|
+
return [state, updateValue];
|
|
54
|
+
}
|
|
@@ -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>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useDisabledBoundary;
|
|
7
|
+
var _util = require("@rc-component/util");
|
|
8
|
+
var _dateUtil = require("../../utils/dateUtil");
|
|
9
|
+
/**
|
|
10
|
+
* Merge `disabledDate` with `minDate` & `maxDate`.
|
|
11
|
+
*/
|
|
12
|
+
function useDisabledBoundary(generateConfig, locale, disabledDate, minDate, maxDate) {
|
|
13
|
+
var mergedDisabledDate = (0, _util.useEvent)(function (date, info) {
|
|
14
|
+
if (disabledDate && disabledDate(date, info)) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (minDate && generateConfig.isAfter(minDate, date) && !(0, _dateUtil.isSame)(generateConfig, locale, minDate, date, info.type)) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
if (maxDate && generateConfig.isAfter(date, maxDate) && !(0, _dateUtil.isSame)(generateConfig, locale, maxDate, date, info.type)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
});
|
|
25
|
+
return mergedDisabledDate;
|
|
26
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { FormatType, InternalMode, Locale, SharedPickerProps } from '../../interface';
|
|
2
|
+
export declare function useFieldFormat<DateType = any>(picker: InternalMode, locale: Locale, format?: SharedPickerProps['format']): [formatList: FormatType<DateType>[], maskFormat?: string];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useFieldFormat = useFieldFormat;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _miscUtil = require("../../utils/miscUtil");
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
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); }
|
|
12
|
+
function useFieldFormat(picker, locale, format) {
|
|
13
|
+
return React.useMemo(function () {
|
|
14
|
+
var rawFormat = (0, _miscUtil.getRowFormat)(picker, locale, format);
|
|
15
|
+
var formatList = (0, _miscUtil.toArray)(rawFormat);
|
|
16
|
+
var firstFormat = formatList[0];
|
|
17
|
+
var maskFormat = _typeof(firstFormat) === 'object' && firstFormat.type === 'mask' ? firstFormat.format : null;
|
|
18
|
+
return [
|
|
19
|
+
// Format list
|
|
20
|
+
formatList.map(function (config) {
|
|
21
|
+
return typeof config === 'string' || typeof config === 'function' ? config : config.format;
|
|
22
|
+
}),
|
|
23
|
+
// Mask Format
|
|
24
|
+
maskFormat];
|
|
25
|
+
}, [picker, locale, format]);
|
|
26
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type useInvalidate from './useInvalidate';
|
|
2
|
+
/**
|
|
3
|
+
* Used to control each fields invalidate status
|
|
4
|
+
*/
|
|
5
|
+
export default function useFieldsInvalidate<DateType extends object, ValueType extends DateType[]>(calendarValue: ValueType, isInvalidateDate: ReturnType<typeof useInvalidate<DateType>>, allowEmpty?: boolean[]): readonly [[boolean, boolean], (invalid: boolean, index: number) => void];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = useFieldsInvalidate;
|
|
8
|
+
var _miscUtil = require("../../utils/miscUtil");
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
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
|
+
/**
|
|
19
|
+
* Used to control each fields invalidate status
|
|
20
|
+
*/
|
|
21
|
+
function useFieldsInvalidate(calendarValue, isInvalidateDate) {
|
|
22
|
+
var allowEmpty = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
23
|
+
var _React$useState = React.useState([false, false]),
|
|
24
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
25
|
+
fieldsInvalidates = _React$useState2[0],
|
|
26
|
+
setFieldsInvalidates = _React$useState2[1];
|
|
27
|
+
var onSelectorInvalid = function onSelectorInvalid(invalid, index) {
|
|
28
|
+
setFieldsInvalidates(function (ori) {
|
|
29
|
+
return (0, _miscUtil.fillIndex)(ori, index, invalid);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* For the Selector Input to mark as `aria-disabled`
|
|
35
|
+
*/
|
|
36
|
+
var submitInvalidates = React.useMemo(function () {
|
|
37
|
+
return fieldsInvalidates.map(function (invalid, index) {
|
|
38
|
+
// If typing invalidate
|
|
39
|
+
if (invalid) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
var current = calendarValue[index];
|
|
43
|
+
|
|
44
|
+
// Not check if all empty
|
|
45
|
+
if (!current) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Not allow empty
|
|
50
|
+
if (!allowEmpty[index] && !current) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Invalidate
|
|
55
|
+
if (current && isInvalidateDate(current, {
|
|
56
|
+
activeIndex: index
|
|
57
|
+
})) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
});
|
|
62
|
+
}, [calendarValue, fieldsInvalidates, isInvalidateDate, allowEmpty]);
|
|
63
|
+
return [submitInvalidates, onSelectorInvalid];
|
|
64
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { FormatType, InternalMode, PickerMode } from '../../interface';
|
|
2
|
+
import type { RangePickerProps } from '../RangePicker';
|
|
3
|
+
import useInvalidate from './useInvalidate';
|
|
4
|
+
type UseInvalidate<DateType extends object = any> = typeof useInvalidate<DateType>;
|
|
5
|
+
type PickedProps<DateType extends object = any> = Pick<RangePickerProps<DateType>, 'generateConfig' | 'locale' | 'picker' | 'prefixCls' | 'styles' | 'classNames' | 'order' | 'components' | 'inputRender' | 'clearIcon' | 'allowClear' | 'needConfirm' | 'format' | 'inputReadOnly' | 'disabledDate' | 'minDate' | 'maxDate' | 'defaultOpenValue'> & {
|
|
6
|
+
multiple?: boolean;
|
|
7
|
+
showTime?: any;
|
|
8
|
+
value?: any;
|
|
9
|
+
defaultValue?: any;
|
|
10
|
+
pickerValue?: any;
|
|
11
|
+
defaultPickerValue?: any;
|
|
12
|
+
};
|
|
13
|
+
type ExcludeBooleanType<T> = T extends boolean ? never : T;
|
|
14
|
+
type GetGeneric<T> = T extends PickedProps<infer U> ? U : never;
|
|
15
|
+
type ToArrayType<T, DateType> = T extends any[] ? T : DateType[];
|
|
16
|
+
/**
|
|
17
|
+
* Align the outer props with unique typed and fill undefined props.
|
|
18
|
+
* This is shared with both RangePicker and Picker. This will do:
|
|
19
|
+
* - Convert `value` & `defaultValue` to array
|
|
20
|
+
* - handle the legacy props fill like `clearIcon` + `allowClear` = `clearIcon`
|
|
21
|
+
*/
|
|
22
|
+
export default function useFilledProps<InProps extends PickedProps, DateType extends GetGeneric<InProps>, UpdaterProps extends object>(props: InProps, updater?: () => UpdaterProps): [
|
|
23
|
+
filledProps: Omit<InProps, keyof UpdaterProps | 'showTime' | 'value' | 'defaultValue'> & UpdaterProps & {
|
|
24
|
+
picker: PickerMode;
|
|
25
|
+
showTime?: ExcludeBooleanType<InProps['showTime']>;
|
|
26
|
+
value?: ToArrayType<InProps['value'], DateType>;
|
|
27
|
+
defaultValue?: ToArrayType<InProps['value'], DateType>;
|
|
28
|
+
pickerValue?: ToArrayType<InProps['value'], DateType>;
|
|
29
|
+
defaultPickerValue?: ToArrayType<InProps['value'], DateType>;
|
|
30
|
+
},
|
|
31
|
+
internalPicker: InternalMode,
|
|
32
|
+
complexPicker: boolean,
|
|
33
|
+
formatList: FormatType<DateType>[],
|
|
34
|
+
maskFormat: string,
|
|
35
|
+
isInvalidateDate: ReturnType<UseInvalidate<DateType>>
|
|
36
|
+
];
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = useFilledProps;
|
|
8
|
+
var _util = require("@rc-component/util");
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _useLocale = _interopRequireDefault(require("../../hooks/useLocale"));
|
|
11
|
+
var _useTimeConfig = require("../../hooks/useTimeConfig");
|
|
12
|
+
var _miscUtil = require("../../utils/miscUtil");
|
|
13
|
+
var _useClearIcon = require("../Selector/hooks/useClearIcon");
|
|
14
|
+
var _useDisabledBoundary = _interopRequireDefault(require("./useDisabledBoundary"));
|
|
15
|
+
var _useFieldFormat3 = require("./useFieldFormat");
|
|
16
|
+
var _useInputReadOnly = _interopRequireDefault(require("./useInputReadOnly"));
|
|
17
|
+
var _useInvalidate = _interopRequireDefault(require("./useInvalidate"));
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
|
+
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); }
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
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."); }
|
|
28
|
+
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); }
|
|
29
|
+
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; }
|
|
30
|
+
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; } }
|
|
31
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
+
function useList(value) {
|
|
33
|
+
var fillMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
34
|
+
var values = React.useMemo(function () {
|
|
35
|
+
var list = value ? (0, _miscUtil.toArray)(value) : value;
|
|
36
|
+
if (fillMode && list) {
|
|
37
|
+
list[1] = list[1] || list[0];
|
|
38
|
+
}
|
|
39
|
+
return list;
|
|
40
|
+
}, [value, fillMode]);
|
|
41
|
+
return values;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Align the outer props with unique typed and fill undefined props.
|
|
46
|
+
* This is shared with both RangePicker and Picker. This will do:
|
|
47
|
+
* - Convert `value` & `defaultValue` to array
|
|
48
|
+
* - handle the legacy props fill like `clearIcon` + `allowClear` = `clearIcon`
|
|
49
|
+
*/
|
|
50
|
+
function useFilledProps(props, updater) {
|
|
51
|
+
var generateConfig = props.generateConfig,
|
|
52
|
+
locale = props.locale,
|
|
53
|
+
_props$picker = props.picker,
|
|
54
|
+
picker = _props$picker === void 0 ? 'date' : _props$picker,
|
|
55
|
+
_props$prefixCls = props.prefixCls,
|
|
56
|
+
prefixCls = _props$prefixCls === void 0 ? 'rc-picker' : _props$prefixCls,
|
|
57
|
+
_props$styles = props.styles,
|
|
58
|
+
styles = _props$styles === void 0 ? {} : _props$styles,
|
|
59
|
+
_props$classNames = props.classNames,
|
|
60
|
+
classNames = _props$classNames === void 0 ? {} : _props$classNames,
|
|
61
|
+
_props$order = props.order,
|
|
62
|
+
order = _props$order === void 0 ? true : _props$order,
|
|
63
|
+
_props$components = props.components,
|
|
64
|
+
components = _props$components === void 0 ? {} : _props$components,
|
|
65
|
+
inputRender = props.inputRender,
|
|
66
|
+
allowClear = props.allowClear,
|
|
67
|
+
clearIcon = props.clearIcon,
|
|
68
|
+
needConfirm = props.needConfirm,
|
|
69
|
+
multiple = props.multiple,
|
|
70
|
+
format = props.format,
|
|
71
|
+
inputReadOnly = props.inputReadOnly,
|
|
72
|
+
disabledDate = props.disabledDate,
|
|
73
|
+
minDate = props.minDate,
|
|
74
|
+
maxDate = props.maxDate,
|
|
75
|
+
showTime = props.showTime,
|
|
76
|
+
value = props.value,
|
|
77
|
+
defaultValue = props.defaultValue,
|
|
78
|
+
pickerValue = props.pickerValue,
|
|
79
|
+
defaultPickerValue = props.defaultPickerValue;
|
|
80
|
+
var values = useList(value);
|
|
81
|
+
var defaultValues = useList(defaultValue);
|
|
82
|
+
var pickerValues = useList(pickerValue);
|
|
83
|
+
var defaultPickerValues = useList(defaultPickerValue);
|
|
84
|
+
|
|
85
|
+
// ======================== Picker ========================
|
|
86
|
+
/** Almost same as `picker`, but add `datetime` for `date` with `showTime` */
|
|
87
|
+
var internalPicker = picker === 'date' && showTime ? 'datetime' : picker;
|
|
88
|
+
|
|
89
|
+
/** The picker is `datetime` or `time` */
|
|
90
|
+
var multipleInteractivePicker = internalPicker === 'time' || internalPicker === 'datetime';
|
|
91
|
+
var complexPicker = multipleInteractivePicker || multiple;
|
|
92
|
+
var mergedNeedConfirm = needConfirm !== null && needConfirm !== void 0 ? needConfirm : multipleInteractivePicker;
|
|
93
|
+
|
|
94
|
+
// ========================== Time ==========================
|
|
95
|
+
// Auto `format` need to check `showTime.showXXX` first.
|
|
96
|
+
// And then merge the `locale` into `mergedShowTime`.
|
|
97
|
+
var _getTimeProps = (0, _useTimeConfig.getTimeProps)(props),
|
|
98
|
+
_getTimeProps2 = _slicedToArray(_getTimeProps, 4),
|
|
99
|
+
timeProps = _getTimeProps2[0],
|
|
100
|
+
localeTimeProps = _getTimeProps2[1],
|
|
101
|
+
showTimeFormat = _getTimeProps2[2],
|
|
102
|
+
propFormat = _getTimeProps2[3];
|
|
103
|
+
|
|
104
|
+
// ======================= Locales ========================
|
|
105
|
+
var mergedLocale = (0, _useLocale.default)(locale, localeTimeProps);
|
|
106
|
+
var mergedShowTime = React.useMemo(function () {
|
|
107
|
+
return (0, _useTimeConfig.fillShowTimeConfig)(internalPicker, showTimeFormat, propFormat, timeProps, mergedLocale);
|
|
108
|
+
}, [internalPicker, showTimeFormat, propFormat, timeProps, mergedLocale]);
|
|
109
|
+
|
|
110
|
+
// ======================= Warning ========================
|
|
111
|
+
if (process.env.NODE_ENV !== 'production' && picker === 'time') {
|
|
112
|
+
if (['disabledHours', 'disabledMinutes', 'disabledSeconds'].some(function (key) {
|
|
113
|
+
return props[key];
|
|
114
|
+
})) {
|
|
115
|
+
(0, _util.warning)(false, "'disabledHours', 'disabledMinutes', 'disabledSeconds' will be removed in the next major version, please use 'disabledTime' instead.");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// ======================== Props =========================
|
|
120
|
+
var filledProps = React.useMemo(function () {
|
|
121
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
122
|
+
prefixCls: prefixCls,
|
|
123
|
+
locale: mergedLocale,
|
|
124
|
+
picker: picker,
|
|
125
|
+
styles: styles,
|
|
126
|
+
classNames: classNames,
|
|
127
|
+
order: order,
|
|
128
|
+
components: _objectSpread({
|
|
129
|
+
input: inputRender
|
|
130
|
+
}, components),
|
|
131
|
+
clearIcon: (0, _useClearIcon.fillClearIcon)(prefixCls, allowClear, clearIcon),
|
|
132
|
+
showTime: mergedShowTime,
|
|
133
|
+
value: values,
|
|
134
|
+
defaultValue: defaultValues,
|
|
135
|
+
pickerValue: pickerValues,
|
|
136
|
+
defaultPickerValue: defaultPickerValues
|
|
137
|
+
}, updater === null || updater === void 0 ? void 0 : updater());
|
|
138
|
+
}, [props]);
|
|
139
|
+
|
|
140
|
+
// ======================== Format ========================
|
|
141
|
+
var _useFieldFormat = (0, _useFieldFormat3.useFieldFormat)(internalPicker, mergedLocale, format),
|
|
142
|
+
_useFieldFormat2 = _slicedToArray(_useFieldFormat, 2),
|
|
143
|
+
formatList = _useFieldFormat2[0],
|
|
144
|
+
maskFormat = _useFieldFormat2[1];
|
|
145
|
+
|
|
146
|
+
// ======================= ReadOnly =======================
|
|
147
|
+
var mergedInputReadOnly = (0, _useInputReadOnly.default)(formatList, inputReadOnly, multiple);
|
|
148
|
+
|
|
149
|
+
// ======================= Boundary =======================
|
|
150
|
+
var disabledBoundaryDate = (0, _useDisabledBoundary.default)(generateConfig, locale, disabledDate, minDate, maxDate);
|
|
151
|
+
|
|
152
|
+
// ====================== Invalidate ======================
|
|
153
|
+
var isInvalidateDate = (0, _useInvalidate.default)(generateConfig, picker, disabledBoundaryDate, mergedShowTime);
|
|
154
|
+
|
|
155
|
+
// ======================== Merged ========================
|
|
156
|
+
var mergedProps = React.useMemo(function () {
|
|
157
|
+
return _objectSpread(_objectSpread({}, filledProps), {}, {
|
|
158
|
+
needConfirm: mergedNeedConfirm,
|
|
159
|
+
inputReadOnly: mergedInputReadOnly,
|
|
160
|
+
disabledDate: disabledBoundaryDate
|
|
161
|
+
});
|
|
162
|
+
}, [filledProps, mergedNeedConfirm, mergedInputReadOnly, disabledBoundaryDate]);
|
|
163
|
+
return [mergedProps, internalPicker, complexPicker, formatList, maskFormat, isInvalidateDate];
|
|
164
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useInputReadOnly;
|
|
7
|
+
function useInputReadOnly(formatList, inputReadOnly, multiple) {
|
|
8
|
+
if (typeof formatList[0] === 'function' || multiple) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
return inputReadOnly;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GenerateConfig } from '../../generate';
|
|
2
|
+
import type { PanelMode, RangeTimeProps, SharedPickerProps, SharedTimeProps } from '../../interface';
|
|
3
|
+
/**
|
|
4
|
+
* Check if provided date is valid for the `disabledDate` & `showTime.disabledTime`.
|
|
5
|
+
*/
|
|
6
|
+
export default function useInvalidate<DateType extends object = any>(generateConfig: GenerateConfig<DateType>, picker: PanelMode, disabledDate?: SharedPickerProps<DateType>['disabledDate'], showTime?: SharedTimeProps<DateType> | RangeTimeProps<DateType>): (date: DateType, info?: {
|
|
7
|
+
from?: DateType;
|
|
8
|
+
activeIndex: number;
|
|
9
|
+
}) => boolean;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useInvalidate;
|
|
7
|
+
var _util = require("@rc-component/util");
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
|
+
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); }
|
|
14
|
+
/**
|
|
15
|
+
* Check if provided date is valid for the `disabledDate` & `showTime.disabledTime`.
|
|
16
|
+
*/
|
|
17
|
+
function useInvalidate(generateConfig, picker, disabledDate, showTime) {
|
|
18
|
+
// Check disabled date
|
|
19
|
+
var isInvalidate = (0, _util.useEvent)(function (date, info) {
|
|
20
|
+
var outsideInfo = _objectSpread({
|
|
21
|
+
type: picker
|
|
22
|
+
}, info);
|
|
23
|
+
delete outsideInfo.activeIndex;
|
|
24
|
+
if (
|
|
25
|
+
// Date object is invalid
|
|
26
|
+
!generateConfig.isValidate(date) ||
|
|
27
|
+
// Date is disabled by `disabledDate`
|
|
28
|
+
disabledDate && disabledDate(date, outsideInfo)) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
if ((picker === 'date' || picker === 'time') && showTime) {
|
|
32
|
+
var _showTime$disabledTim;
|
|
33
|
+
var range = info && info.activeIndex === 1 ? 'end' : 'start';
|
|
34
|
+
var _ref = ((_showTime$disabledTim = showTime.disabledTime) === null || _showTime$disabledTim === void 0 ? void 0 : _showTime$disabledTim.call(showTime, date, range, {
|
|
35
|
+
from: outsideInfo.from
|
|
36
|
+
})) || {},
|
|
37
|
+
disabledHours = _ref.disabledHours,
|
|
38
|
+
disabledMinutes = _ref.disabledMinutes,
|
|
39
|
+
disabledSeconds = _ref.disabledSeconds,
|
|
40
|
+
disabledMilliseconds = _ref.disabledMilliseconds;
|
|
41
|
+
var legacyDisabledHours = showTime.disabledHours,
|
|
42
|
+
legacyDisabledMinutes = showTime.disabledMinutes,
|
|
43
|
+
legacyDisabledSeconds = showTime.disabledSeconds;
|
|
44
|
+
var mergedDisabledHours = disabledHours || legacyDisabledHours;
|
|
45
|
+
var mergedDisabledMinutes = disabledMinutes || legacyDisabledMinutes;
|
|
46
|
+
var mergedDisabledSeconds = disabledSeconds || legacyDisabledSeconds;
|
|
47
|
+
var hour = generateConfig.getHour(date);
|
|
48
|
+
var minute = generateConfig.getMinute(date);
|
|
49
|
+
var second = generateConfig.getSecond(date);
|
|
50
|
+
var millisecond = generateConfig.getMillisecond(date);
|
|
51
|
+
if (mergedDisabledHours && mergedDisabledHours().includes(hour)) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (mergedDisabledMinutes && mergedDisabledMinutes(hour).includes(minute)) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
if (mergedDisabledSeconds && mergedDisabledSeconds(hour, minute).includes(second)) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
if (disabledMilliseconds && disabledMilliseconds(hour, minute, second).includes(millisecond)) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
});
|
|
66
|
+
return isInvalidate;
|
|
67
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = useLockEffect;
|
|
8
|
+
var _useLayoutEffect = require("@rc-component/util/lib/hooks/useLayoutEffect");
|
|
9
|
+
var _raf = _interopRequireDefault(require("@rc-component/util/lib/raf"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
/**
|
|
15
|
+
* Trigger `callback` immediately when `condition` is `true`.
|
|
16
|
+
* But trigger `callback` in next frame when `condition` is `false`.
|
|
17
|
+
*/
|
|
18
|
+
function useLockEffect(condition, callback) {
|
|
19
|
+
var delayFrames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
20
|
+
var callbackRef = React.useRef(callback);
|
|
21
|
+
callbackRef.current = callback;
|
|
22
|
+
(0, _useLayoutEffect.useLayoutUpdateEffect)(function () {
|
|
23
|
+
if (condition) {
|
|
24
|
+
callbackRef.current(condition);
|
|
25
|
+
} else {
|
|
26
|
+
var id = (0, _raf.default)(function () {
|
|
27
|
+
callbackRef.current(condition);
|
|
28
|
+
}, delayFrames);
|
|
29
|
+
return function () {
|
|
30
|
+
_raf.default.cancel(id);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}, [condition]);
|
|
34
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OpenConfig } from '../../interface';
|
|
2
|
+
/**
|
|
3
|
+
* Control the open state.
|
|
4
|
+
* Will not close if activeElement is on the popup.
|
|
5
|
+
*/
|
|
6
|
+
export default function useOpen(open?: boolean, defaultOpen?: boolean, disabledList?: boolean[], onOpenChange?: (open: boolean) => void): [open: boolean, setOpen: (open: boolean, config?: OpenConfig) => void];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useOpen;
|
|
7
|
+
var _useDelayState3 = _interopRequireDefault(require("./useDelayState"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
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."); }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
/**
|
|
16
|
+
* Control the open state.
|
|
17
|
+
* Will not close if activeElement is on the popup.
|
|
18
|
+
*/
|
|
19
|
+
function useOpen(open, defaultOpen) {
|
|
20
|
+
var disabledList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
21
|
+
var onOpenChange = arguments.length > 3 ? arguments[3] : undefined;
|
|
22
|
+
var mergedOpen = disabledList.every(function (disabled) {
|
|
23
|
+
return disabled;
|
|
24
|
+
}) ? false : open;
|
|
25
|
+
|
|
26
|
+
// Delay for handle the open state, in case fast shift from `open` -> `close` -> `open`
|
|
27
|
+
// const [rafOpen, setRafOpen] = useLockState(open, defaultOpen || false, onOpenChange);
|
|
28
|
+
var _useDelayState = (0, _useDelayState3.default)(mergedOpen, defaultOpen || false, onOpenChange),
|
|
29
|
+
_useDelayState2 = _slicedToArray(_useDelayState, 2),
|
|
30
|
+
rafOpen = _useDelayState2[0],
|
|
31
|
+
setRafOpen = _useDelayState2[1];
|
|
32
|
+
function setOpen(next) {
|
|
33
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
34
|
+
if (!config.inherit || rafOpen) {
|
|
35
|
+
setRafOpen(next, config.force);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return [rafOpen, setOpen];
|
|
39
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PickerRef } from '../../interface';
|
|
3
|
+
type PickerRefType<OptionType> = Omit<PickerRef, 'focus'> & {
|
|
4
|
+
focus: (options?: OptionType) => void;
|
|
5
|
+
};
|
|
6
|
+
export default function usePickerRef<OptionType>(ref: React.Ref<PickerRefType<OptionType>>): React.MutableRefObject<PickerRefType<OptionType>>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = usePickerRef;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
function usePickerRef(ref) {
|
|
12
|
+
var selectorRef = React.useRef();
|
|
13
|
+
React.useImperativeHandle(ref, function () {
|
|
14
|
+
var _selectorRef$current;
|
|
15
|
+
return {
|
|
16
|
+
nativeElement: (_selectorRef$current = selectorRef.current) === null || _selectorRef$current === void 0 ? void 0 : _selectorRef$current.nativeElement,
|
|
17
|
+
focus: function focus(options) {
|
|
18
|
+
var _selectorRef$current2;
|
|
19
|
+
(_selectorRef$current2 = selectorRef.current) === null || _selectorRef$current2 === void 0 || _selectorRef$current2.focus(options);
|
|
20
|
+
},
|
|
21
|
+
blur: function blur() {
|
|
22
|
+
var _selectorRef$current3;
|
|
23
|
+
(_selectorRef$current3 = selectorRef.current) === null || _selectorRef$current3 === void 0 || _selectorRef$current3.blur();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
return selectorRef;
|
|
28
|
+
}
|