@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,324 @@
|
|
|
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 = void 0;
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _util = require("@rc-component/util");
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _useLocale = _interopRequireDefault(require("../hooks/useLocale"));
|
|
12
|
+
var _useTimeConfig = require("../hooks/useTimeConfig");
|
|
13
|
+
var _useToggleDates = _interopRequireDefault(require("../hooks/useToggleDates"));
|
|
14
|
+
var _context = _interopRequireDefault(require("../PickerInput/context"));
|
|
15
|
+
var _useCellRender = _interopRequireDefault(require("../PickerInput/hooks/useCellRender"));
|
|
16
|
+
var _dateUtil = require("../utils/dateUtil");
|
|
17
|
+
var _miscUtil = require("../utils/miscUtil");
|
|
18
|
+
var _context2 = require("./context");
|
|
19
|
+
var _DatePanel = _interopRequireDefault(require("./DatePanel"));
|
|
20
|
+
var _DateTimePanel = _interopRequireDefault(require("./DateTimePanel"));
|
|
21
|
+
var _DecadePanel = _interopRequireDefault(require("./DecadePanel"));
|
|
22
|
+
var _MonthPanel = _interopRequireDefault(require("./MonthPanel"));
|
|
23
|
+
var _QuarterPanel = _interopRequireDefault(require("./QuarterPanel"));
|
|
24
|
+
var _TimePanel = _interopRequireDefault(require("./TimePanel"));
|
|
25
|
+
var _WeekPanel = _interopRequireDefault(require("./WeekPanel"));
|
|
26
|
+
var _YearPanel = _interopRequireDefault(require("./YearPanel"));
|
|
27
|
+
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); }
|
|
28
|
+
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; }
|
|
29
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
+
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); }
|
|
31
|
+
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; }
|
|
32
|
+
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; }
|
|
33
|
+
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; }
|
|
34
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
35
|
+
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); }
|
|
36
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
37
|
+
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."); }
|
|
38
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
39
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
40
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
41
|
+
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."); }
|
|
42
|
+
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); }
|
|
43
|
+
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; }
|
|
44
|
+
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; } }
|
|
45
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
46
|
+
var DefaultComponents = {
|
|
47
|
+
date: _DatePanel.default,
|
|
48
|
+
datetime: _DateTimePanel.default,
|
|
49
|
+
week: _WeekPanel.default,
|
|
50
|
+
month: _MonthPanel.default,
|
|
51
|
+
quarter: _QuarterPanel.default,
|
|
52
|
+
year: _YearPanel.default,
|
|
53
|
+
decade: _DecadePanel.default,
|
|
54
|
+
time: _TimePanel.default
|
|
55
|
+
};
|
|
56
|
+
function PickerPanel(props, ref) {
|
|
57
|
+
var _React$useContext;
|
|
58
|
+
var locale = props.locale,
|
|
59
|
+
generateConfig = props.generateConfig,
|
|
60
|
+
direction = props.direction,
|
|
61
|
+
prefixCls = props.prefixCls,
|
|
62
|
+
_props$tabIndex = props.tabIndex,
|
|
63
|
+
tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
|
|
64
|
+
multiple = props.multiple,
|
|
65
|
+
defaultValue = props.defaultValue,
|
|
66
|
+
value = props.value,
|
|
67
|
+
onChange = props.onChange,
|
|
68
|
+
onSelect = props.onSelect,
|
|
69
|
+
defaultPickerValue = props.defaultPickerValue,
|
|
70
|
+
pickerValue = props.pickerValue,
|
|
71
|
+
onPickerValueChange = props.onPickerValueChange,
|
|
72
|
+
mode = props.mode,
|
|
73
|
+
onPanelChange = props.onPanelChange,
|
|
74
|
+
_props$picker = props.picker,
|
|
75
|
+
picker = _props$picker === void 0 ? 'date' : _props$picker,
|
|
76
|
+
showTime = props.showTime,
|
|
77
|
+
hoverValue = props.hoverValue,
|
|
78
|
+
hoverRangeValue = props.hoverRangeValue,
|
|
79
|
+
cellRender = props.cellRender,
|
|
80
|
+
dateRender = props.dateRender,
|
|
81
|
+
monthCellRender = props.monthCellRender,
|
|
82
|
+
_props$components = props.components,
|
|
83
|
+
components = _props$components === void 0 ? {} : _props$components,
|
|
84
|
+
hideHeader = props.hideHeader;
|
|
85
|
+
var mergedPrefixCls = ((_React$useContext = React.useContext(_context.default)) === null || _React$useContext === void 0 ? void 0 : _React$useContext.prefixCls) || prefixCls || 'rc-picker';
|
|
86
|
+
|
|
87
|
+
// ========================== Refs ==========================
|
|
88
|
+
var rootRef = React.useRef();
|
|
89
|
+
React.useImperativeHandle(ref, function () {
|
|
90
|
+
return {
|
|
91
|
+
nativeElement: rootRef.current
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// ========================== Time ==========================
|
|
96
|
+
// Auto `format` need to check `showTime.showXXX` first.
|
|
97
|
+
// And then merge the `locale` into `mergedShowTime`.
|
|
98
|
+
var _getTimeProps = (0, _useTimeConfig.getTimeProps)(props),
|
|
99
|
+
_getTimeProps2 = _slicedToArray(_getTimeProps, 4),
|
|
100
|
+
timeProps = _getTimeProps2[0],
|
|
101
|
+
localeTimeProps = _getTimeProps2[1],
|
|
102
|
+
showTimeFormat = _getTimeProps2[2],
|
|
103
|
+
propFormat = _getTimeProps2[3];
|
|
104
|
+
|
|
105
|
+
// ========================= Locale =========================
|
|
106
|
+
var filledLocale = (0, _useLocale.default)(locale, localeTimeProps);
|
|
107
|
+
|
|
108
|
+
// ========================= Picker =========================
|
|
109
|
+
var internalPicker = picker === 'date' && showTime ? 'datetime' : picker;
|
|
110
|
+
|
|
111
|
+
// ======================== ShowTime ========================
|
|
112
|
+
var mergedShowTime = React.useMemo(function () {
|
|
113
|
+
return (0, _useTimeConfig.fillShowTimeConfig)(internalPicker, showTimeFormat, propFormat, timeProps, filledLocale);
|
|
114
|
+
}, [internalPicker, showTimeFormat, propFormat, timeProps, filledLocale]);
|
|
115
|
+
|
|
116
|
+
// ========================== Now ===========================
|
|
117
|
+
var now = generateConfig.getNow();
|
|
118
|
+
|
|
119
|
+
// ========================== Mode ==========================
|
|
120
|
+
var _useMergedState = (0, _util.useMergedState)(picker, {
|
|
121
|
+
value: mode,
|
|
122
|
+
postState: function postState(val) {
|
|
123
|
+
return val || 'date';
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
127
|
+
mergedMode = _useMergedState2[0],
|
|
128
|
+
setMergedMode = _useMergedState2[1];
|
|
129
|
+
var internalMode = mergedMode === 'date' && mergedShowTime ? 'datetime' : mergedMode;
|
|
130
|
+
|
|
131
|
+
// ========================= Toggle =========================
|
|
132
|
+
var toggleDates = (0, _useToggleDates.default)(generateConfig, locale, internalPicker);
|
|
133
|
+
|
|
134
|
+
// ========================= Value ==========================
|
|
135
|
+
// >>> Real value
|
|
136
|
+
// Interactive with `onChange` event which only trigger when the `mode` is `picker`
|
|
137
|
+
var _useMergedState3 = (0, _util.useMergedState)(defaultValue, {
|
|
138
|
+
value: value
|
|
139
|
+
}),
|
|
140
|
+
_useMergedState4 = _slicedToArray(_useMergedState3, 2),
|
|
141
|
+
innerValue = _useMergedState4[0],
|
|
142
|
+
setMergedValue = _useMergedState4[1];
|
|
143
|
+
var mergedValue = React.useMemo(function () {
|
|
144
|
+
// Clean up `[null]`
|
|
145
|
+
var values = (0, _miscUtil.toArray)(innerValue).filter(function (val) {
|
|
146
|
+
return val;
|
|
147
|
+
});
|
|
148
|
+
return multiple ? values : values.slice(0, 1);
|
|
149
|
+
}, [innerValue, multiple]);
|
|
150
|
+
|
|
151
|
+
// Sync value and only trigger onChange event when changed
|
|
152
|
+
var triggerChange = (0, _util.useEvent)(function (nextValue) {
|
|
153
|
+
setMergedValue(nextValue);
|
|
154
|
+
if (onChange && (nextValue === null || mergedValue.length !== nextValue.length || mergedValue.some(function (ori, index) {
|
|
155
|
+
return !(0, _dateUtil.isSame)(generateConfig, locale, ori, nextValue[index], internalPicker);
|
|
156
|
+
}))) {
|
|
157
|
+
onChange === null || onChange === void 0 || onChange(multiple ? nextValue : nextValue[0]);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// >>> CalendarValue
|
|
162
|
+
// CalendarValue is a temp value for user operation
|
|
163
|
+
// which will only trigger `onCalendarChange` but not `onChange`
|
|
164
|
+
var onInternalSelect = (0, _util.useEvent)(function (newDate) {
|
|
165
|
+
onSelect === null || onSelect === void 0 || onSelect(newDate);
|
|
166
|
+
if (mergedMode === picker) {
|
|
167
|
+
var nextValues = multiple ? toggleDates(mergedValue, newDate) : [newDate];
|
|
168
|
+
triggerChange(nextValues);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// >>> PickerValue
|
|
173
|
+
// PickerValue is used to control the current displaying panel
|
|
174
|
+
var _useMergedState5 = (0, _util.useMergedState)(defaultPickerValue || mergedValue[0] || now, {
|
|
175
|
+
value: pickerValue
|
|
176
|
+
}),
|
|
177
|
+
_useMergedState6 = _slicedToArray(_useMergedState5, 2),
|
|
178
|
+
mergedPickerValue = _useMergedState6[0],
|
|
179
|
+
setInternalPickerValue = _useMergedState6[1];
|
|
180
|
+
React.useEffect(function () {
|
|
181
|
+
if (mergedValue[0] && !pickerValue) {
|
|
182
|
+
setInternalPickerValue(mergedValue[0]);
|
|
183
|
+
}
|
|
184
|
+
}, [mergedValue[0]]);
|
|
185
|
+
|
|
186
|
+
// Both trigger when manually pickerValue or mode change
|
|
187
|
+
var triggerPanelChange = function triggerPanelChange(viewDate, nextMode) {
|
|
188
|
+
onPanelChange === null || onPanelChange === void 0 || onPanelChange(viewDate || pickerValue, nextMode || mergedMode);
|
|
189
|
+
};
|
|
190
|
+
var setPickerValue = function setPickerValue(nextPickerValue) {
|
|
191
|
+
var triggerPanelEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
192
|
+
setInternalPickerValue(nextPickerValue);
|
|
193
|
+
onPickerValueChange === null || onPickerValueChange === void 0 || onPickerValueChange(nextPickerValue);
|
|
194
|
+
if (triggerPanelEvent) {
|
|
195
|
+
triggerPanelChange(nextPickerValue);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
var triggerModeChange = function triggerModeChange(nextMode, viewDate) {
|
|
199
|
+
setMergedMode(nextMode);
|
|
200
|
+
if (viewDate) {
|
|
201
|
+
setPickerValue(viewDate);
|
|
202
|
+
}
|
|
203
|
+
triggerPanelChange(viewDate, nextMode);
|
|
204
|
+
};
|
|
205
|
+
var onPanelValueSelect = function onPanelValueSelect(nextValue) {
|
|
206
|
+
onInternalSelect(nextValue);
|
|
207
|
+
setPickerValue(nextValue);
|
|
208
|
+
|
|
209
|
+
// Update mode if needed
|
|
210
|
+
if (mergedMode !== picker) {
|
|
211
|
+
var decadeYearQueue = ['decade', 'year'];
|
|
212
|
+
var decadeYearMonthQueue = [].concat(decadeYearQueue, ['month']);
|
|
213
|
+
var pickerQueue = {
|
|
214
|
+
quarter: [].concat(decadeYearQueue, ['quarter']),
|
|
215
|
+
week: [].concat(_toConsumableArray(decadeYearMonthQueue), ['week']),
|
|
216
|
+
date: [].concat(_toConsumableArray(decadeYearMonthQueue), ['date'])
|
|
217
|
+
};
|
|
218
|
+
var queue = pickerQueue[picker] || decadeYearMonthQueue;
|
|
219
|
+
var index = queue.indexOf(mergedMode);
|
|
220
|
+
var nextMode = queue[index + 1];
|
|
221
|
+
if (nextMode) {
|
|
222
|
+
triggerModeChange(nextMode, nextValue);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// ======================= Hover Date =======================
|
|
228
|
+
var hoverRangeDate = React.useMemo(function () {
|
|
229
|
+
var start;
|
|
230
|
+
var end;
|
|
231
|
+
if (Array.isArray(hoverRangeValue)) {
|
|
232
|
+
var _hoverRangeValue = _slicedToArray(hoverRangeValue, 2);
|
|
233
|
+
start = _hoverRangeValue[0];
|
|
234
|
+
end = _hoverRangeValue[1];
|
|
235
|
+
} else {
|
|
236
|
+
start = hoverRangeValue;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Return for not exist
|
|
240
|
+
if (!start && !end) {
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Fill if has empty
|
|
245
|
+
start = start || end;
|
|
246
|
+
end = end || start;
|
|
247
|
+
return generateConfig.isAfter(start, end) ? [end, start] : [start, end];
|
|
248
|
+
}, [hoverRangeValue, generateConfig]);
|
|
249
|
+
|
|
250
|
+
// ======================= Components =======================
|
|
251
|
+
// >>> cellRender
|
|
252
|
+
var onInternalCellRender = (0, _useCellRender.default)(cellRender, dateRender, monthCellRender);
|
|
253
|
+
|
|
254
|
+
// ======================= Components =======================
|
|
255
|
+
var PanelComponent = components[internalMode] || DefaultComponents[internalMode] || _DatePanel.default;
|
|
256
|
+
|
|
257
|
+
// ======================== Context =========================
|
|
258
|
+
var parentHackContext = React.useContext(_context2.PickerHackContext);
|
|
259
|
+
var pickerPanelContext = React.useMemo(function () {
|
|
260
|
+
return _objectSpread(_objectSpread({}, parentHackContext), {}, {
|
|
261
|
+
hideHeader: hideHeader
|
|
262
|
+
});
|
|
263
|
+
}, [parentHackContext, hideHeader]);
|
|
264
|
+
|
|
265
|
+
// ======================== Warnings ========================
|
|
266
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
267
|
+
(0, _util.warning)(!mergedValue || mergedValue.every(function (val) {
|
|
268
|
+
return generateConfig.isValidate(val);
|
|
269
|
+
}), 'Invalidate date pass to `value` or `defaultValue`.');
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// ========================= Render =========================
|
|
273
|
+
var panelCls = "".concat(mergedPrefixCls, "-panel");
|
|
274
|
+
var panelProps = (0, _miscUtil.pickProps)(props, [
|
|
275
|
+
// Week
|
|
276
|
+
'showWeek',
|
|
277
|
+
// Icons
|
|
278
|
+
'prevIcon', 'nextIcon', 'superPrevIcon', 'superNextIcon',
|
|
279
|
+
// Disabled
|
|
280
|
+
'disabledDate', 'minDate', 'maxDate',
|
|
281
|
+
// Hover
|
|
282
|
+
'onHover']);
|
|
283
|
+
return /*#__PURE__*/React.createElement(_context2.PickerHackContext.Provider, {
|
|
284
|
+
value: pickerPanelContext
|
|
285
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
286
|
+
ref: rootRef,
|
|
287
|
+
tabIndex: tabIndex,
|
|
288
|
+
className: (0, _classnames.default)(panelCls, _defineProperty({}, "".concat(panelCls, "-rtl"), direction === 'rtl'))
|
|
289
|
+
}, /*#__PURE__*/React.createElement(PanelComponent, _extends({}, panelProps, {
|
|
290
|
+
// Time
|
|
291
|
+
showTime: mergedShowTime
|
|
292
|
+
// MISC
|
|
293
|
+
,
|
|
294
|
+
prefixCls: mergedPrefixCls,
|
|
295
|
+
locale: filledLocale,
|
|
296
|
+
generateConfig: generateConfig
|
|
297
|
+
// Mode
|
|
298
|
+
,
|
|
299
|
+
onModeChange: triggerModeChange
|
|
300
|
+
// Value
|
|
301
|
+
,
|
|
302
|
+
pickerValue: mergedPickerValue,
|
|
303
|
+
onPickerValueChange: function onPickerValueChange(nextPickerValue) {
|
|
304
|
+
setPickerValue(nextPickerValue, true);
|
|
305
|
+
},
|
|
306
|
+
value: mergedValue[0],
|
|
307
|
+
onSelect: onPanelValueSelect,
|
|
308
|
+
values: mergedValue
|
|
309
|
+
// Render
|
|
310
|
+
,
|
|
311
|
+
cellRender: onInternalCellRender
|
|
312
|
+
// Hover
|
|
313
|
+
,
|
|
314
|
+
hoverRangeValue: hoverRangeDate,
|
|
315
|
+
hoverValue: hoverValue
|
|
316
|
+
}))));
|
|
317
|
+
}
|
|
318
|
+
var RefPanelPicker = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(PickerPanel));
|
|
319
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
320
|
+
RefPanelPicker.displayName = 'PanelPicker';
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Make support generic
|
|
324
|
+
var _default = exports.default = RefPanelPicker;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AlignType, BuildInPlacements } from '@rc-component/trigger/lib/interface';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export type PickerTriggerProps = {
|
|
4
|
+
popupElement: React.ReactElement;
|
|
5
|
+
popupStyle?: React.CSSProperties;
|
|
6
|
+
children: React.ReactElement;
|
|
7
|
+
transitionName?: string;
|
|
8
|
+
getPopupContainer?: (node: HTMLElement) => HTMLElement;
|
|
9
|
+
popupAlign?: AlignType;
|
|
10
|
+
range?: boolean;
|
|
11
|
+
popupClassName?: string;
|
|
12
|
+
placement?: string;
|
|
13
|
+
builtinPlacements?: BuildInPlacements;
|
|
14
|
+
direction?: 'ltr' | 'rtl';
|
|
15
|
+
visible: boolean;
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
};
|
|
18
|
+
declare function PickerTrigger({ popupElement, popupStyle, popupClassName, popupAlign, transitionName, getPopupContainer, children, range, placement, builtinPlacements, direction, visible, onClose, }: PickerTriggerProps): React.JSX.Element;
|
|
19
|
+
export default PickerTrigger;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _trigger = _interopRequireDefault(require("@rc-component/trigger"));
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _uiUtil = require("../utils/uiUtil");
|
|
11
|
+
var _context = _interopRequireDefault(require("../PickerInput/context"));
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
18
|
+
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); }
|
|
19
|
+
var BUILT_IN_PLACEMENTS = {
|
|
20
|
+
bottomLeft: {
|
|
21
|
+
points: ['tl', 'bl'],
|
|
22
|
+
offset: [0, 4],
|
|
23
|
+
overflow: {
|
|
24
|
+
adjustX: 1,
|
|
25
|
+
adjustY: 1
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
bottomRight: {
|
|
29
|
+
points: ['tr', 'br'],
|
|
30
|
+
offset: [0, 4],
|
|
31
|
+
overflow: {
|
|
32
|
+
adjustX: 1,
|
|
33
|
+
adjustY: 1
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
topLeft: {
|
|
37
|
+
points: ['bl', 'tl'],
|
|
38
|
+
offset: [0, -4],
|
|
39
|
+
overflow: {
|
|
40
|
+
adjustX: 0,
|
|
41
|
+
adjustY: 1
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
topRight: {
|
|
45
|
+
points: ['br', 'tr'],
|
|
46
|
+
offset: [0, -4],
|
|
47
|
+
overflow: {
|
|
48
|
+
adjustX: 0,
|
|
49
|
+
adjustY: 1
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
function PickerTrigger(_ref) {
|
|
54
|
+
var popupElement = _ref.popupElement,
|
|
55
|
+
popupStyle = _ref.popupStyle,
|
|
56
|
+
popupClassName = _ref.popupClassName,
|
|
57
|
+
popupAlign = _ref.popupAlign,
|
|
58
|
+
transitionName = _ref.transitionName,
|
|
59
|
+
getPopupContainer = _ref.getPopupContainer,
|
|
60
|
+
children = _ref.children,
|
|
61
|
+
range = _ref.range,
|
|
62
|
+
placement = _ref.placement,
|
|
63
|
+
_ref$builtinPlacement = _ref.builtinPlacements,
|
|
64
|
+
builtinPlacements = _ref$builtinPlacement === void 0 ? BUILT_IN_PLACEMENTS : _ref$builtinPlacement,
|
|
65
|
+
direction = _ref.direction,
|
|
66
|
+
visible = _ref.visible,
|
|
67
|
+
onClose = _ref.onClose;
|
|
68
|
+
var _React$useContext = React.useContext(_context.default),
|
|
69
|
+
prefixCls = _React$useContext.prefixCls;
|
|
70
|
+
var dropdownPrefixCls = "".concat(prefixCls, "-dropdown");
|
|
71
|
+
var realPlacement = (0, _uiUtil.getRealPlacement)(placement, direction === 'rtl');
|
|
72
|
+
return /*#__PURE__*/React.createElement(_trigger.default, {
|
|
73
|
+
showAction: [],
|
|
74
|
+
hideAction: ['click'],
|
|
75
|
+
popupPlacement: realPlacement,
|
|
76
|
+
builtinPlacements: builtinPlacements,
|
|
77
|
+
prefixCls: dropdownPrefixCls,
|
|
78
|
+
popupMotion: {
|
|
79
|
+
motionName: transitionName
|
|
80
|
+
},
|
|
81
|
+
popup: popupElement,
|
|
82
|
+
popupAlign: popupAlign,
|
|
83
|
+
popupVisible: visible,
|
|
84
|
+
popupClassName: (0, _classnames.default)(popupClassName, _defineProperty(_defineProperty({}, "".concat(dropdownPrefixCls, "-range"), range), "".concat(dropdownPrefixCls, "-rtl"), direction === 'rtl')),
|
|
85
|
+
popupStyle: popupStyle,
|
|
86
|
+
stretch: "minWidth",
|
|
87
|
+
getPopupContainer: getPopupContainer,
|
|
88
|
+
onPopupVisibleChange: function onPopupVisibleChange(nextVisible) {
|
|
89
|
+
if (!nextVisible) {
|
|
90
|
+
onClose();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, children);
|
|
94
|
+
}
|
|
95
|
+
var _default = exports.default = PickerTrigger;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.pickTriggerProps = pickTriggerProps;
|
|
7
|
+
var _miscUtil = require("../utils/miscUtil");
|
|
8
|
+
function pickTriggerProps(props) {
|
|
9
|
+
return (0, _miscUtil.pickProps)(props, ['placement', 'builtinPlacements', 'popupAlign', 'getPopupContainer', 'transitionName', 'direction']);
|
|
10
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
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 = void 0;
|
|
8
|
+
var _dateFns = require("date-fns");
|
|
9
|
+
var locales = _interopRequireWildcard(require("date-fns/locale"));
|
|
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
|
+
var getLocale = function getLocale(locale) {
|
|
13
|
+
return locales[locale] || locales[locale.replace(/_/g, '')] || locales[locale.replace(/_.*$/g, '')];
|
|
14
|
+
};
|
|
15
|
+
var localeParse = function localeParse(format) {
|
|
16
|
+
return format.replace(/Y/g, 'y').replace(/D/g, 'd').replace(/gggg/, 'yyyy').replace(/g/g, 'G').replace(/([Ww])o/g, 'wo');
|
|
17
|
+
};
|
|
18
|
+
var _parse = function parse(text, format, locale) {
|
|
19
|
+
return (0, _dateFns.parse)(text, localeParse(format), new Date(), {
|
|
20
|
+
locale: getLocale(locale)
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Check if the text is a valid date considering the format and locale
|
|
26
|
+
*
|
|
27
|
+
* This is a strict check, the date string must match the format exactly.
|
|
28
|
+
* Date-fns allows some flexibility in parsing dates, for example, it will parse "30/01/2" as "30/01/002".
|
|
29
|
+
* This behavior is not desirable in our case, so we need to check if the date string matches the format exactly.
|
|
30
|
+
*
|
|
31
|
+
* @param text the date string
|
|
32
|
+
* @param format the date format to use
|
|
33
|
+
* @param locale the locale to use
|
|
34
|
+
*/
|
|
35
|
+
var isStrictValidDate = function isStrictValidDate(text, format, locale) {
|
|
36
|
+
var date = _parse(text, format, locale);
|
|
37
|
+
if (!(0, _dateFns.isValid)(date)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
var formattedDate = (0, _dateFns.format)(date, format, {
|
|
41
|
+
locale: getLocale(locale)
|
|
42
|
+
});
|
|
43
|
+
return text === formattedDate;
|
|
44
|
+
};
|
|
45
|
+
var generateConfig = {
|
|
46
|
+
// get
|
|
47
|
+
getNow: function getNow() {
|
|
48
|
+
return new Date();
|
|
49
|
+
},
|
|
50
|
+
getFixedDate: function getFixedDate(string) {
|
|
51
|
+
return new Date(string);
|
|
52
|
+
},
|
|
53
|
+
getEndDate: function getEndDate(date) {
|
|
54
|
+
return (0, _dateFns.endOfMonth)(date);
|
|
55
|
+
},
|
|
56
|
+
getWeekDay: function getWeekDay(date) {
|
|
57
|
+
return (0, _dateFns.getDay)(date);
|
|
58
|
+
},
|
|
59
|
+
getYear: function getYear(date) {
|
|
60
|
+
return (0, _dateFns.getYear)(date);
|
|
61
|
+
},
|
|
62
|
+
getMonth: function getMonth(date) {
|
|
63
|
+
return (0, _dateFns.getMonth)(date);
|
|
64
|
+
},
|
|
65
|
+
getDate: function getDate(date) {
|
|
66
|
+
return (0, _dateFns.getDate)(date);
|
|
67
|
+
},
|
|
68
|
+
getHour: function getHour(date) {
|
|
69
|
+
return (0, _dateFns.getHours)(date);
|
|
70
|
+
},
|
|
71
|
+
getMinute: function getMinute(date) {
|
|
72
|
+
return (0, _dateFns.getMinutes)(date);
|
|
73
|
+
},
|
|
74
|
+
getSecond: function getSecond(date) {
|
|
75
|
+
return (0, _dateFns.getSeconds)(date);
|
|
76
|
+
},
|
|
77
|
+
getMillisecond: function getMillisecond(date) {
|
|
78
|
+
return (0, _dateFns.getMilliseconds)(date);
|
|
79
|
+
},
|
|
80
|
+
// set
|
|
81
|
+
addYear: function addYear(date, diff) {
|
|
82
|
+
return (0, _dateFns.addYears)(date, diff);
|
|
83
|
+
},
|
|
84
|
+
addMonth: function addMonth(date, diff) {
|
|
85
|
+
return (0, _dateFns.addMonths)(date, diff);
|
|
86
|
+
},
|
|
87
|
+
addDate: function addDate(date, diff) {
|
|
88
|
+
return (0, _dateFns.addDays)(date, diff);
|
|
89
|
+
},
|
|
90
|
+
setYear: function setYear(date, year) {
|
|
91
|
+
return (0, _dateFns.setYear)(date, year);
|
|
92
|
+
},
|
|
93
|
+
setMonth: function setMonth(date, month) {
|
|
94
|
+
return (0, _dateFns.setMonth)(date, month);
|
|
95
|
+
},
|
|
96
|
+
setDate: function setDate(date, num) {
|
|
97
|
+
return (0, _dateFns.setDate)(date, num);
|
|
98
|
+
},
|
|
99
|
+
setHour: function setHour(date, hour) {
|
|
100
|
+
return (0, _dateFns.setHours)(date, hour);
|
|
101
|
+
},
|
|
102
|
+
setMinute: function setMinute(date, minute) {
|
|
103
|
+
return (0, _dateFns.setMinutes)(date, minute);
|
|
104
|
+
},
|
|
105
|
+
setSecond: function setSecond(date, second) {
|
|
106
|
+
return (0, _dateFns.setSeconds)(date, second);
|
|
107
|
+
},
|
|
108
|
+
setMillisecond: function setMillisecond(date, millisecond) {
|
|
109
|
+
return (0, _dateFns.setMilliseconds)(date, millisecond);
|
|
110
|
+
},
|
|
111
|
+
// Compare
|
|
112
|
+
isAfter: function isAfter(date1, date2) {
|
|
113
|
+
return (0, _dateFns.isAfter)(date1, date2);
|
|
114
|
+
},
|
|
115
|
+
isValidate: function isValidate(date) {
|
|
116
|
+
return (0, _dateFns.isValid)(date);
|
|
117
|
+
},
|
|
118
|
+
locale: {
|
|
119
|
+
getWeekFirstDay: function getWeekFirstDay(locale) {
|
|
120
|
+
var clone = getLocale(locale);
|
|
121
|
+
return clone.options.weekStartsOn;
|
|
122
|
+
},
|
|
123
|
+
getWeekFirstDate: function getWeekFirstDate(locale, date) {
|
|
124
|
+
return (0, _dateFns.startOfWeek)(date, {
|
|
125
|
+
locale: getLocale(locale)
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
getWeek: function getWeek(locale, date) {
|
|
129
|
+
return (0, _dateFns.getWeek)(date, {
|
|
130
|
+
locale: getLocale(locale)
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
getShortWeekDays: function getShortWeekDays(locale) {
|
|
134
|
+
var clone = getLocale(locale);
|
|
135
|
+
return Array.from({
|
|
136
|
+
length: 7
|
|
137
|
+
}).map(function (_, i) {
|
|
138
|
+
return clone.localize.day(i, {
|
|
139
|
+
width: 'short'
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
getShortMonths: function getShortMonths(locale) {
|
|
144
|
+
var clone = getLocale(locale);
|
|
145
|
+
return Array.from({
|
|
146
|
+
length: 12
|
|
147
|
+
}).map(function (_, i) {
|
|
148
|
+
return clone.localize.month(i, {
|
|
149
|
+
width: 'abbreviated'
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
format: function format(locale, date, _format) {
|
|
154
|
+
if (!(0, _dateFns.isValid)(date)) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
return (0, _dateFns.format)(date, localeParse(_format), {
|
|
158
|
+
locale: getLocale(locale)
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
parse: function parse(locale, text, formats) {
|
|
162
|
+
for (var i = 0; i < formats.length; i += 1) {
|
|
163
|
+
var format = localeParse(formats[i]);
|
|
164
|
+
if (isStrictValidDate(text, format, locale)) {
|
|
165
|
+
return _parse(text, format, locale);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
var _default = exports.default = generateConfig;
|