@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,218 @@
|
|
|
1
|
+
var _excluded = ["id", "prefix", "clearIcon", "suffixIcon", "separator", "activeIndex", "activeHelp", "allHelp", "focused", "onFocus", "onBlur", "onKeyDown", "locale", "generateConfig", "placeholder", "className", "style", "onClick", "onClear", "value", "onChange", "onSubmit", "onInputChange", "format", "maskFormat", "preserveInvalidOnBlur", "onInvalid", "disabled", "invalid", "inputReadOnly", "direction", "onOpenChange", "onActiveInfo", "placement", "onMouseDown", "required", "aria-required", "autoFocus", "tabIndex"],
|
|
2
|
+
_excluded2 = ["index"];
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
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); }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
16
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
+
import classNames from 'classnames';
|
|
19
|
+
import ResizeObserver from '@rc-component/resize-observer';
|
|
20
|
+
import { useEvent } from '@rc-component/util';
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import PickerContext from "../context";
|
|
23
|
+
import useInputProps from "./hooks/useInputProps";
|
|
24
|
+
import useRootProps from "./hooks/useRootProps";
|
|
25
|
+
import Icon, { ClearIcon } from "./Icon";
|
|
26
|
+
import Input from "./Input";
|
|
27
|
+
function RangeSelector(props, ref) {
|
|
28
|
+
var id = props.id,
|
|
29
|
+
prefix = props.prefix,
|
|
30
|
+
clearIcon = props.clearIcon,
|
|
31
|
+
suffixIcon = props.suffixIcon,
|
|
32
|
+
_props$separator = props.separator,
|
|
33
|
+
separator = _props$separator === void 0 ? '~' : _props$separator,
|
|
34
|
+
activeIndex = props.activeIndex,
|
|
35
|
+
activeHelp = props.activeHelp,
|
|
36
|
+
allHelp = props.allHelp,
|
|
37
|
+
focused = props.focused,
|
|
38
|
+
onFocus = props.onFocus,
|
|
39
|
+
onBlur = props.onBlur,
|
|
40
|
+
onKeyDown = props.onKeyDown,
|
|
41
|
+
locale = props.locale,
|
|
42
|
+
generateConfig = props.generateConfig,
|
|
43
|
+
placeholder = props.placeholder,
|
|
44
|
+
className = props.className,
|
|
45
|
+
style = props.style,
|
|
46
|
+
onClick = props.onClick,
|
|
47
|
+
onClear = props.onClear,
|
|
48
|
+
value = props.value,
|
|
49
|
+
onChange = props.onChange,
|
|
50
|
+
onSubmit = props.onSubmit,
|
|
51
|
+
onInputChange = props.onInputChange,
|
|
52
|
+
format = props.format,
|
|
53
|
+
maskFormat = props.maskFormat,
|
|
54
|
+
preserveInvalidOnBlur = props.preserveInvalidOnBlur,
|
|
55
|
+
onInvalid = props.onInvalid,
|
|
56
|
+
disabled = props.disabled,
|
|
57
|
+
invalid = props.invalid,
|
|
58
|
+
inputReadOnly = props.inputReadOnly,
|
|
59
|
+
direction = props.direction,
|
|
60
|
+
onOpenChange = props.onOpenChange,
|
|
61
|
+
onActiveInfo = props.onActiveInfo,
|
|
62
|
+
placement = props.placement,
|
|
63
|
+
_onMouseDown = props.onMouseDown,
|
|
64
|
+
required = props.required,
|
|
65
|
+
ariaRequired = props['aria-required'],
|
|
66
|
+
autoFocus = props.autoFocus,
|
|
67
|
+
tabIndex = props.tabIndex,
|
|
68
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
69
|
+
var rtl = direction === 'rtl';
|
|
70
|
+
|
|
71
|
+
// ======================== Prefix ========================
|
|
72
|
+
var _React$useContext = React.useContext(PickerContext),
|
|
73
|
+
prefixCls = _React$useContext.prefixCls;
|
|
74
|
+
|
|
75
|
+
// ========================== Id ==========================
|
|
76
|
+
var ids = React.useMemo(function () {
|
|
77
|
+
if (typeof id === 'string') {
|
|
78
|
+
return [id];
|
|
79
|
+
}
|
|
80
|
+
var mergedId = id || {};
|
|
81
|
+
return [mergedId.start, mergedId.end];
|
|
82
|
+
}, [id]);
|
|
83
|
+
|
|
84
|
+
// ========================= Refs =========================
|
|
85
|
+
var rootRef = React.useRef();
|
|
86
|
+
var inputStartRef = React.useRef();
|
|
87
|
+
var inputEndRef = React.useRef();
|
|
88
|
+
var getInput = function getInput(index) {
|
|
89
|
+
var _index;
|
|
90
|
+
return (_index = [inputStartRef, inputEndRef][index]) === null || _index === void 0 ? void 0 : _index.current;
|
|
91
|
+
};
|
|
92
|
+
React.useImperativeHandle(ref, function () {
|
|
93
|
+
return {
|
|
94
|
+
nativeElement: rootRef.current,
|
|
95
|
+
focus: function focus(options) {
|
|
96
|
+
if (_typeof(options) === 'object') {
|
|
97
|
+
var _getInput;
|
|
98
|
+
var _ref = options || {},
|
|
99
|
+
_ref$index = _ref.index,
|
|
100
|
+
_index2 = _ref$index === void 0 ? 0 : _ref$index,
|
|
101
|
+
rest = _objectWithoutProperties(_ref, _excluded2);
|
|
102
|
+
(_getInput = getInput(_index2)) === null || _getInput === void 0 || _getInput.focus(rest);
|
|
103
|
+
} else {
|
|
104
|
+
var _getInput2;
|
|
105
|
+
(_getInput2 = getInput(options !== null && options !== void 0 ? options : 0)) === null || _getInput2 === void 0 || _getInput2.focus();
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
blur: function blur() {
|
|
109
|
+
var _getInput3, _getInput4;
|
|
110
|
+
(_getInput3 = getInput(0)) === null || _getInput3 === void 0 || _getInput3.blur();
|
|
111
|
+
(_getInput4 = getInput(1)) === null || _getInput4 === void 0 || _getInput4.blur();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// ======================== Props =========================
|
|
117
|
+
var rootProps = useRootProps(restProps);
|
|
118
|
+
|
|
119
|
+
// ===================== Placeholder ======================
|
|
120
|
+
var mergedPlaceholder = React.useMemo(function () {
|
|
121
|
+
return Array.isArray(placeholder) ? placeholder : [placeholder, placeholder];
|
|
122
|
+
}, [placeholder]);
|
|
123
|
+
|
|
124
|
+
// ======================== Inputs ========================
|
|
125
|
+
var _useInputProps = useInputProps(_objectSpread(_objectSpread({}, props), {}, {
|
|
126
|
+
id: ids,
|
|
127
|
+
placeholder: mergedPlaceholder
|
|
128
|
+
})),
|
|
129
|
+
_useInputProps2 = _slicedToArray(_useInputProps, 1),
|
|
130
|
+
getInputProps = _useInputProps2[0];
|
|
131
|
+
|
|
132
|
+
// ====================== ActiveBar =======================
|
|
133
|
+
var _React$useState = React.useState({
|
|
134
|
+
position: 'absolute',
|
|
135
|
+
width: 0
|
|
136
|
+
}),
|
|
137
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
138
|
+
activeBarStyle = _React$useState2[0],
|
|
139
|
+
setActiveBarStyle = _React$useState2[1];
|
|
140
|
+
var syncActiveOffset = useEvent(function () {
|
|
141
|
+
var input = getInput(activeIndex);
|
|
142
|
+
if (input) {
|
|
143
|
+
var inputRect = input.nativeElement.getBoundingClientRect();
|
|
144
|
+
var parentRect = rootRef.current.getBoundingClientRect();
|
|
145
|
+
var rectOffset = inputRect.left - parentRect.left;
|
|
146
|
+
setActiveBarStyle(function (ori) {
|
|
147
|
+
return _objectSpread(_objectSpread({}, ori), {}, {
|
|
148
|
+
width: inputRect.width,
|
|
149
|
+
left: rectOffset
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
onActiveInfo([inputRect.left, inputRect.right, parentRect.width]);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
React.useEffect(function () {
|
|
156
|
+
syncActiveOffset();
|
|
157
|
+
}, [activeIndex]);
|
|
158
|
+
|
|
159
|
+
// ======================== Clear =========================
|
|
160
|
+
var showClear = clearIcon && (value[0] && !disabled[0] || value[1] && !disabled[1]);
|
|
161
|
+
|
|
162
|
+
// ======================= Disabled =======================
|
|
163
|
+
var startAutoFocus = autoFocus && !disabled[0];
|
|
164
|
+
var endAutoFocus = autoFocus && !startAutoFocus && !disabled[1];
|
|
165
|
+
|
|
166
|
+
// ======================== Render ========================
|
|
167
|
+
return /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
168
|
+
onResize: syncActiveOffset
|
|
169
|
+
}, /*#__PURE__*/React.createElement("div", _extends({}, rootProps, {
|
|
170
|
+
className: classNames(prefixCls, "".concat(prefixCls, "-range"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-focused"), focused), "".concat(prefixCls, "-disabled"), disabled.every(function (i) {
|
|
171
|
+
return i;
|
|
172
|
+
})), "".concat(prefixCls, "-invalid"), invalid.some(function (i) {
|
|
173
|
+
return i;
|
|
174
|
+
})), "".concat(prefixCls, "-rtl"), rtl), className),
|
|
175
|
+
style: style,
|
|
176
|
+
ref: rootRef,
|
|
177
|
+
onClick: onClick
|
|
178
|
+
// Not lose current input focus
|
|
179
|
+
,
|
|
180
|
+
onMouseDown: function onMouseDown(e) {
|
|
181
|
+
var target = e.target;
|
|
182
|
+
if (target !== inputStartRef.current.inputElement && target !== inputEndRef.current.inputElement) {
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
}
|
|
185
|
+
_onMouseDown === null || _onMouseDown === void 0 || _onMouseDown(e);
|
|
186
|
+
}
|
|
187
|
+
}), prefix && /*#__PURE__*/React.createElement("div", {
|
|
188
|
+
className: "".concat(prefixCls, "-prefix")
|
|
189
|
+
}, prefix), /*#__PURE__*/React.createElement(Input, _extends({
|
|
190
|
+
ref: inputStartRef
|
|
191
|
+
}, getInputProps(0), {
|
|
192
|
+
autoFocus: startAutoFocus,
|
|
193
|
+
tabIndex: tabIndex,
|
|
194
|
+
"date-range": "start"
|
|
195
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
196
|
+
className: "".concat(prefixCls, "-range-separator")
|
|
197
|
+
}, separator), /*#__PURE__*/React.createElement(Input, _extends({
|
|
198
|
+
ref: inputEndRef
|
|
199
|
+
}, getInputProps(1), {
|
|
200
|
+
autoFocus: endAutoFocus,
|
|
201
|
+
tabIndex: tabIndex,
|
|
202
|
+
"date-range": "end"
|
|
203
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
204
|
+
className: "".concat(prefixCls, "-active-bar"),
|
|
205
|
+
style: activeBarStyle
|
|
206
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
|
207
|
+
type: "suffix",
|
|
208
|
+
icon: suffixIcon
|
|
209
|
+
}), showClear && /*#__PURE__*/React.createElement(ClearIcon, {
|
|
210
|
+
icon: clearIcon,
|
|
211
|
+
onClear: onClear
|
|
212
|
+
})));
|
|
213
|
+
}
|
|
214
|
+
var RefRangeSelector = /*#__PURE__*/React.forwardRef(RangeSelector);
|
|
215
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
216
|
+
RefRangeSelector.displayName = 'RangeSelector';
|
|
217
|
+
}
|
|
218
|
+
export default RefRangeSelector;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PickerProps } from '../../SinglePicker';
|
|
3
|
+
export interface MultipleDatesProps<DateType extends object = any> extends Pick<PickerProps, 'maxTagCount'> {
|
|
4
|
+
prefixCls: string;
|
|
5
|
+
value: DateType[];
|
|
6
|
+
onRemove: (value: DateType) => void;
|
|
7
|
+
removeIcon?: React.ReactNode;
|
|
8
|
+
formatDate: (date: DateType) => string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
placeholder?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export default function MultipleDates<DateType extends object = any>(props: MultipleDatesProps<DateType>): React.JSX.Element;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import Overflow from 'rc-overflow';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
export default function MultipleDates(props) {
|
|
5
|
+
var prefixCls = props.prefixCls,
|
|
6
|
+
value = props.value,
|
|
7
|
+
onRemove = props.onRemove,
|
|
8
|
+
_props$removeIcon = props.removeIcon,
|
|
9
|
+
removeIcon = _props$removeIcon === void 0 ? '×' : _props$removeIcon,
|
|
10
|
+
formatDate = props.formatDate,
|
|
11
|
+
disabled = props.disabled,
|
|
12
|
+
maxTagCount = props.maxTagCount,
|
|
13
|
+
placeholder = props.placeholder;
|
|
14
|
+
var selectorCls = "".concat(prefixCls, "-selector");
|
|
15
|
+
var selectionCls = "".concat(prefixCls, "-selection");
|
|
16
|
+
var overflowCls = "".concat(selectionCls, "-overflow");
|
|
17
|
+
|
|
18
|
+
// ========================= Item =========================
|
|
19
|
+
function renderSelector(content, onClose) {
|
|
20
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
21
|
+
className: classNames("".concat(selectionCls, "-item")),
|
|
22
|
+
title: typeof content === 'string' ? content : null
|
|
23
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
24
|
+
className: "".concat(selectionCls, "-item-content")
|
|
25
|
+
}, content), !disabled && onClose && /*#__PURE__*/React.createElement("span", {
|
|
26
|
+
onMouseDown: function onMouseDown(e) {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
},
|
|
29
|
+
onClick: onClose,
|
|
30
|
+
className: "".concat(selectionCls, "-item-remove")
|
|
31
|
+
}, removeIcon));
|
|
32
|
+
}
|
|
33
|
+
function renderItem(date) {
|
|
34
|
+
var displayLabel = formatDate(date);
|
|
35
|
+
var onClose = function onClose(event) {
|
|
36
|
+
if (event) event.stopPropagation();
|
|
37
|
+
onRemove(date);
|
|
38
|
+
};
|
|
39
|
+
return renderSelector(displayLabel, onClose);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ========================= Rest =========================
|
|
43
|
+
function renderRest(omittedValues) {
|
|
44
|
+
var content = "+ ".concat(omittedValues.length, " ...");
|
|
45
|
+
return renderSelector(content);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ======================== Render ========================
|
|
49
|
+
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: selectorCls
|
|
52
|
+
}, /*#__PURE__*/React.createElement(Overflow, {
|
|
53
|
+
prefixCls: overflowCls,
|
|
54
|
+
data: value,
|
|
55
|
+
renderItem: renderItem,
|
|
56
|
+
renderRest: renderRest
|
|
57
|
+
// suffix={inputNode}
|
|
58
|
+
,
|
|
59
|
+
itemKey: function itemKey(date) {
|
|
60
|
+
return formatDate(date);
|
|
61
|
+
},
|
|
62
|
+
maxCount: maxTagCount
|
|
63
|
+
}), !value.length && /*#__PURE__*/React.createElement("span", {
|
|
64
|
+
className: "".concat(prefixCls, "-selection-placeholder")
|
|
65
|
+
}, placeholder));
|
|
66
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { InternalMode, PickerRef, SelectorProps } from '../../../interface';
|
|
3
|
+
import type { PickerProps } from '../../SinglePicker';
|
|
4
|
+
export interface SingleSelectorProps<DateType extends object = any> extends SelectorProps<DateType>, Pick<PickerProps, 'multiple' | 'maxTagCount'> {
|
|
5
|
+
id?: string;
|
|
6
|
+
value?: DateType[];
|
|
7
|
+
onChange: (date: DateType[]) => void;
|
|
8
|
+
internalPicker: InternalMode;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
/** All the field show as `placeholder` */
|
|
11
|
+
allHelp: boolean;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
invalid: boolean;
|
|
14
|
+
onInvalid: (valid: boolean) => void;
|
|
15
|
+
removeIcon?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
declare const RefSingleSelector: React.ForwardRefExoticComponent<SingleSelectorProps<object> & React.RefAttributes<PickerRef>>;
|
|
18
|
+
export default RefSingleSelector;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["id", "open", "prefix", "clearIcon", "suffixIcon", "activeHelp", "allHelp", "focused", "onFocus", "onBlur", "onKeyDown", "locale", "generateConfig", "placeholder", "className", "style", "onClick", "onClear", "internalPicker", "value", "onChange", "onSubmit", "onInputChange", "multiple", "maxTagCount", "format", "maskFormat", "preserveInvalidOnBlur", "onInvalid", "disabled", "invalid", "inputReadOnly", "direction", "onOpenChange", "onMouseDown", "required", "aria-required", "autoFocus", "tabIndex", "removeIcon"];
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
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); }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
|
+
import classNames from 'classnames';
|
|
18
|
+
import * as React from 'react';
|
|
19
|
+
import { isSame } from "../../../utils/dateUtil";
|
|
20
|
+
import PickerContext from "../../context";
|
|
21
|
+
import Icon, { ClearIcon } from "../Icon";
|
|
22
|
+
import Input from "../Input";
|
|
23
|
+
import useInputProps from "../hooks/useInputProps";
|
|
24
|
+
import useRootProps from "../hooks/useRootProps";
|
|
25
|
+
import MultipleDates from "./MultipleDates";
|
|
26
|
+
function SingleSelector(props, ref) {
|
|
27
|
+
var id = props.id,
|
|
28
|
+
open = props.open,
|
|
29
|
+
prefix = props.prefix,
|
|
30
|
+
clearIcon = props.clearIcon,
|
|
31
|
+
suffixIcon = props.suffixIcon,
|
|
32
|
+
activeHelp = props.activeHelp,
|
|
33
|
+
allHelp = props.allHelp,
|
|
34
|
+
focused = props.focused,
|
|
35
|
+
onFocus = props.onFocus,
|
|
36
|
+
onBlur = props.onBlur,
|
|
37
|
+
onKeyDown = props.onKeyDown,
|
|
38
|
+
locale = props.locale,
|
|
39
|
+
generateConfig = props.generateConfig,
|
|
40
|
+
placeholder = props.placeholder,
|
|
41
|
+
className = props.className,
|
|
42
|
+
style = props.style,
|
|
43
|
+
onClick = props.onClick,
|
|
44
|
+
onClear = props.onClear,
|
|
45
|
+
internalPicker = props.internalPicker,
|
|
46
|
+
value = props.value,
|
|
47
|
+
onChange = props.onChange,
|
|
48
|
+
onSubmit = props.onSubmit,
|
|
49
|
+
onInputChange = props.onInputChange,
|
|
50
|
+
multiple = props.multiple,
|
|
51
|
+
maxTagCount = props.maxTagCount,
|
|
52
|
+
format = props.format,
|
|
53
|
+
maskFormat = props.maskFormat,
|
|
54
|
+
preserveInvalidOnBlur = props.preserveInvalidOnBlur,
|
|
55
|
+
onInvalid = props.onInvalid,
|
|
56
|
+
disabled = props.disabled,
|
|
57
|
+
invalid = props.invalid,
|
|
58
|
+
inputReadOnly = props.inputReadOnly,
|
|
59
|
+
direction = props.direction,
|
|
60
|
+
onOpenChange = props.onOpenChange,
|
|
61
|
+
_onMouseDown = props.onMouseDown,
|
|
62
|
+
required = props.required,
|
|
63
|
+
ariaRequired = props['aria-required'],
|
|
64
|
+
autoFocus = props.autoFocus,
|
|
65
|
+
tabIndex = props.tabIndex,
|
|
66
|
+
removeIcon = props.removeIcon,
|
|
67
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
68
|
+
var rtl = direction === 'rtl';
|
|
69
|
+
|
|
70
|
+
// ======================== Prefix ========================
|
|
71
|
+
var _React$useContext = React.useContext(PickerContext),
|
|
72
|
+
prefixCls = _React$useContext.prefixCls;
|
|
73
|
+
|
|
74
|
+
// ========================= Refs =========================
|
|
75
|
+
var rootRef = React.useRef();
|
|
76
|
+
var inputRef = React.useRef();
|
|
77
|
+
React.useImperativeHandle(ref, function () {
|
|
78
|
+
return {
|
|
79
|
+
nativeElement: rootRef.current,
|
|
80
|
+
focus: function focus(options) {
|
|
81
|
+
var _inputRef$current;
|
|
82
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus(options);
|
|
83
|
+
},
|
|
84
|
+
blur: function blur() {
|
|
85
|
+
var _inputRef$current2;
|
|
86
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.blur();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// ======================== Props =========================
|
|
92
|
+
var rootProps = useRootProps(restProps);
|
|
93
|
+
|
|
94
|
+
// ======================== Change ========================
|
|
95
|
+
var onSingleChange = function onSingleChange(date) {
|
|
96
|
+
onChange([date]);
|
|
97
|
+
};
|
|
98
|
+
var onMultipleRemove = function onMultipleRemove(date) {
|
|
99
|
+
var nextValues = value.filter(function (oriDate) {
|
|
100
|
+
return oriDate && !isSame(generateConfig, locale, oriDate, date, internalPicker);
|
|
101
|
+
});
|
|
102
|
+
onChange(nextValues);
|
|
103
|
+
|
|
104
|
+
// When `open`, it means user is operating the
|
|
105
|
+
if (!open) {
|
|
106
|
+
onSubmit();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// ======================== Inputs ========================
|
|
111
|
+
var _useInputProps = useInputProps(_objectSpread(_objectSpread({}, props), {}, {
|
|
112
|
+
onChange: onSingleChange
|
|
113
|
+
}), function (_ref) {
|
|
114
|
+
var valueTexts = _ref.valueTexts;
|
|
115
|
+
return {
|
|
116
|
+
value: valueTexts[0] || '',
|
|
117
|
+
active: focused
|
|
118
|
+
};
|
|
119
|
+
}),
|
|
120
|
+
_useInputProps2 = _slicedToArray(_useInputProps, 2),
|
|
121
|
+
getInputProps = _useInputProps2[0],
|
|
122
|
+
getText = _useInputProps2[1];
|
|
123
|
+
|
|
124
|
+
// ======================== Clear =========================
|
|
125
|
+
var showClear = !!(clearIcon && value.length && !disabled);
|
|
126
|
+
|
|
127
|
+
// ======================= Multiple =======================
|
|
128
|
+
var selectorNode = multiple ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MultipleDates, {
|
|
129
|
+
prefixCls: prefixCls,
|
|
130
|
+
value: value,
|
|
131
|
+
onRemove: onMultipleRemove,
|
|
132
|
+
formatDate: getText,
|
|
133
|
+
maxTagCount: maxTagCount,
|
|
134
|
+
disabled: disabled,
|
|
135
|
+
removeIcon: removeIcon,
|
|
136
|
+
placeholder: placeholder
|
|
137
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
138
|
+
className: "".concat(prefixCls, "-multiple-input"),
|
|
139
|
+
value: value.map(getText).join(','),
|
|
140
|
+
ref: inputRef,
|
|
141
|
+
readOnly: true,
|
|
142
|
+
autoFocus: autoFocus,
|
|
143
|
+
tabIndex: tabIndex
|
|
144
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
|
145
|
+
type: "suffix",
|
|
146
|
+
icon: suffixIcon
|
|
147
|
+
}), showClear && /*#__PURE__*/React.createElement(ClearIcon, {
|
|
148
|
+
icon: clearIcon,
|
|
149
|
+
onClear: onClear
|
|
150
|
+
})) : /*#__PURE__*/React.createElement(Input, _extends({
|
|
151
|
+
ref: inputRef
|
|
152
|
+
}, getInputProps(), {
|
|
153
|
+
autoFocus: autoFocus,
|
|
154
|
+
tabIndex: tabIndex,
|
|
155
|
+
suffixIcon: suffixIcon,
|
|
156
|
+
clearIcon: showClear && /*#__PURE__*/React.createElement(ClearIcon, {
|
|
157
|
+
icon: clearIcon,
|
|
158
|
+
onClear: onClear
|
|
159
|
+
}),
|
|
160
|
+
showActiveCls: false
|
|
161
|
+
}));
|
|
162
|
+
|
|
163
|
+
// ======================== Render ========================
|
|
164
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rootProps, {
|
|
165
|
+
className: classNames(prefixCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-multiple"), multiple), "".concat(prefixCls, "-focused"), focused), "".concat(prefixCls, "-disabled"), disabled), "".concat(prefixCls, "-invalid"), invalid), "".concat(prefixCls, "-rtl"), rtl), className),
|
|
166
|
+
style: style,
|
|
167
|
+
ref: rootRef,
|
|
168
|
+
onClick: onClick
|
|
169
|
+
// Not lose current input focus
|
|
170
|
+
,
|
|
171
|
+
onMouseDown: function onMouseDown(e) {
|
|
172
|
+
var _inputRef$current3;
|
|
173
|
+
var target = e.target;
|
|
174
|
+
if (target !== ((_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.inputElement)) {
|
|
175
|
+
e.preventDefault();
|
|
176
|
+
}
|
|
177
|
+
_onMouseDown === null || _onMouseDown === void 0 || _onMouseDown(e);
|
|
178
|
+
}
|
|
179
|
+
}), prefix && /*#__PURE__*/React.createElement("div", {
|
|
180
|
+
className: "".concat(prefixCls, "-prefix")
|
|
181
|
+
}, prefix), selectorNode);
|
|
182
|
+
}
|
|
183
|
+
var RefSingleSelector = /*#__PURE__*/React.forwardRef(SingleSelector);
|
|
184
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
185
|
+
RefSingleSelector.displayName = 'SingleSelector';
|
|
186
|
+
}
|
|
187
|
+
export default RefSingleSelector;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Used for `useFilledProps` since it already in the React.useMemo
|
|
5
|
+
*/
|
|
6
|
+
export declare function fillClearIcon(prefixCls: string, allowClear?: boolean | {
|
|
7
|
+
clearIcon?: ReactNode;
|
|
8
|
+
}, clearIcon?: ReactNode): string | number | true | Iterable<ReactNode> | React.JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
import warning from "@rc-component/util/es/warning";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Used for `useFilledProps` since it already in the React.useMemo
|
|
7
|
+
*/
|
|
8
|
+
export function fillClearIcon(prefixCls, allowClear, clearIcon) {
|
|
9
|
+
if (process.env.NODE_ENV !== 'production' && clearIcon) {
|
|
10
|
+
warning(false, '`clearIcon` will be removed in future. Please use `allowClear` instead.');
|
|
11
|
+
}
|
|
12
|
+
if (allowClear === false) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
var config = allowClear && _typeof(allowClear) === 'object' ? allowClear : {};
|
|
16
|
+
return config.clearIcon || clearIcon || /*#__PURE__*/React.createElement("span", {
|
|
17
|
+
className: "".concat(prefixCls, "-clear-btn")
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SelectorProps } from '../../../interface';
|
|
2
|
+
import type { InputProps } from '../Input';
|
|
3
|
+
export default function useInputProps<DateType extends object = any>(props: Pick<SelectorProps, 'maskFormat' | 'format' | 'generateConfig' | 'locale' | 'preserveInvalidOnBlur' | 'inputReadOnly' | 'required' | 'aria-required' | 'onSubmit' | 'onFocus' | 'onBlur' | 'onInputChange' | 'onInvalid' | 'onOpenChange' | 'onKeyDown' | 'activeHelp' | 'name' | 'autoComplete' | 'open' | 'picker'> & {
|
|
4
|
+
id?: string | string[];
|
|
5
|
+
value?: DateType[];
|
|
6
|
+
invalid?: boolean | [boolean, boolean];
|
|
7
|
+
placeholder?: string | [string, string];
|
|
8
|
+
disabled?: boolean | [boolean, boolean];
|
|
9
|
+
onChange: (value: DateType | null, index?: number) => void;
|
|
10
|
+
allHelp: boolean;
|
|
11
|
+
activeIndex?: number | null;
|
|
12
|
+
},
|
|
13
|
+
/** Used for SinglePicker */
|
|
14
|
+
postProps?: (info: {
|
|
15
|
+
valueTexts: string[];
|
|
16
|
+
}) => Partial<InputProps>): readonly [(index?: number) => InputProps, (date: DateType) => string];
|