@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,122 @@
|
|
|
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 = DecadePanel;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _dateUtil = require("../../utils/dateUtil");
|
|
10
|
+
var _context = require("../context");
|
|
11
|
+
var _PanelBody = _interopRequireDefault(require("../PanelBody"));
|
|
12
|
+
var _PanelHeader = _interopRequireDefault(require("../PanelHeader"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
+
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); }
|
|
20
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
+
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."); }
|
|
22
|
+
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); }
|
|
23
|
+
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; }
|
|
24
|
+
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; } }
|
|
25
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
+
function DecadePanel(props) {
|
|
27
|
+
var prefixCls = props.prefixCls,
|
|
28
|
+
locale = props.locale,
|
|
29
|
+
generateConfig = props.generateConfig,
|
|
30
|
+
pickerValue = props.pickerValue,
|
|
31
|
+
disabledDate = props.disabledDate,
|
|
32
|
+
onPickerValueChange = props.onPickerValueChange;
|
|
33
|
+
var panelPrefixCls = "".concat(prefixCls, "-decade-panel");
|
|
34
|
+
|
|
35
|
+
// ========================== Base ==========================
|
|
36
|
+
var _useInfo = (0, _context.useInfo)(props, 'decade'),
|
|
37
|
+
_useInfo2 = _slicedToArray(_useInfo, 1),
|
|
38
|
+
info = _useInfo2[0];
|
|
39
|
+
var getStartYear = function getStartYear(date) {
|
|
40
|
+
var startYear = Math.floor(generateConfig.getYear(date) / 100) * 100;
|
|
41
|
+
return generateConfig.setYear(date, startYear);
|
|
42
|
+
};
|
|
43
|
+
var getEndYear = function getEndYear(date) {
|
|
44
|
+
var startYear = getStartYear(date);
|
|
45
|
+
return generateConfig.addYear(startYear, 99);
|
|
46
|
+
};
|
|
47
|
+
var startYearDate = getStartYear(pickerValue);
|
|
48
|
+
var endYearDate = getEndYear(pickerValue);
|
|
49
|
+
var baseDate = generateConfig.addYear(startYearDate, -10);
|
|
50
|
+
|
|
51
|
+
// ========================= Cells ==========================
|
|
52
|
+
var getCellDate = function getCellDate(date, offset) {
|
|
53
|
+
return generateConfig.addYear(date, offset * 10);
|
|
54
|
+
};
|
|
55
|
+
var getCellText = function getCellText(date) {
|
|
56
|
+
var cellYearFormat = locale.cellYearFormat;
|
|
57
|
+
var startYearStr = (0, _dateUtil.formatValue)(date, {
|
|
58
|
+
locale: locale,
|
|
59
|
+
format: cellYearFormat,
|
|
60
|
+
generateConfig: generateConfig
|
|
61
|
+
});
|
|
62
|
+
var endYearStr = (0, _dateUtil.formatValue)(generateConfig.addYear(date, 9), {
|
|
63
|
+
locale: locale,
|
|
64
|
+
format: cellYearFormat,
|
|
65
|
+
generateConfig: generateConfig
|
|
66
|
+
});
|
|
67
|
+
return "".concat(startYearStr, "-").concat(endYearStr);
|
|
68
|
+
};
|
|
69
|
+
var getCellClassName = function getCellClassName(date) {
|
|
70
|
+
return _defineProperty({}, "".concat(prefixCls, "-cell-in-view"), (0, _dateUtil.isSameDecade)(generateConfig, date, startYearDate) || (0, _dateUtil.isSameDecade)(generateConfig, date, endYearDate) || (0, _dateUtil.isInRange)(generateConfig, startYearDate, endYearDate, date));
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// ======================== Disabled ========================
|
|
74
|
+
var mergedDisabledDate = disabledDate ? function (currentDate, disabledInfo) {
|
|
75
|
+
// Start
|
|
76
|
+
var baseStartDate = generateConfig.setDate(currentDate, 1);
|
|
77
|
+
var baseStartMonth = generateConfig.setMonth(baseStartDate, 0);
|
|
78
|
+
var baseStartYear = generateConfig.setYear(baseStartMonth, Math.floor(generateConfig.getYear(baseStartMonth) / 10) * 10);
|
|
79
|
+
|
|
80
|
+
// End
|
|
81
|
+
var baseEndYear = generateConfig.addYear(baseStartYear, 10);
|
|
82
|
+
var baseEndDate = generateConfig.addDate(baseEndYear, -1);
|
|
83
|
+
return disabledDate(baseStartYear, disabledInfo) && disabledDate(baseEndDate, disabledInfo);
|
|
84
|
+
} : null;
|
|
85
|
+
|
|
86
|
+
// ========================= Header =========================
|
|
87
|
+
var yearNode = "".concat((0, _dateUtil.formatValue)(startYearDate, {
|
|
88
|
+
locale: locale,
|
|
89
|
+
format: locale.yearFormat,
|
|
90
|
+
generateConfig: generateConfig
|
|
91
|
+
}), "-").concat((0, _dateUtil.formatValue)(endYearDate, {
|
|
92
|
+
locale: locale,
|
|
93
|
+
format: locale.yearFormat,
|
|
94
|
+
generateConfig: generateConfig
|
|
95
|
+
}));
|
|
96
|
+
|
|
97
|
+
// ========================= Render =========================
|
|
98
|
+
return /*#__PURE__*/React.createElement(_context.PanelContext.Provider, {
|
|
99
|
+
value: info
|
|
100
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: panelPrefixCls
|
|
102
|
+
}, /*#__PURE__*/React.createElement(_PanelHeader.default, {
|
|
103
|
+
superOffset: function superOffset(distance) {
|
|
104
|
+
return generateConfig.addYear(pickerValue, distance * 100);
|
|
105
|
+
},
|
|
106
|
+
onChange: onPickerValueChange
|
|
107
|
+
// Limitation
|
|
108
|
+
,
|
|
109
|
+
getStart: getStartYear,
|
|
110
|
+
getEnd: getEndYear
|
|
111
|
+
}, yearNode), /*#__PURE__*/React.createElement(_PanelBody.default, _extends({}, props, {
|
|
112
|
+
disabledDate: mergedDisabledDate,
|
|
113
|
+
colNum: 3,
|
|
114
|
+
rowNum: 4,
|
|
115
|
+
baseDate: baseDate
|
|
116
|
+
// Body
|
|
117
|
+
,
|
|
118
|
+
getCellDate: getCellDate,
|
|
119
|
+
getCellText: getCellText,
|
|
120
|
+
getCellClassName: getCellClassName
|
|
121
|
+
}))));
|
|
122
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
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 = MonthPanel;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _dateUtil = require("../../utils/dateUtil");
|
|
10
|
+
var _context = require("../context");
|
|
11
|
+
var _PanelBody = _interopRequireDefault(require("../PanelBody"));
|
|
12
|
+
var _PanelHeader = _interopRequireDefault(require("../PanelHeader"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
+
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); }
|
|
20
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
+
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."); }
|
|
22
|
+
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); }
|
|
23
|
+
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; }
|
|
24
|
+
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; } }
|
|
25
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
+
function MonthPanel(props) {
|
|
27
|
+
var prefixCls = props.prefixCls,
|
|
28
|
+
locale = props.locale,
|
|
29
|
+
generateConfig = props.generateConfig,
|
|
30
|
+
pickerValue = props.pickerValue,
|
|
31
|
+
disabledDate = props.disabledDate,
|
|
32
|
+
onPickerValueChange = props.onPickerValueChange,
|
|
33
|
+
onModeChange = props.onModeChange;
|
|
34
|
+
var panelPrefixCls = "".concat(prefixCls, "-month-panel");
|
|
35
|
+
|
|
36
|
+
// ========================== Base ==========================
|
|
37
|
+
var _useInfo = (0, _context.useInfo)(props, 'month'),
|
|
38
|
+
_useInfo2 = _slicedToArray(_useInfo, 1),
|
|
39
|
+
info = _useInfo2[0];
|
|
40
|
+
var baseDate = generateConfig.setMonth(pickerValue, 0);
|
|
41
|
+
|
|
42
|
+
// ========================= Month ==========================
|
|
43
|
+
var monthsLocale = locale.shortMonths || (generateConfig.locale.getShortMonths ? generateConfig.locale.getShortMonths(locale.locale) : []);
|
|
44
|
+
|
|
45
|
+
// ========================= Cells ==========================
|
|
46
|
+
var getCellDate = function getCellDate(date, offset) {
|
|
47
|
+
return generateConfig.addMonth(date, offset);
|
|
48
|
+
};
|
|
49
|
+
var getCellText = function getCellText(date) {
|
|
50
|
+
var month = generateConfig.getMonth(date);
|
|
51
|
+
return locale.monthFormat ? (0, _dateUtil.formatValue)(date, {
|
|
52
|
+
locale: locale,
|
|
53
|
+
format: locale.monthFormat,
|
|
54
|
+
generateConfig: generateConfig
|
|
55
|
+
}) : monthsLocale[month];
|
|
56
|
+
};
|
|
57
|
+
var getCellClassName = function getCellClassName() {
|
|
58
|
+
return _defineProperty({}, "".concat(prefixCls, "-cell-in-view"), true);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// ======================== Disabled ========================
|
|
62
|
+
var mergedDisabledDate = disabledDate ? function (currentDate, disabledInfo) {
|
|
63
|
+
var startDate = generateConfig.setDate(currentDate, 1);
|
|
64
|
+
var nextMonthStartDate = generateConfig.setMonth(startDate, generateConfig.getMonth(startDate) + 1);
|
|
65
|
+
var endDate = generateConfig.addDate(nextMonthStartDate, -1);
|
|
66
|
+
return disabledDate(startDate, disabledInfo) && disabledDate(endDate, disabledInfo);
|
|
67
|
+
} : null;
|
|
68
|
+
|
|
69
|
+
// ========================= Header =========================
|
|
70
|
+
var yearNode = /*#__PURE__*/React.createElement("button", {
|
|
71
|
+
type: "button",
|
|
72
|
+
key: "year",
|
|
73
|
+
"aria-label": locale.yearSelect,
|
|
74
|
+
onClick: function onClick() {
|
|
75
|
+
onModeChange('year');
|
|
76
|
+
},
|
|
77
|
+
tabIndex: -1,
|
|
78
|
+
className: "".concat(prefixCls, "-year-btn")
|
|
79
|
+
}, (0, _dateUtil.formatValue)(pickerValue, {
|
|
80
|
+
locale: locale,
|
|
81
|
+
format: locale.yearFormat,
|
|
82
|
+
generateConfig: generateConfig
|
|
83
|
+
}));
|
|
84
|
+
|
|
85
|
+
// ========================= Render =========================
|
|
86
|
+
return /*#__PURE__*/React.createElement(_context.PanelContext.Provider, {
|
|
87
|
+
value: info
|
|
88
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
className: panelPrefixCls
|
|
90
|
+
}, /*#__PURE__*/React.createElement(_PanelHeader.default, {
|
|
91
|
+
superOffset: function superOffset(distance) {
|
|
92
|
+
return generateConfig.addYear(pickerValue, distance);
|
|
93
|
+
},
|
|
94
|
+
onChange: onPickerValueChange
|
|
95
|
+
// Limitation
|
|
96
|
+
,
|
|
97
|
+
getStart: function getStart(date) {
|
|
98
|
+
return generateConfig.setMonth(date, 0);
|
|
99
|
+
},
|
|
100
|
+
getEnd: function getEnd(date) {
|
|
101
|
+
return generateConfig.setMonth(date, 11);
|
|
102
|
+
}
|
|
103
|
+
}, yearNode), /*#__PURE__*/React.createElement(_PanelBody.default, _extends({}, props, {
|
|
104
|
+
disabledDate: mergedDisabledDate,
|
|
105
|
+
titleFormat: locale.fieldMonthFormat,
|
|
106
|
+
colNum: 3,
|
|
107
|
+
rowNum: 4,
|
|
108
|
+
baseDate: baseDate
|
|
109
|
+
// Body
|
|
110
|
+
,
|
|
111
|
+
getCellDate: getCellDate,
|
|
112
|
+
getCellText: getCellText,
|
|
113
|
+
getCellClassName: getCellClassName
|
|
114
|
+
}))));
|
|
115
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { DisabledDate } from '../interface';
|
|
3
|
+
export interface PanelBodyProps<DateType = any> {
|
|
4
|
+
rowNum: number;
|
|
5
|
+
colNum: number;
|
|
6
|
+
baseDate: DateType;
|
|
7
|
+
titleFormat?: string;
|
|
8
|
+
getCellDate: (date: DateType, offset: number) => DateType;
|
|
9
|
+
getCellText: (date: DateType) => React.ReactNode;
|
|
10
|
+
getCellClassName: (date: DateType) => Record<string, any>;
|
|
11
|
+
disabledDate?: DisabledDate<DateType>;
|
|
12
|
+
headerCells?: React.ReactNode[];
|
|
13
|
+
prefixColumn?: (date: DateType) => React.ReactNode;
|
|
14
|
+
rowClassName?: (date: DateType) => string;
|
|
15
|
+
cellSelection?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export default function PanelBody<DateType extends object = any>(props: PanelBodyProps<DateType>): React.JSX.Element;
|
|
@@ -0,0 +1,162 @@
|
|
|
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 = PanelBody;
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _dateUtil = require("../utils/dateUtil");
|
|
11
|
+
var _context = require("./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 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; }
|
|
16
|
+
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; }
|
|
17
|
+
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; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
+
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); }
|
|
20
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
+
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."); }
|
|
22
|
+
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); }
|
|
23
|
+
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; }
|
|
24
|
+
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; } }
|
|
25
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
+
function PanelBody(props) {
|
|
27
|
+
var rowNum = props.rowNum,
|
|
28
|
+
colNum = props.colNum,
|
|
29
|
+
baseDate = props.baseDate,
|
|
30
|
+
getCellDate = props.getCellDate,
|
|
31
|
+
prefixColumn = props.prefixColumn,
|
|
32
|
+
rowClassName = props.rowClassName,
|
|
33
|
+
titleFormat = props.titleFormat,
|
|
34
|
+
getCellText = props.getCellText,
|
|
35
|
+
getCellClassName = props.getCellClassName,
|
|
36
|
+
headerCells = props.headerCells,
|
|
37
|
+
_props$cellSelection = props.cellSelection,
|
|
38
|
+
cellSelection = _props$cellSelection === void 0 ? true : _props$cellSelection,
|
|
39
|
+
disabledDate = props.disabledDate;
|
|
40
|
+
var _usePanelContext = (0, _context.usePanelContext)(),
|
|
41
|
+
prefixCls = _usePanelContext.prefixCls,
|
|
42
|
+
type = _usePanelContext.panelType,
|
|
43
|
+
now = _usePanelContext.now,
|
|
44
|
+
contextDisabledDate = _usePanelContext.disabledDate,
|
|
45
|
+
cellRender = _usePanelContext.cellRender,
|
|
46
|
+
onHover = _usePanelContext.onHover,
|
|
47
|
+
hoverValue = _usePanelContext.hoverValue,
|
|
48
|
+
hoverRangeValue = _usePanelContext.hoverRangeValue,
|
|
49
|
+
generateConfig = _usePanelContext.generateConfig,
|
|
50
|
+
values = _usePanelContext.values,
|
|
51
|
+
locale = _usePanelContext.locale,
|
|
52
|
+
onSelect = _usePanelContext.onSelect;
|
|
53
|
+
var mergedDisabledDate = disabledDate || contextDisabledDate;
|
|
54
|
+
var cellPrefixCls = "".concat(prefixCls, "-cell");
|
|
55
|
+
|
|
56
|
+
// ============================= Context ==============================
|
|
57
|
+
var _React$useContext = React.useContext(_context.PickerHackContext),
|
|
58
|
+
onCellDblClick = _React$useContext.onCellDblClick;
|
|
59
|
+
|
|
60
|
+
// ============================== Value ===============================
|
|
61
|
+
var matchValues = function matchValues(date) {
|
|
62
|
+
return values.some(function (singleValue) {
|
|
63
|
+
return singleValue && (0, _dateUtil.isSame)(generateConfig, locale, date, singleValue, type);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// =============================== Body ===============================
|
|
68
|
+
var rows = [];
|
|
69
|
+
for (var row = 0; row < rowNum; row += 1) {
|
|
70
|
+
var rowNode = [];
|
|
71
|
+
var rowStartDate = void 0;
|
|
72
|
+
var _loop = function _loop() {
|
|
73
|
+
var offset = row * colNum + col;
|
|
74
|
+
var currentDate = getCellDate(baseDate, offset);
|
|
75
|
+
var disabled = mergedDisabledDate === null || mergedDisabledDate === void 0 ? void 0 : mergedDisabledDate(currentDate, {
|
|
76
|
+
type: type
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Row Start Cell
|
|
80
|
+
if (col === 0) {
|
|
81
|
+
rowStartDate = currentDate;
|
|
82
|
+
if (prefixColumn) {
|
|
83
|
+
rowNode.push(prefixColumn(rowStartDate));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Range
|
|
88
|
+
var inRange = false;
|
|
89
|
+
var rangeStart = false;
|
|
90
|
+
var rangeEnd = false;
|
|
91
|
+
if (cellSelection && hoverRangeValue) {
|
|
92
|
+
var _hoverRangeValue = _slicedToArray(hoverRangeValue, 2),
|
|
93
|
+
hoverStart = _hoverRangeValue[0],
|
|
94
|
+
hoverEnd = _hoverRangeValue[1];
|
|
95
|
+
inRange = (0, _dateUtil.isInRange)(generateConfig, hoverStart, hoverEnd, currentDate);
|
|
96
|
+
rangeStart = (0, _dateUtil.isSame)(generateConfig, locale, currentDate, hoverStart, type);
|
|
97
|
+
rangeEnd = (0, _dateUtil.isSame)(generateConfig, locale, currentDate, hoverEnd, type);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Title
|
|
101
|
+
var title = titleFormat ? (0, _dateUtil.formatValue)(currentDate, {
|
|
102
|
+
locale: locale,
|
|
103
|
+
format: titleFormat,
|
|
104
|
+
generateConfig: generateConfig
|
|
105
|
+
}) : undefined;
|
|
106
|
+
|
|
107
|
+
// Render
|
|
108
|
+
var inner = /*#__PURE__*/React.createElement("div", {
|
|
109
|
+
className: "".concat(cellPrefixCls, "-inner")
|
|
110
|
+
}, getCellText(currentDate));
|
|
111
|
+
rowNode.push( /*#__PURE__*/React.createElement("td", {
|
|
112
|
+
key: col,
|
|
113
|
+
title: title,
|
|
114
|
+
className: (0, _classnames.default)(cellPrefixCls, _objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(cellPrefixCls, "-disabled"), disabled), "".concat(cellPrefixCls, "-hover"), (hoverValue || []).some(function (date) {
|
|
115
|
+
return (0, _dateUtil.isSame)(generateConfig, locale, currentDate, date, type);
|
|
116
|
+
})), "".concat(cellPrefixCls, "-in-range"), inRange && !rangeStart && !rangeEnd), "".concat(cellPrefixCls, "-range-start"), rangeStart), "".concat(cellPrefixCls, "-range-end"), rangeEnd), "".concat(prefixCls, "-cell-selected"), !hoverRangeValue &&
|
|
117
|
+
// WeekPicker use row instead
|
|
118
|
+
type !== 'week' && matchValues(currentDate)), getCellClassName(currentDate))),
|
|
119
|
+
onClick: function onClick() {
|
|
120
|
+
if (!disabled) {
|
|
121
|
+
onSelect(currentDate);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
onDoubleClick: function onDoubleClick() {
|
|
125
|
+
if (!disabled && onCellDblClick) {
|
|
126
|
+
onCellDblClick();
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
onMouseEnter: function onMouseEnter() {
|
|
130
|
+
if (!disabled) {
|
|
131
|
+
onHover === null || onHover === void 0 || onHover(currentDate);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
onMouseLeave: function onMouseLeave() {
|
|
135
|
+
if (!disabled) {
|
|
136
|
+
onHover === null || onHover === void 0 || onHover(null);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}, cellRender ? cellRender(currentDate, {
|
|
140
|
+
prefixCls: prefixCls,
|
|
141
|
+
originNode: inner,
|
|
142
|
+
today: now,
|
|
143
|
+
type: type,
|
|
144
|
+
locale: locale
|
|
145
|
+
}) : inner));
|
|
146
|
+
};
|
|
147
|
+
for (var col = 0; col < colNum; col += 1) {
|
|
148
|
+
_loop();
|
|
149
|
+
}
|
|
150
|
+
rows.push( /*#__PURE__*/React.createElement("tr", {
|
|
151
|
+
key: row,
|
|
152
|
+
className: rowClassName === null || rowClassName === void 0 ? void 0 : rowClassName(rowStartDate)
|
|
153
|
+
}, rowNode));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// ============================== Render ==============================
|
|
157
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
158
|
+
className: "".concat(prefixCls, "-body")
|
|
159
|
+
}, /*#__PURE__*/React.createElement("table", {
|
|
160
|
+
className: "".concat(prefixCls, "-content")
|
|
161
|
+
}, headerCells && /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, headerCells)), /*#__PURE__*/React.createElement("tbody", null, rows)));
|
|
162
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface HeaderProps<DateType extends object> {
|
|
3
|
+
offset?: (distance: number, date: DateType) => DateType;
|
|
4
|
+
superOffset?: (distance: number, date: DateType) => DateType;
|
|
5
|
+
onChange?: (date: DateType) => void;
|
|
6
|
+
getStart?: (date: DateType) => DateType;
|
|
7
|
+
getEnd?: (date: DateType) => DateType;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare function PanelHeader<DateType extends object>(props: HeaderProps<DateType>): React.JSX.Element;
|
|
11
|
+
export default PanelHeader;
|
|
@@ -0,0 +1,143 @@
|
|
|
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 React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _dateUtil = require("../utils/dateUtil");
|
|
11
|
+
var _context = require("./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
|
+
var HIDDEN_STYLE = {
|
|
16
|
+
visibility: 'hidden'
|
|
17
|
+
};
|
|
18
|
+
function PanelHeader(props) {
|
|
19
|
+
var offset = props.offset,
|
|
20
|
+
superOffset = props.superOffset,
|
|
21
|
+
onChange = props.onChange,
|
|
22
|
+
getStart = props.getStart,
|
|
23
|
+
getEnd = props.getEnd,
|
|
24
|
+
children = props.children;
|
|
25
|
+
var _usePanelContext = (0, _context.usePanelContext)(),
|
|
26
|
+
prefixCls = _usePanelContext.prefixCls,
|
|
27
|
+
_usePanelContext$prev = _usePanelContext.prevIcon,
|
|
28
|
+
prevIcon = _usePanelContext$prev === void 0 ? "\u2039" : _usePanelContext$prev,
|
|
29
|
+
_usePanelContext$next = _usePanelContext.nextIcon,
|
|
30
|
+
nextIcon = _usePanelContext$next === void 0 ? "\u203A" : _usePanelContext$next,
|
|
31
|
+
_usePanelContext$supe = _usePanelContext.superPrevIcon,
|
|
32
|
+
superPrevIcon = _usePanelContext$supe === void 0 ? "\xAB" : _usePanelContext$supe,
|
|
33
|
+
_usePanelContext$supe2 = _usePanelContext.superNextIcon,
|
|
34
|
+
superNextIcon = _usePanelContext$supe2 === void 0 ? "\xBB" : _usePanelContext$supe2,
|
|
35
|
+
minDate = _usePanelContext.minDate,
|
|
36
|
+
maxDate = _usePanelContext.maxDate,
|
|
37
|
+
generateConfig = _usePanelContext.generateConfig,
|
|
38
|
+
locale = _usePanelContext.locale,
|
|
39
|
+
pickerValue = _usePanelContext.pickerValue,
|
|
40
|
+
type = _usePanelContext.panelType;
|
|
41
|
+
var headerPrefixCls = "".concat(prefixCls, "-header");
|
|
42
|
+
var _React$useContext = React.useContext(_context.PickerHackContext),
|
|
43
|
+
hidePrev = _React$useContext.hidePrev,
|
|
44
|
+
hideNext = _React$useContext.hideNext,
|
|
45
|
+
hideHeader = _React$useContext.hideHeader;
|
|
46
|
+
|
|
47
|
+
// ======================= Limitation =======================
|
|
48
|
+
var disabledOffsetPrev = React.useMemo(function () {
|
|
49
|
+
if (!minDate || !offset || !getEnd) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
var prevPanelLimitDate = getEnd(offset(-1, pickerValue));
|
|
53
|
+
return !(0, _dateUtil.isSameOrAfter)(generateConfig, locale, prevPanelLimitDate, minDate, type);
|
|
54
|
+
}, [minDate, offset, pickerValue, getEnd, generateConfig, locale, type]);
|
|
55
|
+
var disabledSuperOffsetPrev = React.useMemo(function () {
|
|
56
|
+
if (!minDate || !superOffset || !getEnd) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
var prevPanelLimitDate = getEnd(superOffset(-1, pickerValue));
|
|
60
|
+
return !(0, _dateUtil.isSameOrAfter)(generateConfig, locale, prevPanelLimitDate, minDate, type);
|
|
61
|
+
}, [minDate, superOffset, pickerValue, getEnd, generateConfig, locale, type]);
|
|
62
|
+
var disabledOffsetNext = React.useMemo(function () {
|
|
63
|
+
if (!maxDate || !offset || !getStart) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
var nextPanelLimitDate = getStart(offset(1, pickerValue));
|
|
67
|
+
return !(0, _dateUtil.isSameOrAfter)(generateConfig, locale, maxDate, nextPanelLimitDate, type);
|
|
68
|
+
}, [maxDate, offset, pickerValue, getStart, generateConfig, locale, type]);
|
|
69
|
+
var disabledSuperOffsetNext = React.useMemo(function () {
|
|
70
|
+
if (!maxDate || !superOffset || !getStart) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
var nextPanelLimitDate = getStart(superOffset(1, pickerValue));
|
|
74
|
+
return !(0, _dateUtil.isSameOrAfter)(generateConfig, locale, maxDate, nextPanelLimitDate, type);
|
|
75
|
+
}, [maxDate, superOffset, pickerValue, getStart, generateConfig, locale, type]);
|
|
76
|
+
|
|
77
|
+
// ========================= Offset =========================
|
|
78
|
+
var onOffset = function onOffset(distance) {
|
|
79
|
+
if (offset) {
|
|
80
|
+
onChange(offset(distance, pickerValue));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var onSuperOffset = function onSuperOffset(distance) {
|
|
84
|
+
if (superOffset) {
|
|
85
|
+
onChange(superOffset(distance, pickerValue));
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// ========================= Render =========================
|
|
90
|
+
if (hideHeader) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
var prevBtnCls = "".concat(headerPrefixCls, "-prev-btn");
|
|
94
|
+
var nextBtnCls = "".concat(headerPrefixCls, "-next-btn");
|
|
95
|
+
var superPrevBtnCls = "".concat(headerPrefixCls, "-super-prev-btn");
|
|
96
|
+
var superNextBtnCls = "".concat(headerPrefixCls, "-super-next-btn");
|
|
97
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: headerPrefixCls
|
|
99
|
+
}, superOffset && /*#__PURE__*/React.createElement("button", {
|
|
100
|
+
type: "button",
|
|
101
|
+
"aria-label": locale.previousYear,
|
|
102
|
+
onClick: function onClick() {
|
|
103
|
+
return onSuperOffset(-1);
|
|
104
|
+
},
|
|
105
|
+
tabIndex: -1,
|
|
106
|
+
className: (0, _classnames.default)(superPrevBtnCls, disabledSuperOffsetPrev && "".concat(superPrevBtnCls, "-disabled")),
|
|
107
|
+
disabled: disabledSuperOffsetPrev,
|
|
108
|
+
style: hidePrev ? HIDDEN_STYLE : {}
|
|
109
|
+
}, superPrevIcon), offset && /*#__PURE__*/React.createElement("button", {
|
|
110
|
+
type: "button",
|
|
111
|
+
"aria-label": locale.previousMonth,
|
|
112
|
+
onClick: function onClick() {
|
|
113
|
+
return onOffset(-1);
|
|
114
|
+
},
|
|
115
|
+
tabIndex: -1,
|
|
116
|
+
className: (0, _classnames.default)(prevBtnCls, disabledOffsetPrev && "".concat(prevBtnCls, "-disabled")),
|
|
117
|
+
disabled: disabledOffsetPrev,
|
|
118
|
+
style: hidePrev ? HIDDEN_STYLE : {}
|
|
119
|
+
}, prevIcon), /*#__PURE__*/React.createElement("div", {
|
|
120
|
+
className: "".concat(headerPrefixCls, "-view")
|
|
121
|
+
}, children), offset && /*#__PURE__*/React.createElement("button", {
|
|
122
|
+
type: "button",
|
|
123
|
+
"aria-label": locale.nextMonth,
|
|
124
|
+
onClick: function onClick() {
|
|
125
|
+
return onOffset(1);
|
|
126
|
+
},
|
|
127
|
+
tabIndex: -1,
|
|
128
|
+
className: (0, _classnames.default)(nextBtnCls, disabledOffsetNext && "".concat(nextBtnCls, "-disabled")),
|
|
129
|
+
disabled: disabledOffsetNext,
|
|
130
|
+
style: hideNext ? HIDDEN_STYLE : {}
|
|
131
|
+
}, nextIcon), superOffset && /*#__PURE__*/React.createElement("button", {
|
|
132
|
+
type: "button",
|
|
133
|
+
"aria-label": locale.nextYear,
|
|
134
|
+
onClick: function onClick() {
|
|
135
|
+
return onSuperOffset(1);
|
|
136
|
+
},
|
|
137
|
+
tabIndex: -1,
|
|
138
|
+
className: (0, _classnames.default)(superNextBtnCls, disabledSuperOffsetNext && "".concat(superNextBtnCls, "-disabled")),
|
|
139
|
+
disabled: disabledSuperOffsetNext,
|
|
140
|
+
style: hideNext ? HIDDEN_STYLE : {}
|
|
141
|
+
}, superNextIcon));
|
|
142
|
+
}
|
|
143
|
+
var _default = exports.default = PanelHeader;
|