@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,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _common = require("./common");
|
|
8
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
|
+
var locale = _objectSpread(_objectSpread({}, _common.commonLocale), {}, {
|
|
15
|
+
locale: 'zh_TW',
|
|
16
|
+
today: '今天',
|
|
17
|
+
now: '此刻',
|
|
18
|
+
backToToday: '返回今天',
|
|
19
|
+
ok: '確定',
|
|
20
|
+
timeSelect: '選擇時間',
|
|
21
|
+
dateSelect: '選擇日期',
|
|
22
|
+
weekSelect: '選擇周',
|
|
23
|
+
clear: '清除',
|
|
24
|
+
week: '週',
|
|
25
|
+
month: '月',
|
|
26
|
+
year: '年',
|
|
27
|
+
previousMonth: '上個月 (翻頁上鍵)',
|
|
28
|
+
nextMonth: '下個月 (翻頁下鍵)',
|
|
29
|
+
monthSelect: '選擇月份',
|
|
30
|
+
yearSelect: '選擇年份',
|
|
31
|
+
decadeSelect: '選擇年代',
|
|
32
|
+
yearFormat: 'YYYY年',
|
|
33
|
+
dateFormat: 'YYYY年M月D日',
|
|
34
|
+
dateTimeFormat: 'YYYY年M月D日 HH時mm分ss秒',
|
|
35
|
+
previousYear: '上一年 (Control鍵加左方向鍵)',
|
|
36
|
+
nextYear: '下一年 (Control鍵加右方向鍵)',
|
|
37
|
+
previousDecade: '上一年代',
|
|
38
|
+
nextDecade: '下一年代',
|
|
39
|
+
previousCentury: '上一世紀',
|
|
40
|
+
nextCentury: '下一世紀',
|
|
41
|
+
cellDateFormat: 'D',
|
|
42
|
+
monthBeforeYear: false
|
|
43
|
+
});
|
|
44
|
+
var _default = exports.default = locale;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GenerateConfig } from '../generate';
|
|
2
|
+
import type { CustomFormat, InternalMode, Locale, NullableDateType } from '../interface';
|
|
3
|
+
export declare const WEEK_DAY_COUNT = 7;
|
|
4
|
+
export declare function isSameDecade<DateType>(generateConfig: GenerateConfig<DateType>, decade1: NullableDateType<DateType>, decade2: NullableDateType<DateType>): boolean;
|
|
5
|
+
export declare function isSameYear<DateType>(generateConfig: GenerateConfig<DateType>, year1: NullableDateType<DateType>, year2: NullableDateType<DateType>): boolean;
|
|
6
|
+
export declare function getQuarter<DateType>(generateConfig: GenerateConfig<DateType>, date: DateType): number;
|
|
7
|
+
export declare function isSameQuarter<DateType>(generateConfig: GenerateConfig<DateType>, quarter1: NullableDateType<DateType>, quarter2: NullableDateType<DateType>): boolean;
|
|
8
|
+
export declare function isSameMonth<DateType>(generateConfig: GenerateConfig<DateType>, month1: NullableDateType<DateType>, month2: NullableDateType<DateType>): boolean;
|
|
9
|
+
export declare function isSameDate<DateType>(generateConfig: GenerateConfig<DateType>, date1: NullableDateType<DateType>, date2: NullableDateType<DateType>): boolean;
|
|
10
|
+
export declare function isSameTime<DateType>(generateConfig: GenerateConfig<DateType>, time1: NullableDateType<DateType>, time2: NullableDateType<DateType>): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Check if the Date is all the same of timestamp
|
|
13
|
+
*/
|
|
14
|
+
export declare function isSameTimestamp<DateType>(generateConfig: GenerateConfig<DateType>, time1: NullableDateType<DateType>, time2: NullableDateType<DateType>): boolean;
|
|
15
|
+
export declare function isSameWeek<DateType>(generateConfig: GenerateConfig<DateType>, locale: string, date1: NullableDateType<DateType>, date2: NullableDateType<DateType>): boolean;
|
|
16
|
+
export declare function isSame<DateType = any>(generateConfig: GenerateConfig<DateType>, locale: Locale, source: NullableDateType<DateType>, target: NullableDateType<DateType>, type: InternalMode): boolean;
|
|
17
|
+
/** Between in date but not equal of date */
|
|
18
|
+
export declare function isInRange<DateType>(generateConfig: GenerateConfig<DateType>, startDate: NullableDateType<DateType>, endDate: NullableDateType<DateType>, current: NullableDateType<DateType>): boolean;
|
|
19
|
+
export declare function isSameOrAfter<DateType>(generateConfig: GenerateConfig<DateType>, locale: Locale, date1: NullableDateType<DateType>, date2: NullableDateType<DateType>, type: InternalMode): boolean;
|
|
20
|
+
export declare function getWeekStartDate<DateType>(locale: string, generateConfig: GenerateConfig<DateType>, value: DateType): DateType;
|
|
21
|
+
export declare function formatValue<DateType>(value: DateType, { generateConfig, locale, format, }: {
|
|
22
|
+
generateConfig: GenerateConfig<DateType>;
|
|
23
|
+
locale: Locale;
|
|
24
|
+
format: string | CustomFormat<DateType>;
|
|
25
|
+
}): string;
|
|
26
|
+
/**
|
|
27
|
+
* Fill the time info into Date if provided.
|
|
28
|
+
*/
|
|
29
|
+
export declare function fillTime<DateType>(generateConfig: GenerateConfig<DateType>, date: DateType, time?: DateType): DateType;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WEEK_DAY_COUNT = void 0;
|
|
7
|
+
exports.fillTime = fillTime;
|
|
8
|
+
exports.formatValue = formatValue;
|
|
9
|
+
exports.getQuarter = getQuarter;
|
|
10
|
+
exports.getWeekStartDate = getWeekStartDate;
|
|
11
|
+
exports.isInRange = isInRange;
|
|
12
|
+
exports.isSame = isSame;
|
|
13
|
+
exports.isSameDate = isSameDate;
|
|
14
|
+
exports.isSameDecade = isSameDecade;
|
|
15
|
+
exports.isSameMonth = isSameMonth;
|
|
16
|
+
exports.isSameOrAfter = isSameOrAfter;
|
|
17
|
+
exports.isSameQuarter = isSameQuarter;
|
|
18
|
+
exports.isSameTime = isSameTime;
|
|
19
|
+
exports.isSameTimestamp = isSameTimestamp;
|
|
20
|
+
exports.isSameWeek = isSameWeek;
|
|
21
|
+
exports.isSameYear = isSameYear;
|
|
22
|
+
var WEEK_DAY_COUNT = exports.WEEK_DAY_COUNT = 7;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Wrap the compare logic.
|
|
26
|
+
* This will compare the each of value is empty first.
|
|
27
|
+
* 1. All is empty, return true.
|
|
28
|
+
* 2. One is empty, return false.
|
|
29
|
+
* 3. return customize compare logic.
|
|
30
|
+
*/
|
|
31
|
+
function nullableCompare(value1, value2, oriCompareFn) {
|
|
32
|
+
if (!value1 && !value2 || value1 === value2) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
if (!value1 || !value2) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return oriCompareFn();
|
|
39
|
+
}
|
|
40
|
+
function isSameDecade(generateConfig, decade1, decade2) {
|
|
41
|
+
return nullableCompare(decade1, decade2, function () {
|
|
42
|
+
var num1 = Math.floor(generateConfig.getYear(decade1) / 10);
|
|
43
|
+
var num2 = Math.floor(generateConfig.getYear(decade2) / 10);
|
|
44
|
+
return num1 === num2;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function isSameYear(generateConfig, year1, year2) {
|
|
48
|
+
return nullableCompare(year1, year2, function () {
|
|
49
|
+
return generateConfig.getYear(year1) === generateConfig.getYear(year2);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function getQuarter(generateConfig, date) {
|
|
53
|
+
var quota = Math.floor(generateConfig.getMonth(date) / 3);
|
|
54
|
+
return quota + 1;
|
|
55
|
+
}
|
|
56
|
+
function isSameQuarter(generateConfig, quarter1, quarter2) {
|
|
57
|
+
return nullableCompare(quarter1, quarter2, function () {
|
|
58
|
+
return isSameYear(generateConfig, quarter1, quarter2) && getQuarter(generateConfig, quarter1) === getQuarter(generateConfig, quarter2);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function isSameMonth(generateConfig, month1, month2) {
|
|
62
|
+
return nullableCompare(month1, month2, function () {
|
|
63
|
+
return isSameYear(generateConfig, month1, month2) && generateConfig.getMonth(month1) === generateConfig.getMonth(month2);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function isSameDate(generateConfig, date1, date2) {
|
|
67
|
+
return nullableCompare(date1, date2, function () {
|
|
68
|
+
return isSameYear(generateConfig, date1, date2) && isSameMonth(generateConfig, date1, date2) && generateConfig.getDate(date1) === generateConfig.getDate(date2);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function isSameTime(generateConfig, time1, time2) {
|
|
72
|
+
return nullableCompare(time1, time2, function () {
|
|
73
|
+
return generateConfig.getHour(time1) === generateConfig.getHour(time2) && generateConfig.getMinute(time1) === generateConfig.getMinute(time2) && generateConfig.getSecond(time1) === generateConfig.getSecond(time2);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Check if the Date is all the same of timestamp
|
|
79
|
+
*/
|
|
80
|
+
function isSameTimestamp(generateConfig, time1, time2) {
|
|
81
|
+
return nullableCompare(time1, time2, function () {
|
|
82
|
+
return isSameDate(generateConfig, time1, time2) && isSameTime(generateConfig, time1, time2) && generateConfig.getMillisecond(time1) === generateConfig.getMillisecond(time2);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function isSameWeek(generateConfig, locale, date1, date2) {
|
|
86
|
+
return nullableCompare(date1, date2, function () {
|
|
87
|
+
var weekStartDate1 = generateConfig.locale.getWeekFirstDate(locale, date1);
|
|
88
|
+
var weekStartDate2 = generateConfig.locale.getWeekFirstDate(locale, date2);
|
|
89
|
+
return isSameYear(generateConfig, weekStartDate1, weekStartDate2) && generateConfig.locale.getWeek(locale, date1) === generateConfig.locale.getWeek(locale, date2);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function isSame(generateConfig, locale, source, target, type) {
|
|
93
|
+
switch (type) {
|
|
94
|
+
case 'date':
|
|
95
|
+
return isSameDate(generateConfig, source, target);
|
|
96
|
+
case 'week':
|
|
97
|
+
return isSameWeek(generateConfig, locale.locale, source, target);
|
|
98
|
+
case 'month':
|
|
99
|
+
return isSameMonth(generateConfig, source, target);
|
|
100
|
+
case 'quarter':
|
|
101
|
+
return isSameQuarter(generateConfig, source, target);
|
|
102
|
+
case 'year':
|
|
103
|
+
return isSameYear(generateConfig, source, target);
|
|
104
|
+
case 'decade':
|
|
105
|
+
return isSameDecade(generateConfig, source, target);
|
|
106
|
+
case 'time':
|
|
107
|
+
return isSameTime(generateConfig, source, target);
|
|
108
|
+
default:
|
|
109
|
+
return isSameTimestamp(generateConfig, source, target);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Between in date but not equal of date */
|
|
114
|
+
function isInRange(generateConfig, startDate, endDate, current) {
|
|
115
|
+
if (!startDate || !endDate || !current) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return generateConfig.isAfter(current, startDate) && generateConfig.isAfter(endDate, current);
|
|
119
|
+
}
|
|
120
|
+
function isSameOrAfter(generateConfig, locale, date1, date2, type) {
|
|
121
|
+
if (isSame(generateConfig, locale, date1, date2, type)) {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
return generateConfig.isAfter(date1, date2);
|
|
125
|
+
}
|
|
126
|
+
function getWeekStartDate(locale, generateConfig, value) {
|
|
127
|
+
var weekFirstDay = generateConfig.locale.getWeekFirstDay(locale);
|
|
128
|
+
var monthStartDate = generateConfig.setDate(value, 1);
|
|
129
|
+
var startDateWeekDay = generateConfig.getWeekDay(monthStartDate);
|
|
130
|
+
var alignStartDate = generateConfig.addDate(monthStartDate, weekFirstDay - startDateWeekDay);
|
|
131
|
+
if (generateConfig.getMonth(alignStartDate) === generateConfig.getMonth(value) && generateConfig.getDate(alignStartDate) > 1) {
|
|
132
|
+
alignStartDate = generateConfig.addDate(alignStartDate, -7);
|
|
133
|
+
}
|
|
134
|
+
return alignStartDate;
|
|
135
|
+
}
|
|
136
|
+
function formatValue(value, _ref) {
|
|
137
|
+
var generateConfig = _ref.generateConfig,
|
|
138
|
+
locale = _ref.locale,
|
|
139
|
+
format = _ref.format;
|
|
140
|
+
if (!value) {
|
|
141
|
+
return '';
|
|
142
|
+
}
|
|
143
|
+
return typeof format === 'function' ? format(value) : generateConfig.locale.format(locale.locale, value, format);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Fill the time info into Date if provided.
|
|
148
|
+
*/
|
|
149
|
+
function fillTime(generateConfig, date, time) {
|
|
150
|
+
var tmpDate = date;
|
|
151
|
+
var getFn = ['getHour', 'getMinute', 'getSecond', 'getMillisecond'];
|
|
152
|
+
var setFn = ['setHour', 'setMinute', 'setSecond', 'setMillisecond'];
|
|
153
|
+
setFn.forEach(function (fn, index) {
|
|
154
|
+
if (time) {
|
|
155
|
+
tmpDate = generateConfig[fn](tmpDate, generateConfig[getFn[index]](time));
|
|
156
|
+
} else {
|
|
157
|
+
tmpDate = generateConfig[fn](tmpDate, 0);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return tmpDate;
|
|
161
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getClearIcon = getClearIcon;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
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); }
|
|
10
|
+
function getClearIcon(prefixCls, allowClear, clearIcon) {
|
|
11
|
+
var mergedClearIcon = _typeof(allowClear) === "object" ? allowClear.clearIcon : clearIcon;
|
|
12
|
+
return mergedClearIcon || /*#__PURE__*/_react.default.createElement("span", {
|
|
13
|
+
className: "".concat(prefixCls, "-clear-btn")
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InternalMode, Locale, SharedPickerProps } from '../interface';
|
|
2
|
+
export declare function leftPad(str: string | number, length: number, fill?: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Convert `value` to array. Will provide `[]` if is null or undefined.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toArray<T>(val: T | T[]): T[];
|
|
7
|
+
export declare function fillIndex<T extends any[]>(ori: T, index: number, value: T[number]): T;
|
|
8
|
+
/** Pick props from the key list. Will filter empty value */
|
|
9
|
+
export declare function pickProps<T extends object>(props: T, keys?: (keyof T)[] | readonly (keyof T)[]): T;
|
|
10
|
+
export declare function getRowFormat(picker: InternalMode, locale: Locale, format?: SharedPickerProps['format']): {
|
|
11
|
+
format: string;
|
|
12
|
+
type?: "mask";
|
|
13
|
+
} | import("../interface").FormatType<any> | import("../interface").FormatType<any>[];
|
|
14
|
+
export declare function getFromDate<DateType>(calendarValues: DateType[], activeIndexList: number[], activeIndex?: number): DateType;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.fillIndex = fillIndex;
|
|
7
|
+
exports.getFromDate = getFromDate;
|
|
8
|
+
exports.getRowFormat = getRowFormat;
|
|
9
|
+
exports.leftPad = leftPad;
|
|
10
|
+
exports.pickProps = pickProps;
|
|
11
|
+
exports.toArray = toArray;
|
|
12
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
|
+
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."); }
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
16
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
|
+
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; }
|
|
18
|
+
function leftPad(str, length) {
|
|
19
|
+
var fill = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '0';
|
|
20
|
+
var current = String(str);
|
|
21
|
+
while (current.length < length) {
|
|
22
|
+
current = "".concat(fill).concat(current);
|
|
23
|
+
}
|
|
24
|
+
return current;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Convert `value` to array. Will provide `[]` if is null or undefined.
|
|
29
|
+
*/
|
|
30
|
+
function toArray(val) {
|
|
31
|
+
if (val === null || val === undefined) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
return Array.isArray(val) ? val : [val];
|
|
35
|
+
}
|
|
36
|
+
function fillIndex(ori, index, value) {
|
|
37
|
+
var clone = _toConsumableArray(ori);
|
|
38
|
+
clone[index] = value;
|
|
39
|
+
return clone;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Pick props from the key list. Will filter empty value */
|
|
43
|
+
function pickProps(props, keys) {
|
|
44
|
+
var clone = {};
|
|
45
|
+
var mergedKeys = keys || Object.keys(props);
|
|
46
|
+
mergedKeys.forEach(function (key) {
|
|
47
|
+
if (props[key] !== undefined) {
|
|
48
|
+
clone[key] = props[key];
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return clone;
|
|
52
|
+
}
|
|
53
|
+
function getRowFormat(picker, locale, format) {
|
|
54
|
+
if (format) {
|
|
55
|
+
return format;
|
|
56
|
+
}
|
|
57
|
+
switch (picker) {
|
|
58
|
+
// All from the `locale.fieldXXXFormat` first
|
|
59
|
+
case 'time':
|
|
60
|
+
return locale.fieldTimeFormat;
|
|
61
|
+
case 'datetime':
|
|
62
|
+
return locale.fieldDateTimeFormat;
|
|
63
|
+
case 'month':
|
|
64
|
+
return locale.fieldMonthFormat;
|
|
65
|
+
case 'year':
|
|
66
|
+
return locale.fieldYearFormat;
|
|
67
|
+
case 'quarter':
|
|
68
|
+
return locale.fieldQuarterFormat;
|
|
69
|
+
case 'week':
|
|
70
|
+
return locale.fieldWeekFormat;
|
|
71
|
+
default:
|
|
72
|
+
return locale.fieldDateFormat;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function getFromDate(calendarValues, activeIndexList, activeIndex) {
|
|
76
|
+
var mergedActiveIndex = activeIndex !== undefined ? activeIndex : activeIndexList[activeIndexList.length - 1];
|
|
77
|
+
var firstValuedIndex = activeIndexList.find(function (index) {
|
|
78
|
+
return calendarValues[index];
|
|
79
|
+
});
|
|
80
|
+
return mergedActiveIndex !== firstValuedIndex ? calendarValues[firstValuedIndex] : undefined;
|
|
81
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getRealPlacement(placement: string, rtl: boolean): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getRealPlacement = getRealPlacement;
|
|
7
|
+
// ====================== Mode ======================
|
|
8
|
+
function getRealPlacement(placement, rtl) {
|
|
9
|
+
if (placement !== undefined) {
|
|
10
|
+
return placement;
|
|
11
|
+
}
|
|
12
|
+
return rtl ? 'bottomRight' : 'bottomLeft';
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.legacyPropsWarning = legacyPropsWarning;
|
|
7
|
+
var _warning = _interopRequireDefault(require("@rc-component/util/lib/warning"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
function legacyPropsWarning(props) {
|
|
10
|
+
var picker = props.picker,
|
|
11
|
+
disabledHours = props.disabledHours,
|
|
12
|
+
disabledMinutes = props.disabledMinutes,
|
|
13
|
+
disabledSeconds = props.disabledSeconds;
|
|
14
|
+
if (picker === 'time' && (disabledHours || disabledMinutes || disabledSeconds)) {
|
|
15
|
+
(0, _warning.default)(false, "'disabledHours', 'disabledMinutes', 'disabledSeconds' will be removed in the next major version, please use 'disabledTime' instead.");
|
|
16
|
+
}
|
|
17
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rc-component/picker",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "React date & time picker",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"react-component",
|
|
8
|
+
"react-picker"
|
|
9
|
+
],
|
|
10
|
+
"main": "./lib/index",
|
|
11
|
+
"module": "./es/index",
|
|
12
|
+
"files": [
|
|
13
|
+
"assets/*.css",
|
|
14
|
+
"assets/*.less",
|
|
15
|
+
"es",
|
|
16
|
+
"lib"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://react-component.github.io/picker",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git@github.com:react-component/picker.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "http://github.com/react-component/picker/issues"
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"scripts": {
|
|
28
|
+
"start": "dumi dev",
|
|
29
|
+
"build": "dumi build",
|
|
30
|
+
"compile": "father build && lessc assets/index.less assets/index.css",
|
|
31
|
+
"gh-pages": "npm run build && father doc deploy",
|
|
32
|
+
"prepublishOnly": "npm run compile && rc-np",
|
|
33
|
+
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
|
|
34
|
+
"lint:tsc": "tsc -p tsconfig.json --noEmit",
|
|
35
|
+
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
|
|
36
|
+
"test": "rc-test",
|
|
37
|
+
"coverage": "father test --coverage",
|
|
38
|
+
"now-build": "npm run build",
|
|
39
|
+
"prepare": "npx husky"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@rc-component/resize-observer": "^1.0.0",
|
|
43
|
+
"@rc-component/trigger": "^3.0.0",
|
|
44
|
+
"@rc-component/util": "^1.2.1",
|
|
45
|
+
"classnames": "^2.2.1",
|
|
46
|
+
"rc-overflow": "^1.3.2"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=8.x"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@rc-component/father-plugin": "^1.0.0",
|
|
53
|
+
"@rc-component/np":"^1.0.3",
|
|
54
|
+
"@testing-library/react": "^16.0.0",
|
|
55
|
+
"@types/classnames": "^2.2.9",
|
|
56
|
+
"@types/jest": "^29.4.0",
|
|
57
|
+
"@types/luxon": "^3.2.0",
|
|
58
|
+
"@types/react": "^18.0.28",
|
|
59
|
+
"@types/react-dom": "^18.0.8",
|
|
60
|
+
"coveralls": "^3.0.6",
|
|
61
|
+
"cross-env": "^7.0.2",
|
|
62
|
+
"date-fns": "2.x",
|
|
63
|
+
"dayjs": "1.x",
|
|
64
|
+
"dumi": "^2.1.15",
|
|
65
|
+
"eslint": "^8.56.0",
|
|
66
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
67
|
+
"eslint-plugin-jest": "^28.8.1",
|
|
68
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
69
|
+
"eslint-plugin-unicorn": "^55.0.0",
|
|
70
|
+
"father": "^4.0.0",
|
|
71
|
+
"glob": "^10.4.1",
|
|
72
|
+
"husky": "^9.0.11",
|
|
73
|
+
"less": "^4.2.0",
|
|
74
|
+
"lint-staged": "^15.2.7",
|
|
75
|
+
"luxon": "3.x",
|
|
76
|
+
"mockdate": "^3.0.2",
|
|
77
|
+
"moment": "^2.24.0",
|
|
78
|
+
"moment-timezone": "^0.5.45",
|
|
79
|
+
"prettier": "^3.1.0",
|
|
80
|
+
"rc-test": "^7.0.9",
|
|
81
|
+
"react": "^18.2.0",
|
|
82
|
+
"react-dom": "^18.2.0",
|
|
83
|
+
"typescript": "^5.3.0"
|
|
84
|
+
},
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"date-fns": ">= 2.x",
|
|
87
|
+
"dayjs": ">= 1.x",
|
|
88
|
+
"luxon": ">= 3.x",
|
|
89
|
+
"moment": ">= 2.x",
|
|
90
|
+
"react": ">=16.9.0",
|
|
91
|
+
"react-dom": ">=16.9.0"
|
|
92
|
+
},
|
|
93
|
+
"peerDependenciesMeta": {
|
|
94
|
+
"date-fns": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"dayjs": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"luxon": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"moment": {
|
|
104
|
+
"optional": true
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|