@douyinfe/semi-foundation 2.28.0-beta.0 → 2.28.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/lib/cjs/anchor/constants.d.ts +11 -0
- package/lib/cjs/anchor/constants.js +21 -0
- package/lib/cjs/anchor/foundation.d.ts +40 -0
- package/lib/cjs/anchor/foundation.js +263 -0
- package/lib/cjs/anchor/linkFoundation.d.ts +14 -0
- package/lib/cjs/anchor/linkFoundation.js +45 -0
- package/lib/cjs/autoComplete/constants.d.ts +12 -0
- package/lib/cjs/autoComplete/constants.js +24 -0
- package/lib/cjs/autoComplete/foundation.d.ts +66 -0
- package/lib/cjs/autoComplete/foundation.js +518 -0
- package/lib/cjs/autoComplete/optionFoundation.d.ts +21 -0
- package/lib/cjs/autoComplete/optionFoundation.js +37 -0
- package/lib/cjs/avatar/constants.d.ts +10 -0
- package/lib/cjs/avatar/constants.js +21 -0
- package/lib/cjs/avatar/foundation.d.ts +17 -0
- package/lib/cjs/avatar/foundation.js +64 -0
- package/lib/cjs/backtop/constants.d.ts +5 -0
- package/lib/cjs/backtop/constants.js +15 -0
- package/lib/cjs/backtop/foundation.d.ts +21 -0
- package/lib/cjs/backtop/foundation.js +109 -0
- package/lib/cjs/badge/constants.d.ts +10 -0
- package/lib/cjs/badge/constants.js +21 -0
- package/lib/cjs/banner/constants.d.ts +7 -0
- package/lib/cjs/banner/constants.js +17 -0
- package/lib/cjs/banner/foundation.d.ts +9 -0
- package/lib/cjs/banner/foundation.js +25 -0
- package/lib/cjs/base/constants.d.ts +3 -0
- package/lib/cjs/base/constants.js +18 -0
- package/lib/cjs/base/env.d.ts +1 -0
- package/lib/cjs/base/env.js +8 -0
- package/lib/cjs/base/foundation.d.ts +62 -0
- package/lib/cjs/base/foundation.js +157 -0
- package/lib/cjs/base/index.d.ts +5 -0
- package/lib/cjs/base/index.js +15 -0
- package/lib/cjs/breadcrumb/constants.d.ts +7 -0
- package/lib/cjs/breadcrumb/constants.js +17 -0
- package/lib/cjs/breadcrumb/foundation.d.ts +28 -0
- package/lib/cjs/breadcrumb/foundation.js +57 -0
- package/lib/cjs/breadcrumb/itemFoundation.d.ts +22 -0
- package/lib/cjs/breadcrumb/itemFoundation.js +26 -0
- package/lib/cjs/button/constants.d.ts +14 -0
- package/lib/cjs/button/constants.js +25 -0
- package/lib/cjs/calendar/constants.d.ts +7 -0
- package/lib/cjs/calendar/constants.js +17 -0
- package/lib/cjs/calendar/eventUtil.d.ts +94 -0
- package/lib/cjs/calendar/eventUtil.js +409 -0
- package/lib/cjs/calendar/foundation.d.ts +100 -0
- package/lib/cjs/calendar/foundation.js +467 -0
- package/lib/cjs/card/constants.d.ts +8 -0
- package/lib/cjs/card/constants.js +18 -0
- package/lib/cjs/carousel/constants.d.ts +27 -0
- package/lib/cjs/carousel/constants.js +38 -0
- package/lib/cjs/carousel/foundation.d.ts +29 -0
- package/lib/cjs/carousel/foundation.js +215 -0
- package/lib/cjs/cascader/constants.d.ts +17 -0
- package/lib/cjs/cascader/constants.js +30 -0
- package/lib/cjs/cascader/foundation.d.ts +240 -0
- package/lib/cjs/cascader/foundation.js +1069 -0
- package/lib/cjs/cascader/util.d.ts +5 -0
- package/lib/cjs/cascader/util.js +110 -0
- package/lib/cjs/checkbox/checkboxFoundation.d.ts +58 -0
- package/lib/cjs/checkbox/checkboxFoundation.js +139 -0
- package/lib/cjs/checkbox/checkboxGroupFoundation.d.ts +17 -0
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +94 -0
- package/lib/cjs/checkbox/constants.d.ts +27 -0
- package/lib/cjs/checkbox/constants.js +39 -0
- package/lib/cjs/collapse/constants.d.ts +7 -0
- package/lib/cjs/collapse/constants.js +17 -0
- package/lib/cjs/collapse/foundation.d.ts +27 -0
- package/lib/cjs/collapse/foundation.js +66 -0
- package/lib/cjs/collapsible/constants.d.ts +4 -0
- package/lib/cjs/collapsible/constants.js +13 -0
- package/lib/cjs/collapsible/foundation.d.ts +31 -0
- package/lib/cjs/collapsible/foundation.js +36 -0
- package/lib/cjs/datePicker/_utils/formatter.d.ts +14 -0
- package/lib/cjs/datePicker/_utils/formatter.js +63 -0
- package/lib/cjs/datePicker/_utils/getDayOfWeek.d.ts +11 -0
- package/lib/cjs/datePicker/_utils/getDayOfWeek.js +28 -0
- package/lib/cjs/datePicker/_utils/getDefaultFormatToken.d.ts +9 -0
- package/lib/cjs/datePicker/_utils/getDefaultFormatToken.js +26 -0
- package/lib/cjs/datePicker/_utils/getDefaultPickerDate.d.ts +15 -0
- package/lib/cjs/datePicker/_utils/getDefaultPickerDate.js +68 -0
- package/lib/cjs/datePicker/_utils/getFullDateOffset.d.ts +7 -0
- package/lib/cjs/datePicker/_utils/getFullDateOffset.js +32 -0
- package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.d.ts +20 -0
- package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +52 -0
- package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.d.ts +31 -0
- package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +73 -0
- package/lib/cjs/datePicker/_utils/getMonthTable.d.ts +12 -0
- package/lib/cjs/datePicker/_utils/getMonthTable.js +88 -0
- package/lib/cjs/datePicker/_utils/getMonthsInYear.d.ts +2 -0
- package/lib/cjs/datePicker/_utils/getMonthsInYear.js +13 -0
- package/lib/cjs/datePicker/_utils/getYears.d.ts +2 -0
- package/lib/cjs/datePicker/_utils/getYears.js +17 -0
- package/lib/cjs/datePicker/_utils/index.d.ts +13 -0
- package/lib/cjs/datePicker/_utils/index.js +103 -0
- package/lib/cjs/datePicker/_utils/isAfter.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isAfter.js +18 -0
- package/lib/cjs/datePicker/_utils/isBefore.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isBefore.js +18 -0
- package/lib/cjs/datePicker/_utils/isBetween.d.ts +11 -0
- package/lib/cjs/datePicker/_utils/isBetween.js +33 -0
- package/lib/cjs/datePicker/_utils/isDate.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isDate.js +10 -0
- package/lib/cjs/datePicker/_utils/isSameDay.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isSameDay.js +18 -0
- package/lib/cjs/datePicker/_utils/isTimestamp.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isTimestamp.js +16 -0
- package/lib/cjs/datePicker/_utils/isUnixTimestamp.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isUnixTimestamp.js +16 -0
- package/lib/cjs/datePicker/_utils/isValidDate.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isValidDate.js +10 -0
- package/lib/cjs/datePicker/_utils/isWithinInterval.d.ts +4 -0
- package/lib/cjs/datePicker/_utils/isWithinInterval.js +26 -0
- package/lib/cjs/datePicker/_utils/parser.d.ts +23 -0
- package/lib/cjs/datePicker/_utils/parser.js +68 -0
- package/lib/cjs/datePicker/constants.d.ts +53 -0
- package/lib/cjs/datePicker/constants.js +70 -0
- package/lib/cjs/datePicker/foundation.d.ts +483 -0
- package/lib/cjs/datePicker/foundation.js +1456 -0
- package/lib/cjs/datePicker/inputFoundation.d.ts +133 -0
- package/lib/cjs/datePicker/inputFoundation.js +392 -0
- package/lib/cjs/datePicker/monthFoundation.d.ts +74 -0
- package/lib/cjs/datePicker/monthFoundation.js +89 -0
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +253 -0
- package/lib/cjs/datePicker/monthsGridFoundation.js +1078 -0
- package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +65 -0
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +102 -0
- package/lib/cjs/descriptions/constants.d.ts +9 -0
- package/lib/cjs/descriptions/constants.js +20 -0
- package/lib/cjs/divider/constants.d.ts +7 -0
- package/lib/cjs/divider/constants.js +17 -0
- package/lib/cjs/dropdown/constants.d.ts +16 -0
- package/lib/cjs/dropdown/constants.js +29 -0
- package/lib/cjs/dropdown/foundation.d.ts +13 -0
- package/lib/cjs/dropdown/foundation.js +77 -0
- package/lib/cjs/dropdown/menuFoundation.d.ts +8 -0
- package/lib/cjs/dropdown/menuFoundation.js +91 -0
- package/lib/cjs/empty/constants.d.ts +7 -0
- package/lib/cjs/empty/constants.js +17 -0
- package/lib/cjs/form/constants.d.ts +11 -0
- package/lib/cjs/form/constants.js +22 -0
- package/lib/cjs/form/foundation.d.ts +100 -0
- package/lib/cjs/form/foundation.js +832 -0
- package/lib/cjs/form/interface.d.ts +124 -0
- package/lib/cjs/form/interface.js +5 -0
- package/lib/cjs/form/utils.d.ts +56 -0
- package/lib/cjs/form/utils.js +234 -0
- package/lib/cjs/grid/constants.d.ts +4 -0
- package/lib/cjs/grid/constants.js +13 -0
- package/lib/cjs/highlight/constants.d.ts +4 -0
- package/lib/cjs/highlight/constants.js +13 -0
- package/lib/cjs/icons/constants.d.ts +9 -0
- package/lib/cjs/icons/constants.js +21 -0
- package/lib/cjs/image/constants.d.ts +4 -0
- package/lib/cjs/image/constants.js +13 -0
- package/lib/cjs/image/imageFoundation.d.ts +11 -0
- package/lib/cjs/image/imageFoundation.js +89 -0
- package/lib/cjs/image/previewFooterFoundation.d.ts +10 -0
- package/lib/cjs/image/previewFooterFoundation.js +69 -0
- package/lib/cjs/image/previewFoundation.d.ts +5 -0
- package/lib/cjs/image/previewFoundation.js +49 -0
- package/lib/cjs/image/previewImageFoundation.d.ts +59 -0
- package/lib/cjs/image/previewImageFoundation.js +390 -0
- package/lib/cjs/image/previewInnerFoundation.d.ts +46 -0
- package/lib/cjs/image/previewInnerFoundation.js +345 -0
- package/lib/cjs/image/utils.d.ts +4 -0
- package/lib/cjs/image/utils.js +111 -0
- package/lib/cjs/input/constants.d.ts +12 -0
- package/lib/cjs/input/constants.js +23 -0
- package/lib/cjs/input/foundation.d.ts +82 -0
- package/lib/cjs/input/foundation.js +386 -0
- package/lib/cjs/input/textareaFoundation.d.ts +63 -0
- package/lib/cjs/input/textareaFoundation.js +294 -0
- package/lib/cjs/input/util/calculateNodeHeight.d.ts +1 -0
- package/lib/cjs/input/util/calculateNodeHeight.js +87 -0
- package/lib/cjs/input/util/getSizingData.d.ts +6 -0
- package/lib/cjs/input/util/getSizingData.js +42 -0
- package/lib/cjs/inputNumber/constants.d.ts +18 -0
- package/lib/cjs/inputNumber/constants.js +21 -0
- package/lib/cjs/inputNumber/foundation.d.ts +120 -0
- package/lib/cjs/inputNumber/foundation.js +718 -0
- package/lib/cjs/layout/constants.d.ts +7 -0
- package/lib/cjs/layout/constants.js +17 -0
- package/lib/cjs/list/constants.d.ts +9 -0
- package/lib/cjs/list/constants.js +19 -0
- package/lib/cjs/modal/constants.d.ts +10 -0
- package/lib/cjs/modal/constants.js +20 -0
- package/lib/cjs/modal/modalContentFoundation.d.ts +42 -0
- package/lib/cjs/modal/modalContentFoundation.js +85 -0
- package/lib/cjs/modal/modalFoundation.d.ts +69 -0
- package/lib/cjs/modal/modalFoundation.js +89 -0
- package/lib/cjs/navigation/NavItem.d.ts +10 -0
- package/lib/cjs/navigation/NavItem.js +59 -0
- package/lib/cjs/navigation/constants.d.ts +21 -0
- package/lib/cjs/navigation/constants.js +35 -0
- package/lib/cjs/navigation/foundation.d.ts +85 -0
- package/lib/cjs/navigation/foundation.js +292 -0
- package/lib/cjs/navigation/itemFoundation.d.ts +50 -0
- package/lib/cjs/navigation/itemFoundation.js +101 -0
- package/lib/cjs/navigation/subNavFoundation.d.ts +45 -0
- package/lib/cjs/navigation/subNavFoundation.js +150 -0
- package/lib/cjs/notification/constants.d.ts +14 -0
- package/lib/cjs/notification/constants.js +26 -0
- package/lib/cjs/notification/notificationFoundation.d.ts +47 -0
- package/lib/cjs/notification/notificationFoundation.js +67 -0
- package/lib/cjs/notification/notificationListFoundation.d.ts +28 -0
- package/lib/cjs/notification/notificationListFoundation.js +56 -0
- package/lib/cjs/overflowList/constants.d.ts +25 -0
- package/lib/cjs/overflowList/constants.js +39 -0
- package/lib/cjs/overflowList/foundation.d.ts +17 -0
- package/lib/cjs/overflowList/foundation.js +172 -0
- package/lib/cjs/pagination/constants.d.ts +12 -0
- package/lib/cjs/pagination/constants.js +23 -0
- package/lib/cjs/pagination/foundation.d.ts +52 -0
- package/lib/cjs/pagination/foundation.js +366 -0
- package/lib/cjs/popconfirm/constants.d.ts +13 -0
- package/lib/cjs/popconfirm/constants.js +24 -0
- package/lib/cjs/popconfirm/popconfirmFoundation.d.ts +18 -0
- package/lib/cjs/popconfirm/popconfirmFoundation.js +70 -0
- package/lib/cjs/popover/constants.d.ts +25 -0
- package/lib/cjs/popover/constants.js +38 -0
- package/lib/cjs/progress/constants.d.ts +15 -0
- package/lib/cjs/progress/constants.js +26 -0
- package/lib/cjs/progress/generates.d.ts +7 -0
- package/lib/cjs/progress/generates.js +249 -0
- package/lib/cjs/radio/constants.d.ts +29 -0
- package/lib/cjs/radio/constants.js +41 -0
- package/lib/cjs/radio/radioFoundation.d.ts +15 -0
- package/lib/cjs/radio/radioFoundation.js +64 -0
- package/lib/cjs/radio/radioGroupFoundation.d.ts +16 -0
- package/lib/cjs/radio/radioGroupFoundation.js +86 -0
- package/lib/cjs/radio/radioInnerFoundation.d.ts +22 -0
- package/lib/cjs/radio/radioInnerFoundation.js +69 -0
- package/lib/cjs/rating/constants.d.ts +7 -0
- package/lib/cjs/rating/constants.js +17 -0
- package/lib/cjs/rating/foundation.d.ts +41 -0
- package/lib/cjs/rating/foundation.js +279 -0
- package/lib/cjs/scrollList/constants.d.ts +12 -0
- package/lib/cjs/scrollList/constants.js +23 -0
- package/lib/cjs/scrollList/foundation.d.ts +3 -0
- package/lib/cjs/scrollList/foundation.js +14 -0
- package/lib/cjs/scrollList/itemFoundation.d.ts +74 -0
- package/lib/cjs/scrollList/itemFoundation.js +307 -0
- package/lib/cjs/scrollList/scrollTo.d.ts +3 -0
- package/lib/cjs/scrollList/scrollTo.js +32 -0
- package/lib/cjs/select/constants.d.ts +16 -0
- package/lib/cjs/select/constants.js +30 -0
- package/lib/cjs/select/foundation.d.ts +137 -0
- package/lib/cjs/select/foundation.js +1456 -0
- package/lib/cjs/select/optionFoundation.d.ts +21 -0
- package/lib/cjs/select/optionFoundation.js +37 -0
- package/lib/cjs/sideSheet/constants.d.ts +15 -0
- package/lib/cjs/sideSheet/constants.js +25 -0
- package/lib/cjs/sideSheet/sideSheetFoundation.d.ts +55 -0
- package/lib/cjs/sideSheet/sideSheetFoundation.js +73 -0
- package/lib/cjs/skeleton/constants.d.ts +5 -0
- package/lib/cjs/skeleton/constants.js +15 -0
- package/lib/cjs/slider/constants.d.ts +15 -0
- package/lib/cjs/slider/constants.js +25 -0
- package/lib/cjs/slider/foundation.d.ts +212 -0
- package/lib/cjs/slider/foundation.js +952 -0
- package/lib/cjs/space/constants.d.ts +10 -0
- package/lib/cjs/space/constants.js +20 -0
- package/lib/cjs/spin/constants.d.ts +8 -0
- package/lib/cjs/spin/constants.js +20 -0
- package/lib/cjs/spin/foundation.d.ts +12 -0
- package/lib/cjs/spin/foundation.js +55 -0
- package/lib/cjs/steps/constants.d.ts +5 -0
- package/lib/cjs/steps/constants.js +14 -0
- package/lib/cjs/switch/constants.d.ts +19 -0
- package/lib/cjs/switch/constants.js +29 -0
- package/lib/cjs/switch/foundation.d.ts +17 -0
- package/lib/cjs/switch/foundation.js +73 -0
- package/lib/cjs/table/bodyFoundation.d.ts +38 -0
- package/lib/cjs/table/bodyFoundation.js +151 -0
- package/lib/cjs/table/cellFoundation.d.ts +7 -0
- package/lib/cjs/table/cellFoundation.js +19 -0
- package/lib/cjs/table/constants.d.ts +77 -0
- package/lib/cjs/table/constants.js +107 -0
- package/lib/cjs/table/foundation.d.ts +365 -0
- package/lib/cjs/table/foundation.js +1183 -0
- package/lib/cjs/table/tableRowFoundation.d.ts +14 -0
- package/lib/cjs/table/tableRowFoundation.js +41 -0
- package/lib/cjs/table/tableSelectionCellFoundation.d.ts +13 -0
- package/lib/cjs/table/tableSelectionCellFoundation.js +21 -0
- package/lib/cjs/table/utils.d.ts +102 -0
- package/lib/cjs/table/utils.js +618 -0
- package/lib/cjs/tabs/constants.d.ts +32 -0
- package/lib/cjs/tabs/constants.js +43 -0
- package/lib/cjs/tabs/foundation.d.ts +28 -0
- package/lib/cjs/tabs/foundation.js +210 -0
- package/lib/cjs/tag/constants.d.ts +10 -0
- package/lib/cjs/tag/constants.js +21 -0
- package/lib/cjs/tagInput/constants.d.ts +8 -0
- package/lib/cjs/tagInput/constants.js +18 -0
- package/lib/cjs/tagInput/foundation.d.ts +74 -0
- package/lib/cjs/tagInput/foundation.js +391 -0
- package/lib/cjs/tagInput/utils/getSplitedArray.d.ts +7 -0
- package/lib/cjs/tagInput/utils/getSplitedArray.js +44 -0
- package/lib/cjs/timePicker/ComboxFoundation.d.ts +31 -0
- package/lib/cjs/timePicker/ComboxFoundation.js +174 -0
- package/lib/cjs/timePicker/constants.d.ts +23 -0
- package/lib/cjs/timePicker/constants.js +40 -0
- package/lib/cjs/timePicker/foundation.d.ts +54 -0
- package/lib/cjs/timePicker/foundation.js +464 -0
- package/lib/cjs/timePicker/inputFoundation.d.ts +18 -0
- package/lib/cjs/timePicker/inputFoundation.js +76 -0
- package/lib/cjs/timePicker/timePicker.css +11 -0
- package/lib/cjs/timePicker/timePicker.scss +10 -1
- package/lib/cjs/timePicker/utils/index.d.ts +41 -0
- package/lib/cjs/timePicker/utils/index.js +184 -0
- package/lib/cjs/timePicker/utils/localeDate.d.ts +2 -0
- package/lib/cjs/timePicker/utils/localeDate.js +45 -0
- package/lib/cjs/timeline/constants.d.ts +10 -0
- package/lib/cjs/timeline/constants.js +20 -0
- package/lib/cjs/toast/constants.d.ts +14 -0
- package/lib/cjs/toast/constants.js +27 -0
- package/lib/cjs/toast/toastFoundation.d.ts +47 -0
- package/lib/cjs/toast/toastFoundation.js +65 -0
- package/lib/cjs/toast/toastListFoundation.d.ts +20 -0
- package/lib/cjs/toast/toastListFoundation.js +75 -0
- package/lib/cjs/tooltip/constants.d.ts +23 -0
- package/lib/cjs/tooltip/constants.js +34 -0
- package/lib/cjs/tooltip/foundation.d.ts +142 -0
- package/lib/cjs/tooltip/foundation.js +1322 -0
- package/lib/cjs/transfer/constants.d.ts +10 -0
- package/lib/cjs/transfer/constants.js +21 -0
- package/lib/cjs/transfer/foundation.d.ts +50 -0
- package/lib/cjs/transfer/foundation.js +282 -0
- package/lib/cjs/transfer/transferUtils.d.ts +4 -0
- package/lib/cjs/transfer/transferUtils.js +99 -0
- package/lib/cjs/tree/constants.d.ts +9 -0
- package/lib/cjs/tree/constants.js +20 -0
- package/lib/cjs/tree/foundation.d.ts +286 -0
- package/lib/cjs/tree/foundation.js +725 -0
- package/lib/cjs/tree/treeUtil.d.ts +80 -0
- package/lib/cjs/tree/treeUtil.js +775 -0
- package/lib/cjs/treeSelect/constants.d.ts +13 -0
- package/lib/cjs/treeSelect/constants.js +24 -0
- package/lib/cjs/treeSelect/foundation.d.ts +179 -0
- package/lib/cjs/treeSelect/foundation.js +925 -0
- package/lib/cjs/typography/constants.d.ts +12 -0
- package/lib/cjs/typography/constants.js +22 -0
- package/lib/cjs/typography/formatNumeral.d.ts +18 -0
- package/lib/cjs/typography/formatNumeral.js +114 -0
- package/lib/cjs/upload/constants.d.ts +28 -0
- package/lib/cjs/upload/constants.js +46 -0
- package/lib/cjs/upload/foundation.d.ts +167 -0
- package/lib/cjs/upload/foundation.js +1123 -0
- package/lib/cjs/upload/utils.d.ts +6 -0
- package/lib/cjs/upload/utils.js +146 -0
- package/lib/cjs/utils/Event.d.ts +7 -0
- package/lib/cjs/utils/Event.js +77 -0
- package/lib/cjs/utils/FocusHandle.d.ts +26 -0
- package/lib/cjs/utils/FocusHandle.js +157 -0
- package/lib/cjs/utils/Logger.d.ts +15 -0
- package/lib/cjs/utils/Logger.js +82 -0
- package/lib/cjs/utils/Store.d.ts +9 -0
- package/lib/cjs/utils/Store.js +46 -0
- package/lib/cjs/utils/a11y.d.ts +10 -0
- package/lib/cjs/utils/a11y.js +132 -0
- package/lib/cjs/utils/array.d.ts +22 -0
- package/lib/cjs/utils/array.js +55 -0
- package/lib/cjs/utils/arrayMove.d.ts +1 -0
- package/lib/cjs/utils/arrayMove.js +12 -0
- package/lib/cjs/utils/classnames.d.ts +4 -0
- package/lib/cjs/utils/classnames.js +45 -0
- package/lib/cjs/utils/date-fns-extra.d.ts +55 -0
- package/lib/cjs/utils/date-fns-extra.js +141 -0
- package/lib/cjs/utils/dom.d.ts +27 -0
- package/lib/cjs/utils/dom.js +85 -0
- package/lib/cjs/utils/function.d.ts +4 -0
- package/lib/cjs/utils/function.js +12 -0
- package/lib/cjs/utils/getDataAttr.d.ts +1 -0
- package/lib/cjs/utils/getDataAttr.js +16 -0
- package/lib/cjs/utils/getHighlight.d.ts +45 -0
- package/lib/cjs/utils/getHighlight.js +196 -0
- package/lib/cjs/utils/getMotionObjFromProps.d.ts +26 -0
- package/lib/cjs/utils/getMotionObjFromProps.js +72 -0
- package/lib/cjs/utils/index.d.ts +2 -0
- package/lib/cjs/utils/index.js +31 -0
- package/lib/cjs/utils/isBothNaN.d.ts +8 -0
- package/lib/cjs/utils/isBothNaN.js +22 -0
- package/lib/cjs/utils/isElement.d.ts +1 -0
- package/lib/cjs/utils/isElement.js +19 -0
- package/lib/cjs/utils/isEnterPress.d.ts +4 -0
- package/lib/cjs/utils/isEnterPress.js +19 -0
- package/lib/cjs/utils/isEscPress.d.ts +4 -0
- package/lib/cjs/utils/isEscPress.js +20 -0
- package/lib/cjs/utils/isNullOrUndefined.d.ts +6 -0
- package/lib/cjs/utils/isNullOrUndefined.js +15 -0
- package/lib/cjs/utils/isNumber.d.ts +1 -0
- package/lib/cjs/utils/isNumber.js +10 -0
- package/lib/cjs/utils/isObject.d.ts +1 -0
- package/lib/cjs/utils/isObject.js +10 -0
- package/lib/cjs/utils/isPromise.d.ts +1 -0
- package/lib/cjs/utils/isPromise.js +14 -0
- package/lib/cjs/utils/isString.d.ts +1 -0
- package/lib/cjs/utils/isString.js +10 -0
- package/lib/cjs/utils/keyCode.d.ts +430 -0
- package/lib/cjs/utils/keyCode.js +545 -0
- package/lib/cjs/utils/log.d.ts +2 -0
- package/lib/cjs/utils/log.js +23 -0
- package/lib/cjs/utils/number.d.ts +10 -0
- package/lib/cjs/utils/number.js +26 -0
- package/lib/cjs/utils/object.d.ts +17 -0
- package/lib/cjs/utils/object.js +157 -0
- package/lib/cjs/utils/set.d.ts +7 -0
- package/lib/cjs/utils/set.js +40 -0
- package/lib/cjs/utils/shallowEqualObjects.d.ts +5 -0
- package/lib/cjs/utils/shallowEqualObjects.js +34 -0
- package/lib/cjs/utils/touchPolyfill.d.ts +2 -0
- package/lib/cjs/utils/touchPolyfill.js +43 -0
- package/lib/cjs/utils/type.d.ts +31 -0
- package/lib/cjs/utils/type.js +5 -0
- package/lib/cjs/utils/uuid.d.ts +18 -0
- package/lib/cjs/utils/uuid.js +53 -0
- package/lib/cjs/utils/warning.d.ts +1 -0
- package/lib/cjs/utils/warning.js +12 -0
- package/lib/es/anchor/constants.d.ts +11 -0
- package/lib/es/anchor/constants.js +12 -0
- package/lib/es/anchor/foundation.d.ts +40 -0
- package/lib/es/anchor/foundation.js +248 -0
- package/lib/es/anchor/linkFoundation.d.ts +14 -0
- package/lib/es/anchor/linkFoundation.js +33 -0
- package/lib/es/autoComplete/constants.d.ts +12 -0
- package/lib/es/autoComplete/constants.js +14 -0
- package/lib/es/autoComplete/foundation.d.ts +66 -0
- package/lib/es/autoComplete/foundation.js +503 -0
- package/lib/es/autoComplete/optionFoundation.d.ts +21 -0
- package/lib/es/autoComplete/optionFoundation.js +25 -0
- package/lib/es/avatar/constants.d.ts +10 -0
- package/lib/es/avatar/constants.js +12 -0
- package/lib/es/avatar/foundation.d.ts +17 -0
- package/lib/es/avatar/foundation.js +51 -0
- package/lib/es/backtop/constants.d.ts +5 -0
- package/lib/es/backtop/constants.js +6 -0
- package/lib/es/backtop/foundation.d.ts +21 -0
- package/lib/es/backtop/foundation.js +96 -0
- package/lib/es/badge/constants.d.ts +10 -0
- package/lib/es/badge/constants.js +11 -0
- package/lib/es/banner/constants.d.ts +7 -0
- package/lib/es/banner/constants.js +8 -0
- package/lib/es/banner/foundation.d.ts +9 -0
- package/lib/es/banner/foundation.js +13 -0
- package/lib/es/base/constants.d.ts +3 -0
- package/lib/es/base/constants.js +4 -0
- package/lib/es/base/env.d.ts +1 -0
- package/lib/es/base/env.js +1 -0
- package/lib/es/base/foundation.d.ts +62 -0
- package/lib/es/base/foundation.js +147 -0
- package/lib/es/base/index.d.ts +5 -0
- package/lib/es/base/index.js +4 -0
- package/lib/es/breadcrumb/constants.d.ts +7 -0
- package/lib/es/breadcrumb/constants.js +8 -0
- package/lib/es/breadcrumb/foundation.d.ts +28 -0
- package/lib/es/breadcrumb/foundation.js +44 -0
- package/lib/es/breadcrumb/itemFoundation.d.ts +22 -0
- package/lib/es/breadcrumb/itemFoundation.js +14 -0
- package/lib/es/button/constants.d.ts +14 -0
- package/lib/es/button/constants.js +15 -0
- package/lib/es/calendar/constants.d.ts +7 -0
- package/lib/es/calendar/constants.js +8 -0
- package/lib/es/calendar/eventUtil.d.ts +94 -0
- package/lib/es/calendar/eventUtil.js +346 -0
- package/lib/es/calendar/foundation.d.ts +100 -0
- package/lib/es/calendar/foundation.js +453 -0
- package/lib/es/card/constants.d.ts +8 -0
- package/lib/es/card/constants.js +9 -0
- package/lib/es/carousel/constants.d.ts +27 -0
- package/lib/es/carousel/constants.js +28 -0
- package/lib/es/carousel/foundation.d.ts +29 -0
- package/lib/es/carousel/foundation.js +202 -0
- package/lib/es/cascader/constants.d.ts +17 -0
- package/lib/es/cascader/constants.js +20 -0
- package/lib/es/cascader/foundation.d.ts +240 -0
- package/lib/es/cascader/foundation.js +1043 -0
- package/lib/es/cascader/util.d.ts +5 -0
- package/lib/es/cascader/util.js +90 -0
- package/lib/es/checkbox/checkboxFoundation.d.ts +58 -0
- package/lib/es/checkbox/checkboxFoundation.js +127 -0
- package/lib/es/checkbox/checkboxGroupFoundation.d.ts +17 -0
- package/lib/es/checkbox/checkboxGroupFoundation.js +83 -0
- package/lib/es/checkbox/constants.d.ts +27 -0
- package/lib/es/checkbox/constants.js +28 -0
- package/lib/es/collapse/constants.d.ts +7 -0
- package/lib/es/collapse/constants.js +8 -0
- package/lib/es/collapse/foundation.d.ts +27 -0
- package/lib/es/collapse/foundation.js +54 -0
- package/lib/es/collapsible/constants.d.ts +4 -0
- package/lib/es/collapsible/constants.js +5 -0
- package/lib/es/collapsible/foundation.d.ts +31 -0
- package/lib/es/collapsible/foundation.js +26 -0
- package/lib/es/datePicker/_utils/formatter.d.ts +14 -0
- package/lib/es/datePicker/_utils/formatter.js +54 -0
- package/lib/es/datePicker/_utils/getDayOfWeek.d.ts +11 -0
- package/lib/es/datePicker/_utils/getDayOfWeek.js +20 -0
- package/lib/es/datePicker/_utils/getDefaultFormatToken.d.ts +9 -0
- package/lib/es/datePicker/_utils/getDefaultFormatToken.js +15 -0
- package/lib/es/datePicker/_utils/getDefaultPickerDate.d.ts +15 -0
- package/lib/es/datePicker/_utils/getDefaultPickerDate.js +56 -0
- package/lib/es/datePicker/_utils/getFullDateOffset.d.ts +7 -0
- package/lib/es/datePicker/_utils/getFullDateOffset.js +20 -0
- package/lib/es/datePicker/_utils/getInsetInputFormatToken.d.ts +20 -0
- package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +45 -0
- package/lib/es/datePicker/_utils/getInsetInputValueFromInsetInputStr.d.ts +31 -0
- package/lib/es/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +66 -0
- package/lib/es/datePicker/_utils/getMonthTable.d.ts +12 -0
- package/lib/es/datePicker/_utils/getMonthTable.js +82 -0
- package/lib/es/datePicker/_utils/getMonthsInYear.d.ts +2 -0
- package/lib/es/datePicker/_utils/getMonthsInYear.js +5 -0
- package/lib/es/datePicker/_utils/getYears.d.ts +2 -0
- package/lib/es/datePicker/_utils/getYears.js +9 -0
- package/lib/es/datePicker/_utils/index.d.ts +13 -0
- package/lib/es/datePicker/_utils/index.js +13 -0
- package/lib/es/datePicker/_utils/isAfter.d.ts +1 -0
- package/lib/es/datePicker/_utils/isAfter.js +7 -0
- package/lib/es/datePicker/_utils/isBefore.d.ts +1 -0
- package/lib/es/datePicker/_utils/isBefore.js +7 -0
- package/lib/es/datePicker/_utils/isBetween.d.ts +11 -0
- package/lib/es/datePicker/_utils/isBetween.js +23 -0
- package/lib/es/datePicker/_utils/isDate.d.ts +1 -0
- package/lib/es/datePicker/_utils/isDate.js +3 -0
- package/lib/es/datePicker/_utils/isSameDay.d.ts +1 -0
- package/lib/es/datePicker/_utils/isSameDay.js +7 -0
- package/lib/es/datePicker/_utils/isTimestamp.d.ts +1 -0
- package/lib/es/datePicker/_utils/isTimestamp.js +5 -0
- package/lib/es/datePicker/_utils/isUnixTimestamp.d.ts +1 -0
- package/lib/es/datePicker/_utils/isUnixTimestamp.js +5 -0
- package/lib/es/datePicker/_utils/isValidDate.d.ts +1 -0
- package/lib/es/datePicker/_utils/isValidDate.js +3 -0
- package/lib/es/datePicker/_utils/isWithinInterval.d.ts +4 -0
- package/lib/es/datePicker/_utils/isWithinInterval.js +15 -0
- package/lib/es/datePicker/_utils/parser.d.ts +23 -0
- package/lib/es/datePicker/_utils/parser.js +58 -0
- package/lib/es/datePicker/constants.d.ts +53 -0
- package/lib/es/datePicker/constants.js +59 -0
- package/lib/es/datePicker/foundation.d.ts +483 -0
- package/lib/es/datePicker/foundation.js +1433 -0
- package/lib/es/datePicker/inputFoundation.d.ts +133 -0
- package/lib/es/datePicker/inputFoundation.js +371 -0
- package/lib/es/datePicker/monthFoundation.d.ts +74 -0
- package/lib/es/datePicker/monthFoundation.js +73 -0
- package/lib/es/datePicker/monthsGridFoundation.d.ts +253 -0
- package/lib/es/datePicker/monthsGridFoundation.js +1054 -0
- package/lib/es/datePicker/yearAndMonthFoundation.d.ts +65 -0
- package/lib/es/datePicker/yearAndMonthFoundation.js +89 -0
- package/lib/es/descriptions/constants.d.ts +9 -0
- package/lib/es/descriptions/constants.js +10 -0
- package/lib/es/divider/constants.d.ts +7 -0
- package/lib/es/divider/constants.js +8 -0
- package/lib/es/dropdown/constants.d.ts +16 -0
- package/lib/es/dropdown/constants.js +18 -0
- package/lib/es/dropdown/foundation.d.ts +13 -0
- package/lib/es/dropdown/foundation.js +64 -0
- package/lib/es/dropdown/menuFoundation.d.ts +8 -0
- package/lib/es/dropdown/menuFoundation.js +78 -0
- package/lib/es/empty/constants.d.ts +7 -0
- package/lib/es/empty/constants.js +8 -0
- package/lib/es/form/constants.d.ts +11 -0
- package/lib/es/form/constants.js +12 -0
- package/lib/es/form/foundation.d.ts +100 -0
- package/lib/es/form/foundation.js +811 -0
- package/lib/es/form/interface.d.ts +124 -0
- package/lib/es/form/interface.js +1 -0
- package/lib/es/form/utils.d.ts +56 -0
- package/lib/es/form/utils.js +215 -0
- package/lib/es/grid/constants.d.ts +4 -0
- package/lib/es/grid/constants.js +5 -0
- package/lib/es/highlight/constants.d.ts +4 -0
- package/lib/es/highlight/constants.js +5 -0
- package/lib/es/icons/constants.d.ts +9 -0
- package/lib/es/icons/constants.js +11 -0
- package/lib/es/image/constants.d.ts +4 -0
- package/lib/es/image/constants.js +5 -0
- package/lib/es/image/imageFoundation.d.ts +11 -0
- package/lib/es/image/imageFoundation.js +76 -0
- package/lib/es/image/previewFooterFoundation.d.ts +10 -0
- package/lib/es/image/previewFooterFoundation.js +57 -0
- package/lib/es/image/previewFoundation.d.ts +5 -0
- package/lib/es/image/previewFoundation.js +37 -0
- package/lib/es/image/previewImageFoundation.d.ts +59 -0
- package/lib/es/image/previewImageFoundation.js +374 -0
- package/lib/es/image/previewInnerFoundation.d.ts +46 -0
- package/lib/es/image/previewInnerFoundation.js +330 -0
- package/lib/es/image/utils.d.ts +4 -0
- package/lib/es/image/utils.js +93 -0
- package/lib/es/input/constants.d.ts +12 -0
- package/lib/es/input/constants.js +13 -0
- package/lib/es/input/foundation.d.ts +82 -0
- package/lib/es/input/foundation.js +370 -0
- package/lib/es/input/textareaFoundation.d.ts +63 -0
- package/lib/es/input/textareaFoundation.js +276 -0
- package/lib/es/input/util/calculateNodeHeight.d.ts +1 -0
- package/lib/es/input/util/calculateNodeHeight.js +81 -0
- package/lib/es/input/util/getSizingData.d.ts +6 -0
- package/lib/es/input/util/getSizingData.js +32 -0
- package/lib/es/inputNumber/constants.d.ts +18 -0
- package/lib/es/inputNumber/constants.js +11 -0
- package/lib/es/inputNumber/foundation.d.ts +120 -0
- package/lib/es/inputNumber/foundation.js +701 -0
- package/lib/es/layout/constants.d.ts +7 -0
- package/lib/es/layout/constants.js +8 -0
- package/lib/es/list/constants.d.ts +9 -0
- package/lib/es/list/constants.js +10 -0
- package/lib/es/modal/constants.d.ts +10 -0
- package/lib/es/modal/constants.js +11 -0
- package/lib/es/modal/modalContentFoundation.d.ts +42 -0
- package/lib/es/modal/modalContentFoundation.js +72 -0
- package/lib/es/modal/modalFoundation.d.ts +69 -0
- package/lib/es/modal/modalFoundation.js +76 -0
- package/lib/es/navigation/NavItem.d.ts +10 -0
- package/lib/es/navigation/NavItem.js +47 -0
- package/lib/es/navigation/constants.d.ts +21 -0
- package/lib/es/navigation/constants.js +25 -0
- package/lib/es/navigation/foundation.d.ts +85 -0
- package/lib/es/navigation/foundation.js +277 -0
- package/lib/es/navigation/itemFoundation.d.ts +50 -0
- package/lib/es/navigation/itemFoundation.js +89 -0
- package/lib/es/navigation/subNavFoundation.d.ts +45 -0
- package/lib/es/navigation/subNavFoundation.js +138 -0
- package/lib/es/notification/constants.d.ts +14 -0
- package/lib/es/notification/constants.js +16 -0
- package/lib/es/notification/notificationFoundation.d.ts +47 -0
- package/lib/es/notification/notificationFoundation.js +54 -0
- package/lib/es/notification/notificationListFoundation.d.ts +28 -0
- package/lib/es/notification/notificationListFoundation.js +44 -0
- package/lib/es/overflowList/constants.d.ts +25 -0
- package/lib/es/overflowList/constants.js +29 -0
- package/lib/es/overflowList/foundation.d.ts +17 -0
- package/lib/es/overflowList/foundation.js +160 -0
- package/lib/es/pagination/constants.d.ts +12 -0
- package/lib/es/pagination/constants.js +13 -0
- package/lib/es/pagination/foundation.d.ts +52 -0
- package/lib/es/pagination/foundation.js +355 -0
- package/lib/es/popconfirm/constants.d.ts +13 -0
- package/lib/es/popconfirm/constants.js +14 -0
- package/lib/es/popconfirm/popconfirmFoundation.d.ts +18 -0
- package/lib/es/popconfirm/popconfirmFoundation.js +57 -0
- package/lib/es/popover/constants.d.ts +25 -0
- package/lib/es/popover/constants.js +27 -0
- package/lib/es/progress/constants.d.ts +15 -0
- package/lib/es/progress/constants.js +17 -0
- package/lib/es/progress/generates.d.ts +7 -0
- package/lib/es/progress/generates.js +243 -0
- package/lib/es/radio/constants.d.ts +29 -0
- package/lib/es/radio/constants.js +30 -0
- package/lib/es/radio/radioFoundation.d.ts +15 -0
- package/lib/es/radio/radioFoundation.js +51 -0
- package/lib/es/radio/radioGroupFoundation.d.ts +16 -0
- package/lib/es/radio/radioGroupFoundation.js +74 -0
- package/lib/es/radio/radioInnerFoundation.d.ts +22 -0
- package/lib/es/radio/radioInnerFoundation.js +57 -0
- package/lib/es/rating/constants.d.ts +7 -0
- package/lib/es/rating/constants.js +8 -0
- package/lib/es/rating/foundation.d.ts +41 -0
- package/lib/es/rating/foundation.js +263 -0
- package/lib/es/scrollList/constants.d.ts +12 -0
- package/lib/es/scrollList/constants.js +13 -0
- package/lib/es/scrollList/foundation.d.ts +3 -0
- package/lib/es/scrollList/foundation.js +2 -0
- package/lib/es/scrollList/itemFoundation.d.ts +74 -0
- package/lib/es/scrollList/itemFoundation.js +298 -0
- package/lib/es/scrollList/scrollTo.d.ts +3 -0
- package/lib/es/scrollList/scrollTo.js +24 -0
- package/lib/es/select/constants.d.ts +16 -0
- package/lib/es/select/constants.js +19 -0
- package/lib/es/select/foundation.d.ts +137 -0
- package/lib/es/select/foundation.js +1432 -0
- package/lib/es/select/optionFoundation.d.ts +21 -0
- package/lib/es/select/optionFoundation.js +25 -0
- package/lib/es/sideSheet/constants.d.ts +15 -0
- package/lib/es/sideSheet/constants.js +16 -0
- package/lib/es/sideSheet/sideSheetFoundation.d.ts +55 -0
- package/lib/es/sideSheet/sideSheetFoundation.js +59 -0
- package/lib/es/skeleton/constants.d.ts +5 -0
- package/lib/es/skeleton/constants.js +6 -0
- package/lib/es/slider/constants.d.ts +15 -0
- package/lib/es/slider/constants.js +16 -0
- package/lib/es/slider/foundation.d.ts +212 -0
- package/lib/es/slider/foundation.js +937 -0
- package/lib/es/space/constants.d.ts +10 -0
- package/lib/es/space/constants.js +11 -0
- package/lib/es/spin/constants.d.ts +8 -0
- package/lib/es/spin/constants.js +10 -0
- package/lib/es/spin/foundation.d.ts +12 -0
- package/lib/es/spin/foundation.js +45 -0
- package/lib/es/steps/constants.d.ts +5 -0
- package/lib/es/steps/constants.js +6 -0
- package/lib/es/switch/constants.d.ts +19 -0
- package/lib/es/switch/constants.js +20 -0
- package/lib/es/switch/foundation.d.ts +17 -0
- package/lib/es/switch/foundation.js +60 -0
- package/lib/es/table/bodyFoundation.d.ts +38 -0
- package/lib/es/table/bodyFoundation.js +134 -0
- package/lib/es/table/cellFoundation.d.ts +7 -0
- package/lib/es/table/cellFoundation.js +7 -0
- package/lib/es/table/constants.d.ts +77 -0
- package/lib/es/table/constants.js +97 -0
- package/lib/es/table/foundation.d.ts +365 -0
- package/lib/es/table/foundation.js +1181 -0
- package/lib/es/table/tableRowFoundation.d.ts +14 -0
- package/lib/es/table/tableRowFoundation.js +29 -0
- package/lib/es/table/tableSelectionCellFoundation.d.ts +13 -0
- package/lib/es/table/tableSelectionCellFoundation.js +9 -0
- package/lib/es/table/utils.d.ts +102 -0
- package/lib/es/table/utils.js +534 -0
- package/lib/es/tabs/constants.d.ts +32 -0
- package/lib/es/tabs/constants.js +33 -0
- package/lib/es/tabs/foundation.d.ts +28 -0
- package/lib/es/tabs/foundation.js +198 -0
- package/lib/es/tag/constants.d.ts +10 -0
- package/lib/es/tag/constants.js +12 -0
- package/lib/es/tagInput/constants.d.ts +8 -0
- package/lib/es/tagInput/constants.js +9 -0
- package/lib/es/tagInput/foundation.d.ts +74 -0
- package/lib/es/tagInput/foundation.js +373 -0
- package/lib/es/tagInput/utils/getSplitedArray.d.ts +7 -0
- package/lib/es/tagInput/utils/getSplitedArray.js +32 -0
- package/lib/es/timePicker/ComboxFoundation.d.ts +31 -0
- package/lib/es/timePicker/ComboxFoundation.js +156 -0
- package/lib/es/timePicker/constants.d.ts +23 -0
- package/lib/es/timePicker/constants.js +29 -0
- package/lib/es/timePicker/foundation.d.ts +54 -0
- package/lib/es/timePicker/foundation.js +448 -0
- package/lib/es/timePicker/inputFoundation.d.ts +18 -0
- package/lib/es/timePicker/inputFoundation.js +65 -0
- package/lib/es/timePicker/timePicker.css +11 -0
- package/lib/es/timePicker/timePicker.scss +10 -1
- package/lib/es/timePicker/utils/index.d.ts +41 -0
- package/lib/es/timePicker/utils/index.js +148 -0
- package/lib/es/timePicker/utils/localeDate.d.ts +2 -0
- package/lib/es/timePicker/utils/localeDate.js +36 -0
- package/lib/es/timeline/constants.d.ts +10 -0
- package/lib/es/timeline/constants.js +11 -0
- package/lib/es/toast/constants.d.ts +14 -0
- package/lib/es/toast/constants.js +17 -0
- package/lib/es/toast/toastFoundation.d.ts +47 -0
- package/lib/es/toast/toastFoundation.js +52 -0
- package/lib/es/toast/toastListFoundation.d.ts +20 -0
- package/lib/es/toast/toastListFoundation.js +63 -0
- package/lib/es/tooltip/constants.d.ts +23 -0
- package/lib/es/tooltip/constants.js +24 -0
- package/lib/es/tooltip/foundation.d.ts +142 -0
- package/lib/es/tooltip/foundation.js +1310 -0
- package/lib/es/transfer/constants.d.ts +10 -0
- package/lib/es/transfer/constants.js +11 -0
- package/lib/es/transfer/foundation.d.ts +50 -0
- package/lib/es/transfer/foundation.js +266 -0
- package/lib/es/transfer/transferUtils.d.ts +4 -0
- package/lib/es/transfer/transferUtils.js +83 -0
- package/lib/es/tree/constants.d.ts +9 -0
- package/lib/es/tree/constants.js +10 -0
- package/lib/es/tree/foundation.d.ts +286 -0
- package/lib/es/tree/foundation.js +709 -0
- package/lib/es/tree/treeUtil.d.ts +80 -0
- package/lib/es/tree/treeUtil.js +706 -0
- package/lib/es/treeSelect/constants.d.ts +13 -0
- package/lib/es/treeSelect/constants.js +14 -0
- package/lib/es/treeSelect/foundation.d.ts +179 -0
- package/lib/es/treeSelect/foundation.js +902 -0
- package/lib/es/typography/constants.d.ts +12 -0
- package/lib/es/typography/constants.js +13 -0
- package/lib/es/typography/formatNumeral.d.ts +18 -0
- package/lib/es/typography/formatNumeral.js +104 -0
- package/lib/es/upload/constants.d.ts +28 -0
- package/lib/es/upload/constants.js +36 -0
- package/lib/es/upload/foundation.d.ts +167 -0
- package/lib/es/upload/foundation.js +1108 -0
- package/lib/es/upload/utils.d.ts +6 -0
- package/lib/es/upload/utils.js +129 -0
- package/lib/es/utils/Event.d.ts +7 -0
- package/lib/es/utils/Event.js +65 -0
- package/lib/es/utils/FocusHandle.d.ts +26 -0
- package/lib/es/utils/FocusHandle.js +146 -0
- package/lib/es/utils/Logger.d.ts +15 -0
- package/lib/es/utils/Logger.js +74 -0
- package/lib/es/utils/Store.d.ts +9 -0
- package/lib/es/utils/Store.js +38 -0
- package/lib/es/utils/a11y.d.ts +10 -0
- package/lib/es/utils/a11y.js +104 -0
- package/lib/es/utils/array.d.ts +22 -0
- package/lib/es/utils/array.js +46 -0
- package/lib/es/utils/arrayMove.d.ts +1 -0
- package/lib/es/utils/arrayMove.js +5 -0
- package/lib/es/utils/classnames.d.ts +4 -0
- package/lib/es/utils/classnames.js +36 -0
- package/lib/es/utils/date-fns-extra.d.ts +55 -0
- package/lib/es/utils/date-fns-extra.js +120 -0
- package/lib/es/utils/dom.d.ts +27 -0
- package/lib/es/utils/dom.js +67 -0
- package/lib/es/utils/function.d.ts +4 -0
- package/lib/es/utils/function.js +5 -0
- package/lib/es/utils/getDataAttr.d.ts +1 -0
- package/lib/es/utils/getDataAttr.js +9 -0
- package/lib/es/utils/getHighlight.d.ts +45 -0
- package/lib/es/utils/getHighlight.js +187 -0
- package/lib/es/utils/getMotionObjFromProps.d.ts +26 -0
- package/lib/es/utils/getMotionObjFromProps.js +61 -0
- package/lib/es/utils/index.d.ts +2 -0
- package/lib/es/utils/index.js +2 -0
- package/lib/es/utils/isBothNaN.d.ts +8 -0
- package/lib/es/utils/isBothNaN.js +14 -0
- package/lib/es/utils/isElement.d.ts +1 -0
- package/lib/es/utils/isElement.js +12 -0
- package/lib/es/utils/isEnterPress.d.ts +4 -0
- package/lib/es/utils/isEnterPress.js +8 -0
- package/lib/es/utils/isEscPress.d.ts +4 -0
- package/lib/es/utils/isEscPress.js +9 -0
- package/lib/es/utils/isNullOrUndefined.d.ts +6 -0
- package/lib/es/utils/isNullOrUndefined.js +8 -0
- package/lib/es/utils/isNumber.d.ts +1 -0
- package/lib/es/utils/isNumber.js +3 -0
- package/lib/es/utils/isObject.d.ts +1 -0
- package/lib/es/utils/isObject.js +3 -0
- package/lib/es/utils/isPromise.d.ts +1 -0
- package/lib/es/utils/isPromise.js +4 -0
- package/lib/es/utils/isString.d.ts +1 -0
- package/lib/es/utils/isString.js +3 -0
- package/lib/es/utils/keyCode.d.ts +430 -0
- package/lib/es/utils/keyCode.js +534 -0
- package/lib/es/utils/log.d.ts +2 -0
- package/lib/es/utils/log.js +13 -0
- package/lib/es/utils/number.d.ts +10 -0
- package/lib/es/utils/number.js +17 -0
- package/lib/es/utils/object.d.ts +17 -0
- package/lib/es/utils/object.js +138 -0
- package/lib/es/utils/set.d.ts +7 -0
- package/lib/es/utils/set.js +29 -0
- package/lib/es/utils/shallowEqualObjects.d.ts +5 -0
- package/lib/es/utils/shallowEqualObjects.js +27 -0
- package/lib/es/utils/touchPolyfill.d.ts +2 -0
- package/lib/es/utils/touchPolyfill.js +33 -0
- package/lib/es/utils/type.d.ts +31 -0
- package/lib/es/utils/type.js +1 -0
- package/lib/es/utils/uuid.d.ts +18 -0
- package/lib/es/utils/uuid.js +45 -0
- package/lib/es/utils/warning.d.ts +1 -0
- package/lib/es/utils/warning.js +5 -0
- package/package.json +2 -2
- package/timePicker/timePicker.scss +10 -1
|
@@ -0,0 +1,1433 @@
|
|
|
1
|
+
import _isFunction from "lodash/isFunction";
|
|
2
|
+
import _isEqual from "lodash/isEqual";
|
|
3
|
+
import _isString from "lodash/isString";
|
|
4
|
+
import _isObject from "lodash/isObject";
|
|
5
|
+
import _get from "lodash/get";
|
|
6
|
+
|
|
7
|
+
/* eslint-disable no-nested-ternary */
|
|
8
|
+
|
|
9
|
+
/* eslint-disable max-len, max-depth, */
|
|
10
|
+
import { format, isValid, isSameSecond, isEqual as isDateEqual, isDate } from 'date-fns';
|
|
11
|
+
import BaseFoundation from '../base/foundation';
|
|
12
|
+
import { isValidDate, isTimestamp } from './_utils/index';
|
|
13
|
+
import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
14
|
+
import { utcToZonedTime, zonedTimeToUtc } from '../utils/date-fns-extra';
|
|
15
|
+
import { compatibleParse } from './_utils/parser';
|
|
16
|
+
import { getDefaultFormatTokenByType } from './_utils/getDefaultFormatToken';
|
|
17
|
+
import { strings } from './constants';
|
|
18
|
+
import { strings as inputStrings } from '../input/constants';
|
|
19
|
+
import getInsetInputFormatToken from './_utils/getInsetInputFormatToken';
|
|
20
|
+
import getInsetInputValueFromInsetInputStr from './_utils/getInsetInputValueFromInsetInputStr';
|
|
21
|
+
/**
|
|
22
|
+
* The datePicker foundation.js is responsible for maintaining the date value and the input box value, as well as the callback of both
|
|
23
|
+
* task 1. Accept the selected date change, update the date value, and update the input box value according to the date = > Notify the change
|
|
24
|
+
* task 2. When the input box changes, update the date value = > Notify the change
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export default class DatePickerFoundation extends BaseFoundation {
|
|
28
|
+
constructor(adapter) {
|
|
29
|
+
super(Object.assign({}, adapter));
|
|
30
|
+
/**
|
|
31
|
+
* clear range input focus when open is controlled
|
|
32
|
+
* fixed github 1375
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
this.clearRangeInputFocus = () => {
|
|
36
|
+
const {
|
|
37
|
+
type
|
|
38
|
+
} = this._adapter.getProps();
|
|
39
|
+
|
|
40
|
+
const {
|
|
41
|
+
rangeInputFocus
|
|
42
|
+
} = this._adapter.getStates();
|
|
43
|
+
|
|
44
|
+
if (type === 'dateTimeRange' && rangeInputFocus) {
|
|
45
|
+
this._adapter.setRangeInputFocus(false);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
this._isRangeType = () => {
|
|
50
|
+
const type = this._adapter.getProp('type');
|
|
51
|
+
|
|
52
|
+
return /range/i.test(type);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
this._isRangeValueComplete = value => {
|
|
56
|
+
let result = false;
|
|
57
|
+
|
|
58
|
+
if (Array.isArray(value)) {
|
|
59
|
+
result = !value.some(date => isNullOrUndefined(date));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
init() {
|
|
67
|
+
const timeZone = this.getProp('timeZone');
|
|
68
|
+
|
|
69
|
+
if (this._isControlledComponent()) {
|
|
70
|
+
this.initFromProps({
|
|
71
|
+
timeZone,
|
|
72
|
+
value: this.getProp('value')
|
|
73
|
+
});
|
|
74
|
+
} else if (this._isInProps('defaultValue')) {
|
|
75
|
+
this.initFromProps({
|
|
76
|
+
timeZone,
|
|
77
|
+
value: this.getProp('defaultValue')
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
this.initPanelOpenStatus(this.getProp('defaultOpen'));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
isValidTimeZone(timeZone) {
|
|
85
|
+
const propTimeZone = this.getProp('timeZone');
|
|
86
|
+
|
|
87
|
+
const _timeZone = isNullOrUndefined(timeZone) ? propTimeZone : timeZone;
|
|
88
|
+
|
|
89
|
+
return ['string', 'number'].includes(typeof _timeZone) && _timeZone !== '';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
initFromProps(_ref) {
|
|
93
|
+
let {
|
|
94
|
+
value,
|
|
95
|
+
timeZone,
|
|
96
|
+
prevTimeZone
|
|
97
|
+
} = _ref;
|
|
98
|
+
|
|
99
|
+
const _value = (Array.isArray(value) ? [...value] : (value || value === 0) && [value]) || [];
|
|
100
|
+
|
|
101
|
+
const result = this.parseWithTimezone(_value, timeZone, prevTimeZone);
|
|
102
|
+
|
|
103
|
+
this._adapter.updatePrevTimezone(prevTimeZone);
|
|
104
|
+
|
|
105
|
+
this._adapter.updateInputValue(null);
|
|
106
|
+
|
|
107
|
+
this._adapter.updateValue(result);
|
|
108
|
+
|
|
109
|
+
this.resetCachedSelectedValue(result);
|
|
110
|
+
this.initRangeInputFocus(result);
|
|
111
|
+
|
|
112
|
+
if (this._adapter.needConfirm()) {
|
|
113
|
+
this._adapter.updateCachedSelectedValue(result);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 如果用户传了一个空的 value,需要把 range input focus 设置为 rangeStart,这样用户可以清除完之后继续从开始选择
|
|
118
|
+
*
|
|
119
|
+
* If the user passes an empty value, you need to set the range input focus to rangeStart, so that the user can continue to select from the beginning after clearing
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
initRangeInputFocus(result) {
|
|
124
|
+
const {
|
|
125
|
+
triggerRender
|
|
126
|
+
} = this.getProps();
|
|
127
|
+
|
|
128
|
+
if (this._isRangeType() && _isFunction(triggerRender) && result.length === 0) {
|
|
129
|
+
this._adapter.setRangeInputFocus('rangeStart');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
parseWithTimezone(value, timeZone, prevTimeZone) {
|
|
134
|
+
const result = [];
|
|
135
|
+
|
|
136
|
+
if (Array.isArray(value) && value.length) {
|
|
137
|
+
for (const v of value) {
|
|
138
|
+
let parsedV = (v || v === 0) && this._parseValue(v);
|
|
139
|
+
|
|
140
|
+
if (parsedV) {
|
|
141
|
+
if (this.isValidTimeZone(prevTimeZone)) {
|
|
142
|
+
parsedV = zonedTimeToUtc(parsedV, prevTimeZone);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
result.push(this.isValidTimeZone(timeZone) ? utcToZonedTime(parsedV, timeZone) : parsedV);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
_isMultiple() {
|
|
154
|
+
return Boolean(this.getProp('multiple'));
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
*
|
|
158
|
+
* Verify and parse the following three format inputs
|
|
159
|
+
*
|
|
160
|
+
1. Date object
|
|
161
|
+
2. ISO 9601-compliant string
|
|
162
|
+
3. ts timestamp
|
|
163
|
+
Unified here to format the incoming value and output it as a Date object
|
|
164
|
+
*
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
_parseValue(value) {
|
|
169
|
+
const dateFnsLocale = this._adapter.getProp('dateFnsLocale');
|
|
170
|
+
|
|
171
|
+
let dateObj;
|
|
172
|
+
|
|
173
|
+
if (!value && value !== 0) {
|
|
174
|
+
return new Date();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (isValidDate(value)) {
|
|
178
|
+
dateObj = value;
|
|
179
|
+
} else if (_isString(value)) {
|
|
180
|
+
dateObj = compatibleParse(value, this.getProp('format'), undefined, dateFnsLocale);
|
|
181
|
+
} else if (isTimestamp(value)) {
|
|
182
|
+
dateObj = new Date(value);
|
|
183
|
+
} else {
|
|
184
|
+
throw new TypeError('defaultValue should be valid Date object/timestamp or string');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return dateObj;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
destroy() {
|
|
191
|
+
// Ensure that event listeners will be uninstalled and users may not trigger closePanel
|
|
192
|
+
// this._adapter.togglePanel(false);
|
|
193
|
+
this._adapter.unregisterClickOutSide();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
initPanelOpenStatus(defaultOpen) {
|
|
197
|
+
if ((this.getProp('open') || defaultOpen) && !this.getProp('disabled')) {
|
|
198
|
+
this._adapter.togglePanel(true);
|
|
199
|
+
|
|
200
|
+
this._adapter.registerClickOutSide();
|
|
201
|
+
} else {
|
|
202
|
+
this._adapter.togglePanel(false);
|
|
203
|
+
|
|
204
|
+
this._adapter.unregisterClickOutSide();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
openPanel() {
|
|
209
|
+
if (!this.getProp('disabled')) {
|
|
210
|
+
if (!this._isControlledComponent('open')) {
|
|
211
|
+
this._adapter.togglePanel(true);
|
|
212
|
+
|
|
213
|
+
this._adapter.registerClickOutSide();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
this._adapter.notifyOpenChange(true);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* do these side effects when type is dateRange or dateTimeRange
|
|
221
|
+
* 1. trigger input blur, if input value is invalid, set input value and state value to previous status
|
|
222
|
+
* 2. set cachedSelectedValue using given dates(in needConfirm mode)
|
|
223
|
+
* - directly closePanel without click confirm will set cachedSelectedValue to state value
|
|
224
|
+
* - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
rangeTypeSideEffectsWhenClosePanel(inputValue, willUpdateDates) {
|
|
229
|
+
if (this._isRangeType()) {
|
|
230
|
+
this._adapter.setRangeInputFocus(false);
|
|
231
|
+
/**
|
|
232
|
+
* inputValue is string when it is not disabled or can't parsed
|
|
233
|
+
* when inputValue is null, picker value will back to last selected value
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
this.handleInputBlur(inputValue);
|
|
238
|
+
this.resetCachedSelectedValue(willUpdateDates);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* clear input value when selected date is not confirmed
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
needConfirmSideEffectsWhenClosePanel(willUpdateDates) {
|
|
247
|
+
if (this._adapter.needConfirm() && !this._isRangeType()) {
|
|
248
|
+
/**
|
|
249
|
+
* if `null` input element will show `cachedSelectedValue` formatted value(format in DateInput render)
|
|
250
|
+
* if `` input element will show `` directly
|
|
251
|
+
*/
|
|
252
|
+
this._adapter.updateInputValue(null);
|
|
253
|
+
|
|
254
|
+
this.resetCachedSelectedValue(willUpdateDates);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* clear inset input value when close panel
|
|
259
|
+
*/
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
clearInsetInputValue() {
|
|
263
|
+
const {
|
|
264
|
+
insetInput
|
|
265
|
+
} = this._adapter.getProps();
|
|
266
|
+
|
|
267
|
+
if (insetInput) {
|
|
268
|
+
this._adapter.updateInsetInputValue(null);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* call it when change state value or input value
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
resetCachedSelectedValue(willUpdateDates) {
|
|
277
|
+
const {
|
|
278
|
+
value,
|
|
279
|
+
cachedSelectedValue
|
|
280
|
+
} = this._adapter.getStates();
|
|
281
|
+
|
|
282
|
+
const newCachedSelectedValue = Array.isArray(willUpdateDates) ? willUpdateDates : value;
|
|
283
|
+
|
|
284
|
+
if (!_isEqual(newCachedSelectedValue, cachedSelectedValue)) {
|
|
285
|
+
this._adapter.updateCachedSelectedValue(newCachedSelectedValue);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* timing to call closePanel
|
|
290
|
+
* 1. click confirm button
|
|
291
|
+
* 2. click cancel button
|
|
292
|
+
* 3. select date, time, year, month
|
|
293
|
+
* - date type and not multiple, close panel after select date
|
|
294
|
+
* - dateRange type, close panel after select rangeStart and rangeEnd
|
|
295
|
+
* 4. click outside
|
|
296
|
+
* @param {Event} e
|
|
297
|
+
* @param {String} inputValue
|
|
298
|
+
* @param {Date[]} dates
|
|
299
|
+
*/
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
closePanel(e) {
|
|
303
|
+
let inputValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
304
|
+
let dates = arguments.length > 2 ? arguments[2] : undefined;
|
|
305
|
+
|
|
306
|
+
const {
|
|
307
|
+
value
|
|
308
|
+
} = this._adapter.getStates();
|
|
309
|
+
|
|
310
|
+
const willUpdateDates = isNullOrUndefined(dates) ? value : dates;
|
|
311
|
+
|
|
312
|
+
if (!this._isControlledComponent('open')) {
|
|
313
|
+
this._adapter.togglePanel(false);
|
|
314
|
+
|
|
315
|
+
this._adapter.unregisterClickOutSide();
|
|
316
|
+
} // range type picker, closing panel requires the following side effects
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
this.rangeTypeSideEffectsWhenClosePanel(inputValue, willUpdateDates);
|
|
320
|
+
this.needConfirmSideEffectsWhenClosePanel(willUpdateDates);
|
|
321
|
+
this.clearInsetInputValue();
|
|
322
|
+
|
|
323
|
+
this._adapter.notifyOpenChange(false);
|
|
324
|
+
|
|
325
|
+
this._adapter.notifyBlur(e);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Callback when the content of the input box changes
|
|
329
|
+
* Update the date panel if the changed value is a legal date, otherwise only update the input box
|
|
330
|
+
* @param {String} input The value of the input box after the change
|
|
331
|
+
* @param {Event} e
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
handleInputChange(input, e) {
|
|
336
|
+
const result = this._isMultiple() ? this.parseMultipleInput(input) : this.parseInput(input);
|
|
337
|
+
const {
|
|
338
|
+
value: stateValue
|
|
339
|
+
} = this.getStates();
|
|
340
|
+
|
|
341
|
+
this._updateCachedSelectedValueFromInput(input); // Enter a valid date or empty
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
if (result && result.length || input === '') {
|
|
345
|
+
// If you click the clear button
|
|
346
|
+
if (_get(e, inputStrings.CLEARBTN_CLICKED_EVENT_FLAG) && this._isControlledComponent('value')) {
|
|
347
|
+
this._notifyChange(result);
|
|
348
|
+
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
this._updateValueAndInput(result, input === '', input); // Updates the selected value when entering a valid date
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
const changedDates = this._getChangedDates(result);
|
|
356
|
+
|
|
357
|
+
if (!this._someDateDisabled(changedDates)) {
|
|
358
|
+
if (!_isEqual(result, stateValue)) {
|
|
359
|
+
this._notifyChange(result);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
} else {
|
|
363
|
+
this._adapter.updateInputValue(input);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* inset input 变化时需要更新以下 state 状态
|
|
368
|
+
* - insetInputValue(总是)
|
|
369
|
+
* - inputValue(可以解析为合法日期时)
|
|
370
|
+
* - value(可以解析为合法日期时)
|
|
371
|
+
*/
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
handleInsetInputChange(options) {
|
|
375
|
+
const {
|
|
376
|
+
insetInputStr,
|
|
377
|
+
format,
|
|
378
|
+
insetInputValue
|
|
379
|
+
} = options;
|
|
380
|
+
|
|
381
|
+
const _isMultiple = this._isMultiple();
|
|
382
|
+
|
|
383
|
+
const result = _isMultiple ? this.parseMultipleInput(insetInputStr, format) : this.parseInput(insetInputStr, format);
|
|
384
|
+
const {
|
|
385
|
+
value: stateValue
|
|
386
|
+
} = this.getStates();
|
|
387
|
+
|
|
388
|
+
this._updateCachedSelectedValueFromInput(insetInputStr);
|
|
389
|
+
|
|
390
|
+
if (result && result.length) {
|
|
391
|
+
const changedDates = this._getChangedDates(result);
|
|
392
|
+
|
|
393
|
+
if (!this._someDateDisabled(changedDates)) {
|
|
394
|
+
if (!_isEqual(result, stateValue)) {
|
|
395
|
+
if (!this._isControlledComponent() && !this._adapter.needConfirm()) {
|
|
396
|
+
this._adapter.updateValue(result);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
this._notifyChange(result);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
const triggerInput = _isMultiple ? this.formatMultipleDates(result) : this.formatDates(result);
|
|
403
|
+
|
|
404
|
+
this._adapter.updateInputValue(triggerInput);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
this._adapter.updateInsetInputValue(insetInputValue);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* when input change we reset cached selected value
|
|
412
|
+
*/
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
_updateCachedSelectedValueFromInput(input) {
|
|
416
|
+
const looseResult = this.getLooseDateFromInput(input);
|
|
417
|
+
|
|
418
|
+
const changedLooseResult = this._getChangedDates(looseResult);
|
|
419
|
+
|
|
420
|
+
if (!this._someDateDisabled(changedLooseResult)) {
|
|
421
|
+
this.resetCachedSelectedValue(looseResult);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Input box blur
|
|
426
|
+
* @param {String} input
|
|
427
|
+
* @param {Event} e
|
|
428
|
+
*/
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
handleInputBlur() {
|
|
432
|
+
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
433
|
+
let e = arguments.length > 1 ? arguments[1] : undefined;
|
|
434
|
+
const parsedResult = input ? this._isMultiple() ? this.parseMultipleInput(input, ',', true) : this.parseInput(input) : [];
|
|
435
|
+
const stateValue = this.getState('value'); // console.log(input, parsedResult);
|
|
436
|
+
|
|
437
|
+
if (parsedResult && parsedResult.length) {
|
|
438
|
+
this._updateValueAndInput(parsedResult, input === '');
|
|
439
|
+
} else if (input === '') {
|
|
440
|
+
// if clear input, set input to `''`
|
|
441
|
+
this._updateValueAndInput('', true, '');
|
|
442
|
+
} else {
|
|
443
|
+
this._updateValueAndInput(stateValue);
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* 当不是范围类型且不需要确认时,使用 stateValue 重置 cachedSelectedValue
|
|
447
|
+
* 这样做的目的是,在输入非法值时,使用上次选中的值作为已选值
|
|
448
|
+
* needConfirm 或者 range type 时,我们在 close panel 时调用 resetCachedSelectedValue,这里不用重复调用
|
|
449
|
+
*
|
|
450
|
+
* Use stateValue to reset cachedSelectedValue when it is not a range type and does not require confirmation
|
|
451
|
+
* The purpose of this is to use the last selected value as the selected value when an invalid value is entered
|
|
452
|
+
* When needConfirm or range type, we call resetCachedSelectedValue when close panel, no need to call repeatedly here
|
|
453
|
+
*/
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
if (!this._adapter.needConfirm() && !this._isRangeType()) {
|
|
457
|
+
this.resetCachedSelectedValue(stateValue);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* called when range type rangeEnd input tab press
|
|
462
|
+
* @param {Event} e
|
|
463
|
+
*/
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
handleRangeEndTabPress(e) {
|
|
467
|
+
this._adapter.setRangeInputFocus(false);
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* called when the input box is focused
|
|
471
|
+
* @param {Event} e input focus event
|
|
472
|
+
* @param {String} range 'rangeStart' or 'rangeEnd', use when type is range
|
|
473
|
+
*/
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
handleInputFocus(e, range) {
|
|
477
|
+
const rangeInputFocus = this._adapter.getState('rangeInputFocus');
|
|
478
|
+
|
|
479
|
+
range && this._adapter.setRangeInputFocus(range);
|
|
480
|
+
/**
|
|
481
|
+
* rangeType: only notify when range is false
|
|
482
|
+
* not rangeType: notify when focus
|
|
483
|
+
*/
|
|
484
|
+
|
|
485
|
+
if (!range || !['rangeStart', 'rangeEnd'].includes(rangeInputFocus)) {
|
|
486
|
+
this._adapter.notifyFocus(e, range);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
handleSetRangeFocus(rangeInputFocus) {
|
|
491
|
+
this._adapter.setRangeInputFocus(rangeInputFocus);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
handleInputClear(e) {
|
|
495
|
+
this._adapter.notifyClear(e);
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* 范围选择清除按钮回调
|
|
499
|
+
* 因为清除按钮没有集成在Input内,因此需要手动清除 value、inputValue、cachedValue
|
|
500
|
+
*
|
|
501
|
+
* callback of range input clear button
|
|
502
|
+
* Since the clear button is not integrated in Input, you need to manually clear value, inputValue, cachedValue
|
|
503
|
+
*/
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
handleRangeInputClear(e) {
|
|
507
|
+
const value = [];
|
|
508
|
+
const inputValue = '';
|
|
509
|
+
|
|
510
|
+
if (!this._isControlledComponent('value')) {
|
|
511
|
+
this._updateValueAndInput(value, true, inputValue);
|
|
512
|
+
|
|
513
|
+
this.resetCachedSelectedValue(value);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
this._notifyChange(value);
|
|
517
|
+
|
|
518
|
+
this._adapter.notifyClear(e);
|
|
519
|
+
} // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
handleRangeInputBlur(value, e) {} // Parses input only after user returns
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
handleInputComplete() {
|
|
526
|
+
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
527
|
+
// console.log(input);
|
|
528
|
+
let parsedResult = input ? this._isMultiple() ? this.parseMultipleInput(input, ',', true) : this.parseInput(input) : [];
|
|
529
|
+
parsedResult = parsedResult && parsedResult.length ? parsedResult : this.getState('value'); // Use the current date as the value when the current input is empty and the last input is also empty
|
|
530
|
+
|
|
531
|
+
if (!parsedResult || !parsedResult.length) {
|
|
532
|
+
const nowDate = new Date();
|
|
533
|
+
|
|
534
|
+
if (this._isRangeType()) {
|
|
535
|
+
parsedResult = [nowDate, nowDate];
|
|
536
|
+
} else {
|
|
537
|
+
parsedResult = [nowDate];
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
this._updateValueAndInput(parsedResult);
|
|
542
|
+
|
|
543
|
+
const {
|
|
544
|
+
value: stateValue
|
|
545
|
+
} = this.getStates();
|
|
546
|
+
|
|
547
|
+
const changedDates = this._getChangedDates(parsedResult);
|
|
548
|
+
|
|
549
|
+
if (!this._someDateDisabled(changedDates) && !_isEqual(parsedResult, stateValue)) {
|
|
550
|
+
this._notifyChange(parsedResult);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Parse the input, return the time object if it is valid,
|
|
555
|
+
* otherwise return "
|
|
556
|
+
*
|
|
557
|
+
* @param {string} input
|
|
558
|
+
* @returns {Date [] | '}
|
|
559
|
+
*/
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
parseInput() {
|
|
563
|
+
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
564
|
+
let format = arguments.length > 1 ? arguments[1] : undefined;
|
|
565
|
+
let result = []; // console.log(input);
|
|
566
|
+
|
|
567
|
+
const {
|
|
568
|
+
dateFnsLocale,
|
|
569
|
+
rangeSeparator
|
|
570
|
+
} = this.getProps();
|
|
571
|
+
|
|
572
|
+
if (input && input.length) {
|
|
573
|
+
const type = this.getProp('type');
|
|
574
|
+
const formatToken = format || this.getProp('format') || getDefaultFormatTokenByType(type);
|
|
575
|
+
let parsedResult, formatedInput;
|
|
576
|
+
const nowDate = new Date();
|
|
577
|
+
|
|
578
|
+
switch (type) {
|
|
579
|
+
case 'date':
|
|
580
|
+
case 'dateTime':
|
|
581
|
+
case 'month':
|
|
582
|
+
parsedResult = input ? compatibleParse(input, formatToken, nowDate, dateFnsLocale) : '';
|
|
583
|
+
formatedInput = parsedResult && isValid(parsedResult) && this.localeFormat(parsedResult, formatToken);
|
|
584
|
+
|
|
585
|
+
if (parsedResult && formatedInput === input) {
|
|
586
|
+
result = [parsedResult];
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
break;
|
|
590
|
+
|
|
591
|
+
case 'dateRange':
|
|
592
|
+
case 'dateTimeRange':
|
|
593
|
+
const separator = rangeSeparator;
|
|
594
|
+
const values = input.split(separator);
|
|
595
|
+
parsedResult = values && values.reduce((arr, cur) => {
|
|
596
|
+
const parsedVal = cur && compatibleParse(cur, formatToken, nowDate, dateFnsLocale);
|
|
597
|
+
parsedVal && arr.push(parsedVal);
|
|
598
|
+
return arr;
|
|
599
|
+
}, []);
|
|
600
|
+
formatedInput = parsedResult && parsedResult.map(v => v && isValid(v) && this.localeFormat(v, formatToken)).join(separator);
|
|
601
|
+
|
|
602
|
+
if (parsedResult && formatedInput === input) {
|
|
603
|
+
parsedResult.sort((d1, d2) => d1.getTime() - d2.getTime());
|
|
604
|
+
result = parsedResult;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
break;
|
|
608
|
+
|
|
609
|
+
default:
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
return result;
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* get date which may include null from input
|
|
618
|
+
*/
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
getLooseDateFromInput(input) {
|
|
622
|
+
const value = this._isMultiple() ? this.parseMultipleInputLoose(input) : this.parseInputLoose(input);
|
|
623
|
+
return value;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* parse input into `Array<Date|null>`, loose means return value includes `null`
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* ```javascript
|
|
630
|
+
* parseInputLoose('2022-03-15 ~ '); // [Date, null]
|
|
631
|
+
* parseInputLoose(' ~ 2022-03-15 '); // [null, Date]
|
|
632
|
+
* parseInputLoose(''); // []
|
|
633
|
+
* parseInputLoose('2022-03- ~ 2022-0'); // [null, null]
|
|
634
|
+
* ```
|
|
635
|
+
*/
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
parseInputLoose() {
|
|
639
|
+
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
640
|
+
let result = [];
|
|
641
|
+
const {
|
|
642
|
+
dateFnsLocale,
|
|
643
|
+
rangeSeparator,
|
|
644
|
+
type,
|
|
645
|
+
format
|
|
646
|
+
} = this.getProps();
|
|
647
|
+
|
|
648
|
+
if (input && input.length) {
|
|
649
|
+
const formatToken = format || getDefaultFormatTokenByType(type);
|
|
650
|
+
let parsedResult, formatedInput;
|
|
651
|
+
const nowDate = new Date();
|
|
652
|
+
|
|
653
|
+
switch (type) {
|
|
654
|
+
case 'date':
|
|
655
|
+
case 'dateTime':
|
|
656
|
+
case 'month':
|
|
657
|
+
const _parsedResult = compatibleParse(input, formatToken, nowDate, dateFnsLocale);
|
|
658
|
+
|
|
659
|
+
if (isValidDate(_parsedResult)) {
|
|
660
|
+
formatedInput = this.localeFormat(_parsedResult, formatToken);
|
|
661
|
+
|
|
662
|
+
if (formatedInput === input) {
|
|
663
|
+
parsedResult = _parsedResult;
|
|
664
|
+
}
|
|
665
|
+
} else {
|
|
666
|
+
parsedResult = null;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
result = [parsedResult];
|
|
670
|
+
break;
|
|
671
|
+
|
|
672
|
+
case 'dateRange':
|
|
673
|
+
case 'dateTimeRange':
|
|
674
|
+
const separator = rangeSeparator;
|
|
675
|
+
const values = input.split(separator);
|
|
676
|
+
parsedResult = values && values.reduce((arr, cur) => {
|
|
677
|
+
let parsedVal = null;
|
|
678
|
+
|
|
679
|
+
const _parsedResult = compatibleParse(cur, formatToken, nowDate, dateFnsLocale);
|
|
680
|
+
|
|
681
|
+
if (isValidDate(_parsedResult)) {
|
|
682
|
+
formatedInput = this.localeFormat(_parsedResult, formatToken);
|
|
683
|
+
|
|
684
|
+
if (formatedInput === cur) {
|
|
685
|
+
parsedVal = _parsedResult;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
arr.push(parsedVal);
|
|
690
|
+
return arr;
|
|
691
|
+
}, []);
|
|
692
|
+
|
|
693
|
+
if (Array.isArray(parsedResult) && parsedResult.every(item => isValid(item))) {
|
|
694
|
+
parsedResult.sort((d1, d2) => d1.getTime() - d2.getTime());
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
result = parsedResult;
|
|
698
|
+
break;
|
|
699
|
+
|
|
700
|
+
default:
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
return result;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* parse multiple into `Array<Date|null>`, loose means return value includes `null`
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```javascript
|
|
712
|
+
* parseMultipleInputLoose('2021-01-01,2021-10-15'); // [Date, Date];
|
|
713
|
+
* parseMultipleInputLoose('2021-01-01,2021-10-'); // [Date, null];
|
|
714
|
+
* parseMultipleInputLoose(''); // [];
|
|
715
|
+
* ```
|
|
716
|
+
*/
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
parseMultipleInputLoose() {
|
|
720
|
+
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
721
|
+
let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : strings.DEFAULT_SEPARATOR_MULTIPLE;
|
|
722
|
+
let needDedupe = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
723
|
+
const max = this.getProp('max');
|
|
724
|
+
const inputArr = input.split(separator);
|
|
725
|
+
const result = [];
|
|
726
|
+
|
|
727
|
+
for (const curInput of inputArr) {
|
|
728
|
+
let tmpParsed = curInput && this.parseInputLoose(curInput);
|
|
729
|
+
tmpParsed = Array.isArray(tmpParsed) ? tmpParsed : tmpParsed && [tmpParsed];
|
|
730
|
+
|
|
731
|
+
if (tmpParsed && tmpParsed.length) {
|
|
732
|
+
if (needDedupe) {
|
|
733
|
+
!result.filter(r => Boolean(tmpParsed.find(tp => isSameSecond(r, tp)))) && result.push(...tmpParsed);
|
|
734
|
+
} else {
|
|
735
|
+
result.push(...tmpParsed);
|
|
736
|
+
}
|
|
737
|
+
} else {
|
|
738
|
+
return [];
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
if (max && max > 0 && result.length > max) {
|
|
742
|
+
return [];
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
return result;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Parses the input when multiple is true, if valid,
|
|
750
|
+
* returns a list of time objects, otherwise returns an array
|
|
751
|
+
*
|
|
752
|
+
* @param {string} [input='']
|
|
753
|
+
* @param {string} [separator=',']
|
|
754
|
+
* @param {boolean} [needDedupe=false]
|
|
755
|
+
* @returns {Date[]}
|
|
756
|
+
*/
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
parseMultipleInput() {
|
|
760
|
+
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
761
|
+
let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : strings.DEFAULT_SEPARATOR_MULTIPLE;
|
|
762
|
+
let needDedupe = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
763
|
+
const max = this.getProp('max');
|
|
764
|
+
const inputArr = input.split(separator);
|
|
765
|
+
const result = [];
|
|
766
|
+
|
|
767
|
+
for (const curInput of inputArr) {
|
|
768
|
+
let tmpParsed = curInput && this.parseInput(curInput);
|
|
769
|
+
tmpParsed = Array.isArray(tmpParsed) ? tmpParsed : tmpParsed && [tmpParsed];
|
|
770
|
+
|
|
771
|
+
if (tmpParsed && tmpParsed.length) {
|
|
772
|
+
if (needDedupe) {
|
|
773
|
+
// 20190519 TODO: needs to determine the case where multiple is true and range
|
|
774
|
+
!result.filter(r => Boolean(tmpParsed.find(tp => isSameSecond(r, tp)))) && result.push(...tmpParsed);
|
|
775
|
+
} else {
|
|
776
|
+
result.push(...tmpParsed);
|
|
777
|
+
}
|
|
778
|
+
} else {
|
|
779
|
+
return [];
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
if (max && max > 0 && result.length > max) {
|
|
783
|
+
return [];
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
return result;
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* dates[] => string
|
|
791
|
+
*
|
|
792
|
+
* @param {Date[]} dates
|
|
793
|
+
* @returns {string}
|
|
794
|
+
*/
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
formatDates() {
|
|
798
|
+
let dates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
799
|
+
let customFormat = arguments.length > 1 ? arguments[1] : undefined;
|
|
800
|
+
let str = '';
|
|
801
|
+
const rangeSeparator = this.getProp('rangeSeparator');
|
|
802
|
+
|
|
803
|
+
if (Array.isArray(dates) && dates.length) {
|
|
804
|
+
const type = this.getProp('type');
|
|
805
|
+
const formatToken = customFormat || this.getProp('format') || getDefaultFormatTokenByType(type);
|
|
806
|
+
|
|
807
|
+
switch (type) {
|
|
808
|
+
case 'date':
|
|
809
|
+
case 'dateTime':
|
|
810
|
+
case 'month':
|
|
811
|
+
str = this.localeFormat(dates[0], formatToken);
|
|
812
|
+
break;
|
|
813
|
+
|
|
814
|
+
case 'dateRange':
|
|
815
|
+
case 'dateTimeRange':
|
|
816
|
+
const startIsTruthy = !isNullOrUndefined(dates[0]);
|
|
817
|
+
const endIsTruthy = !isNullOrUndefined(dates[1]);
|
|
818
|
+
|
|
819
|
+
if (startIsTruthy && endIsTruthy) {
|
|
820
|
+
str = `${this.localeFormat(dates[0], formatToken)}${rangeSeparator}${this.localeFormat(dates[1], formatToken)}`;
|
|
821
|
+
} else {
|
|
822
|
+
if (startIsTruthy) {
|
|
823
|
+
str = `${this.localeFormat(dates[0], formatToken)}${rangeSeparator}`;
|
|
824
|
+
} else if (endIsTruthy) {
|
|
825
|
+
str = `${rangeSeparator}${this.localeFormat(dates[1], formatToken)}`;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
break;
|
|
830
|
+
|
|
831
|
+
default:
|
|
832
|
+
break;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
return str;
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* dates[] => string
|
|
840
|
+
*
|
|
841
|
+
* @param {Date[]} dates
|
|
842
|
+
* @returns {string}
|
|
843
|
+
*/
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
formatMultipleDates() {
|
|
847
|
+
let dates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
848
|
+
let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : strings.DEFAULT_SEPARATOR_MULTIPLE;
|
|
849
|
+
let customFormat = arguments.length > 2 ? arguments[2] : undefined;
|
|
850
|
+
const strs = [];
|
|
851
|
+
|
|
852
|
+
if (Array.isArray(dates) && dates.length) {
|
|
853
|
+
const type = this.getProp('type');
|
|
854
|
+
|
|
855
|
+
switch (type) {
|
|
856
|
+
case 'date':
|
|
857
|
+
case 'dateTime':
|
|
858
|
+
case 'month':
|
|
859
|
+
dates.forEach(date => strs.push(this.formatDates([date], customFormat)));
|
|
860
|
+
break;
|
|
861
|
+
|
|
862
|
+
case 'dateRange':
|
|
863
|
+
case 'dateTimeRange':
|
|
864
|
+
for (let i = 0; i < dates.length; i += 2) {
|
|
865
|
+
strs.push(this.formatDates(dates.slice(i, i + 2), customFormat));
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
break;
|
|
869
|
+
|
|
870
|
+
default:
|
|
871
|
+
break;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
return strs.join(separator);
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* Update date value and the value of the input box
|
|
879
|
+
* 1. Select Update
|
|
880
|
+
* 2. Input Update
|
|
881
|
+
* @param {Date|''} value
|
|
882
|
+
* @param {Boolean} forceUpdateValue
|
|
883
|
+
* @param {String} input
|
|
884
|
+
*/
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
_updateValueAndInput(value, forceUpdateValue, input) {
|
|
888
|
+
let _value;
|
|
889
|
+
|
|
890
|
+
if (forceUpdateValue || value) {
|
|
891
|
+
if (!Array.isArray(value)) {
|
|
892
|
+
_value = value ? [value] : [];
|
|
893
|
+
} else {
|
|
894
|
+
_value = value;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
const changedDates = this._getChangedDates(_value); // You cannot update the value directly when needConfirm, you can only change the value through handleConfirm
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
if (!this._isControlledComponent() && !this._someDateDisabled(changedDates) && !this._adapter.needConfirm()) {
|
|
901
|
+
this._adapter.updateValue(_value);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
this._adapter.updateInputValue(input);
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* when changing the selected value through the date panel
|
|
909
|
+
* @param {*} value
|
|
910
|
+
* @param {*} options
|
|
911
|
+
*/
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
handleSelectedChange(value, options) {
|
|
915
|
+
const {
|
|
916
|
+
type,
|
|
917
|
+
format,
|
|
918
|
+
rangeSeparator,
|
|
919
|
+
insetInput
|
|
920
|
+
} = this._adapter.getProps();
|
|
921
|
+
|
|
922
|
+
const {
|
|
923
|
+
value: stateValue
|
|
924
|
+
} = this.getStates();
|
|
925
|
+
|
|
926
|
+
const controlled = this._isControlledComponent();
|
|
927
|
+
|
|
928
|
+
const fromPreset = _isObject(options) ? options.fromPreset : options;
|
|
929
|
+
|
|
930
|
+
const closePanel = _get(options, 'closePanel', true);
|
|
931
|
+
/**
|
|
932
|
+
* It is used to determine whether the panel can be stowed. In a Range type component, it is necessary to select both starting Time and endTime before stowing.
|
|
933
|
+
* To determine whether both starting Time and endTime have been selected, it is used to judge whether the two inputs have been Focused.
|
|
934
|
+
* This variable is used to indicate whether such a judgment is required. In the scene with shortcut operations, it is not required.
|
|
935
|
+
*/
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
const needCheckFocusRecord = _get(options, 'needCheckFocusRecord', true);
|
|
939
|
+
|
|
940
|
+
const dates = Array.isArray(value) ? [...value] : value ? [value] : [];
|
|
941
|
+
|
|
942
|
+
const changedDates = this._getChangedDates(dates);
|
|
943
|
+
|
|
944
|
+
let inputValue, insetInputValue;
|
|
945
|
+
|
|
946
|
+
if (!this._someDateDisabled(changedDates)) {
|
|
947
|
+
this.resetCachedSelectedValue(dates);
|
|
948
|
+
inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
|
|
949
|
+
|
|
950
|
+
if (insetInput) {
|
|
951
|
+
const insetInputFormatToken = getInsetInputFormatToken({
|
|
952
|
+
format,
|
|
953
|
+
type
|
|
954
|
+
});
|
|
955
|
+
const insetInputStr = this._isMultiple() ? this.formatMultipleDates(dates, undefined, insetInputFormatToken) : this.formatDates(dates, insetInputFormatToken);
|
|
956
|
+
insetInputValue = getInsetInputValueFromInsetInputStr({
|
|
957
|
+
inputValue: insetInputStr,
|
|
958
|
+
type,
|
|
959
|
+
rangeSeparator
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
const isRangeTypeAndInputIncomplete = this._isRangeType() && !this._isRangeValueComplete(dates);
|
|
964
|
+
/**
|
|
965
|
+
* If the input is incomplete when under control, the notifyChange is not triggered because
|
|
966
|
+
* You need to update the value of the input box, otherwise there will be a problem that a date is selected but the input box does not show the date #1357
|
|
967
|
+
*
|
|
968
|
+
* 受控时如果输入不完整,由于没有触发 notifyChange
|
|
969
|
+
* 需要组件内更新一下输入框的值,否则会出现选了一个日期但是输入框没有回显日期的问题 #1357
|
|
970
|
+
*/
|
|
971
|
+
|
|
972
|
+
if (!this._adapter.needConfirm() || fromPreset) {
|
|
973
|
+
if (isRangeTypeAndInputIncomplete) {
|
|
974
|
+
// do not change value when selected value is incomplete
|
|
975
|
+
this._adapter.updateInputValue(inputValue);
|
|
976
|
+
|
|
977
|
+
this._adapter.updateInsetInputValue(insetInputValue);
|
|
978
|
+
|
|
979
|
+
return;
|
|
980
|
+
} else {
|
|
981
|
+
if (!controlled || fromPreset) {
|
|
982
|
+
this._updateValueAndInput(dates, true, inputValue);
|
|
983
|
+
|
|
984
|
+
this._adapter.updateInsetInputValue(insetInputValue);
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
if (!controlled && this._adapter.needConfirm()) {
|
|
990
|
+
// select date only change inputValue when needConfirm is true
|
|
991
|
+
this._adapter.updateInputValue(inputValue);
|
|
992
|
+
|
|
993
|
+
this._adapter.updateInsetInputValue(insetInputValue); // if inputValue is not complete, don't notifyChange
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
if (isRangeTypeAndInputIncomplete) {
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
if (!_isEqual(value, stateValue)) {
|
|
1002
|
+
this._notifyChange(value);
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
const focusRecordChecked = !needCheckFocusRecord || needCheckFocusRecord && this._adapter.couldPanelClosed();
|
|
1007
|
+
|
|
1008
|
+
if (type === 'date' && !this._isMultiple() && closePanel || type === 'dateRange' && this._isRangeValueComplete(dates) && closePanel && focusRecordChecked) {
|
|
1009
|
+
this.closePanel(undefined, inputValue, dates);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* when changing the year and month through the panel when the type is year or month
|
|
1014
|
+
* @param {*} item
|
|
1015
|
+
*/
|
|
1016
|
+
|
|
1017
|
+
|
|
1018
|
+
handleYMSelectedChange() {
|
|
1019
|
+
let item = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1020
|
+
// console.log(item);
|
|
1021
|
+
const {
|
|
1022
|
+
currentMonth,
|
|
1023
|
+
currentYear
|
|
1024
|
+
} = item;
|
|
1025
|
+
|
|
1026
|
+
if (typeof currentMonth === 'number' && typeof currentYear === 'number') {
|
|
1027
|
+
// Strings with only dates (e.g. "1970-01-01") will be treated as UTC instead of local time #1460
|
|
1028
|
+
const date = new Date(currentYear, currentMonth - 1);
|
|
1029
|
+
this.handleSelectedChange([date]);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
handleConfirm() {
|
|
1034
|
+
const {
|
|
1035
|
+
cachedSelectedValue,
|
|
1036
|
+
value
|
|
1037
|
+
} = this._adapter.getStates();
|
|
1038
|
+
|
|
1039
|
+
const isRangeValueComplete = this._isRangeValueComplete(cachedSelectedValue);
|
|
1040
|
+
|
|
1041
|
+
const newValue = isRangeValueComplete ? cachedSelectedValue : value;
|
|
1042
|
+
|
|
1043
|
+
if (this._adapter.needConfirm() && !this._isControlledComponent()) {
|
|
1044
|
+
this._adapter.updateValue(newValue);
|
|
1045
|
+
} // If the input is incomplete, the legal date of the last input is used
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
this.closePanel(undefined, undefined, newValue);
|
|
1049
|
+
|
|
1050
|
+
if (isRangeValueComplete) {
|
|
1051
|
+
const {
|
|
1052
|
+
notifyValue,
|
|
1053
|
+
notifyDate
|
|
1054
|
+
} = this.disposeCallbackArgs(cachedSelectedValue);
|
|
1055
|
+
|
|
1056
|
+
this._adapter.notifyConfirm(notifyDate, notifyValue);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
handleCancel() {
|
|
1061
|
+
this.closePanel();
|
|
1062
|
+
const value = this.getState('value');
|
|
1063
|
+
const {
|
|
1064
|
+
notifyValue,
|
|
1065
|
+
notifyDate
|
|
1066
|
+
} = this.disposeCallbackArgs(value);
|
|
1067
|
+
|
|
1068
|
+
this._adapter.notifyCancel(notifyDate, notifyValue);
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
handlePresetClick(item, e) {
|
|
1072
|
+
const {
|
|
1073
|
+
type,
|
|
1074
|
+
timeZone
|
|
1075
|
+
} = this.getProps();
|
|
1076
|
+
const prevTimeZone = this.getState('prevTimezone');
|
|
1077
|
+
let value;
|
|
1078
|
+
|
|
1079
|
+
switch (type) {
|
|
1080
|
+
case 'month':
|
|
1081
|
+
case 'dateTime':
|
|
1082
|
+
case 'date':
|
|
1083
|
+
value = this.parseWithTimezone([item.start], timeZone, prevTimeZone);
|
|
1084
|
+
this.handleSelectedChange(value);
|
|
1085
|
+
break;
|
|
1086
|
+
|
|
1087
|
+
case 'dateTimeRange':
|
|
1088
|
+
case 'dateRange':
|
|
1089
|
+
value = this.parseWithTimezone([item.start, item.end], timeZone, prevTimeZone);
|
|
1090
|
+
this.handleSelectedChange(value, {
|
|
1091
|
+
needCheckFocusRecord: false
|
|
1092
|
+
});
|
|
1093
|
+
break;
|
|
1094
|
+
|
|
1095
|
+
default:
|
|
1096
|
+
break;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
this._adapter.notifyPresetsClick(item, e);
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* 根据 type 处理 onChange 返回的参数
|
|
1103
|
+
*
|
|
1104
|
+
* - 返回的日期需要把用户时间转换为设置的时区时间
|
|
1105
|
+
* - 用户时间:用户计算机系统时间
|
|
1106
|
+
* - 时区时间:通过 ConfigProvider 设置的 timeZone
|
|
1107
|
+
* - 例子:用户设置时区为+9,计算机所在时区为+8区,然后用户选择了22:00
|
|
1108
|
+
* - DatePicker 内部保存日期 state 为 +8 的 22:00 => a = new Date("2021-05-25 22:00:00")
|
|
1109
|
+
* - 传出去时,需要把 +8 的 22:00 => +9 的 22:00 => b = zonedTimeToUtc(a, "+09:00");
|
|
1110
|
+
*
|
|
1111
|
+
* According to the type processing onChange returned parameters
|
|
1112
|
+
*
|
|
1113
|
+
* - the returned date needs to convert the user time to the set time zone time
|
|
1114
|
+
* - user time: user computer system time
|
|
1115
|
+
* - time zone time: timeZone set by ConfigProvider
|
|
1116
|
+
* - example: the user sets the time zone to + 9, the computer's time zone is + 8 zone, and then the user selects 22:00
|
|
1117
|
+
* - DatePicker internal save date state is + 8 22:00 = > a = new Date ("2021-05-25 22:00:00")
|
|
1118
|
+
* - when passed out, you need to + 8 22:00 = > + 9 22:00 = > b = zonedTimeToUtc (a, "+ 09:00");
|
|
1119
|
+
*
|
|
1120
|
+
* e.g.
|
|
1121
|
+
* let a = new Date ("2021-05-25 22:00:00");
|
|
1122
|
+
* = > Tue May 25 2021 22:00:00 GMT + 0800 (China Standard Time)
|
|
1123
|
+
* let b = zonedTimeToUtc (a, "+ 09:00");
|
|
1124
|
+
* = > Tue May 25 2021 21:00:00 GMT + 0800 (China Standard Time)
|
|
1125
|
+
*
|
|
1126
|
+
* @param {Date|Date[]} value
|
|
1127
|
+
* @return {{ notifyDate: Date|Date[], notifyValue: string|string[]}}
|
|
1128
|
+
*/
|
|
1129
|
+
|
|
1130
|
+
|
|
1131
|
+
disposeCallbackArgs(value) {
|
|
1132
|
+
let _value = Array.isArray(value) ? value : value && [value] || [];
|
|
1133
|
+
|
|
1134
|
+
if (this.isValidTimeZone()) {
|
|
1135
|
+
const timeZone = this.getProp('timeZone');
|
|
1136
|
+
_value = _value.map(date => zonedTimeToUtc(date, timeZone));
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
const type = this.getProp('type');
|
|
1140
|
+
const formatToken = this.getProp('format') || getDefaultFormatTokenByType(type);
|
|
1141
|
+
let notifyValue, notifyDate;
|
|
1142
|
+
|
|
1143
|
+
switch (type) {
|
|
1144
|
+
case 'date':
|
|
1145
|
+
case 'dateTime':
|
|
1146
|
+
case 'month':
|
|
1147
|
+
if (!this._isMultiple()) {
|
|
1148
|
+
notifyValue = _value[0] && this.localeFormat(_value[0], formatToken);
|
|
1149
|
+
[notifyDate] = _value;
|
|
1150
|
+
} else {
|
|
1151
|
+
notifyValue = _value.map(v => v && this.localeFormat(v, formatToken));
|
|
1152
|
+
notifyDate = [..._value];
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
break;
|
|
1156
|
+
|
|
1157
|
+
case 'dateRange':
|
|
1158
|
+
case 'dateTimeRange':
|
|
1159
|
+
notifyValue = _value.map(v => v && this.localeFormat(v, formatToken));
|
|
1160
|
+
notifyDate = [..._value];
|
|
1161
|
+
break;
|
|
1162
|
+
|
|
1163
|
+
default:
|
|
1164
|
+
break;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
return {
|
|
1168
|
+
notifyValue,
|
|
1169
|
+
notifyDate
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Notice: Check whether the date is the same as the state value before calling
|
|
1174
|
+
* @param {Date[]} value
|
|
1175
|
+
*/
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
_notifyChange(value) {
|
|
1179
|
+
if (this._isRangeType() && !this._isRangeValueComplete(value)) {
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
const {
|
|
1184
|
+
onChangeWithDateFirst
|
|
1185
|
+
} = this.getProps();
|
|
1186
|
+
const {
|
|
1187
|
+
notifyValue,
|
|
1188
|
+
notifyDate
|
|
1189
|
+
} = this.disposeCallbackArgs(value);
|
|
1190
|
+
|
|
1191
|
+
if (onChangeWithDateFirst) {
|
|
1192
|
+
this._adapter.notifyChange(notifyDate, notifyValue);
|
|
1193
|
+
} else {
|
|
1194
|
+
this._adapter.notifyChange(notifyValue, notifyDate);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1198
|
+
* Get the date changed through the date panel or enter
|
|
1199
|
+
* @param {Date[]} dates
|
|
1200
|
+
* @returns {Date[]}
|
|
1201
|
+
*/
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
_getChangedDates(dates) {
|
|
1205
|
+
const type = this._adapter.getProp('type');
|
|
1206
|
+
|
|
1207
|
+
const stateValue = this._adapter.getState('value');
|
|
1208
|
+
|
|
1209
|
+
const changedDates = [];
|
|
1210
|
+
|
|
1211
|
+
switch (type) {
|
|
1212
|
+
case 'dateRange':
|
|
1213
|
+
case 'dateTimeRange':
|
|
1214
|
+
const [stateStart, stateEnd] = stateValue;
|
|
1215
|
+
const [start, end] = dates;
|
|
1216
|
+
|
|
1217
|
+
if (!isDateEqual(start, stateStart)) {
|
|
1218
|
+
changedDates.push(start);
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
if (!isDateEqual(end, stateEnd)) {
|
|
1222
|
+
changedDates.push(end);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
break;
|
|
1226
|
+
|
|
1227
|
+
default:
|
|
1228
|
+
const stateValueSet = new Set();
|
|
1229
|
+
stateValue.forEach(value => stateValueSet.add(isDate(value) && value.valueOf()));
|
|
1230
|
+
|
|
1231
|
+
for (const date of dates) {
|
|
1232
|
+
if (!stateValueSet.has(isDate(date) && date.valueOf())) {
|
|
1233
|
+
changedDates.push(date);
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
return changedDates;
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Whether a date is disabled
|
|
1243
|
+
* @param {Array} value
|
|
1244
|
+
*/
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
_someDateDisabled(value) {
|
|
1248
|
+
const stateValue = this.getState('value');
|
|
1249
|
+
const {
|
|
1250
|
+
rangeInputFocus
|
|
1251
|
+
} = this.getStates();
|
|
1252
|
+
const disabledOptions = {
|
|
1253
|
+
rangeStart: '',
|
|
1254
|
+
rangeEnd: '',
|
|
1255
|
+
rangeInputFocus
|
|
1256
|
+
}; // DisabledDate needs to pass the second parameter
|
|
1257
|
+
|
|
1258
|
+
if (this._isRangeType() && Array.isArray(stateValue)) {
|
|
1259
|
+
if (isValid(stateValue[0])) {
|
|
1260
|
+
const rangeStart = format(stateValue[0], 'yyyy-MM-dd');
|
|
1261
|
+
disabledOptions.rangeStart = rangeStart;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
if (isValid(stateValue[1])) {
|
|
1265
|
+
const rangeEnd = format(stateValue[1], 'yyyy-MM-dd');
|
|
1266
|
+
disabledOptions.rangeEnd = rangeEnd;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
let isSomeDateDisabled = false;
|
|
1271
|
+
|
|
1272
|
+
for (const date of value) {
|
|
1273
|
+
// skip check if date is null
|
|
1274
|
+
if (!isNullOrUndefined(date) && this.disabledDisposeDate(date, disabledOptions)) {
|
|
1275
|
+
isSomeDateDisabled = true;
|
|
1276
|
+
break;
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
return isSomeDateDisabled;
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Format locale date
|
|
1284
|
+
* locale get from LocaleProvider
|
|
1285
|
+
* @param {Date} date
|
|
1286
|
+
* @param {String} token
|
|
1287
|
+
*/
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
localeFormat(date, token) {
|
|
1291
|
+
const dateFnsLocale = this._adapter.getProp('dateFnsLocale');
|
|
1292
|
+
|
|
1293
|
+
return format(date, token, {
|
|
1294
|
+
locale: dateFnsLocale
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* Convert computer date to UTC date
|
|
1299
|
+
* Before passing the date to the user, you need to convert the date to UTC time
|
|
1300
|
+
* dispose date from computer date to utc date
|
|
1301
|
+
* When given timeZone prop, you should convert computer date to utc date before passing to user
|
|
1302
|
+
* @param {(date: Date) => Boolean} fn
|
|
1303
|
+
* @param {Date|Date[]} date
|
|
1304
|
+
* @returns {Boolean}
|
|
1305
|
+
*/
|
|
1306
|
+
|
|
1307
|
+
|
|
1308
|
+
disposeDateFn(fn, date) {
|
|
1309
|
+
const {
|
|
1310
|
+
notifyDate
|
|
1311
|
+
} = this.disposeCallbackArgs(date);
|
|
1312
|
+
const dateIsArray = Array.isArray(date);
|
|
1313
|
+
const notifyDateIsArray = Array.isArray(notifyDate);
|
|
1314
|
+
let disposeDate;
|
|
1315
|
+
|
|
1316
|
+
if (dateIsArray === notifyDateIsArray) {
|
|
1317
|
+
disposeDate = notifyDate;
|
|
1318
|
+
} else {
|
|
1319
|
+
disposeDate = dateIsArray ? [notifyDate] : notifyDate[0];
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1323
|
+
rest[_key - 2] = arguments[_key];
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
return fn(disposeDate, ...rest);
|
|
1327
|
+
}
|
|
1328
|
+
/**
|
|
1329
|
+
* Determine whether the date is disabled
|
|
1330
|
+
* Whether the date is disabled
|
|
1331
|
+
* @param {Date} date
|
|
1332
|
+
* @returns {Boolean}
|
|
1333
|
+
*/
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
disabledDisposeDate(date) {
|
|
1337
|
+
const {
|
|
1338
|
+
disabledDate
|
|
1339
|
+
} = this.getProps();
|
|
1340
|
+
|
|
1341
|
+
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1342
|
+
rest[_key2 - 1] = arguments[_key2];
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
return this.disposeDateFn(disabledDate, date, ...rest);
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Determine whether the date is disabled
|
|
1349
|
+
* Whether the date time is disabled
|
|
1350
|
+
* @param {Date|Date[]} date
|
|
1351
|
+
* @returns {Object}
|
|
1352
|
+
*/
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
disabledDisposeTime(date) {
|
|
1356
|
+
const {
|
|
1357
|
+
disabledTime
|
|
1358
|
+
} = this.getProps();
|
|
1359
|
+
|
|
1360
|
+
for (var _len3 = arguments.length, rest = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
1361
|
+
rest[_key3 - 1] = arguments[_key3];
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
return this.disposeDateFn(disabledTime, date, ...rest);
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Trigger wrapper needs to do two things:
|
|
1368
|
+
* 1. Open Panel when clicking trigger;
|
|
1369
|
+
* 2. When clicking on a child but the child does not listen to the focus event, manually trigger focus
|
|
1370
|
+
*
|
|
1371
|
+
* @param {Event} e
|
|
1372
|
+
* @returns
|
|
1373
|
+
*/
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
handleTriggerWrapperClick(e) {
|
|
1377
|
+
const {
|
|
1378
|
+
disabled,
|
|
1379
|
+
triggerRender
|
|
1380
|
+
} = this._adapter.getProps();
|
|
1381
|
+
|
|
1382
|
+
const {
|
|
1383
|
+
rangeInputFocus
|
|
1384
|
+
} = this._adapter.getStates();
|
|
1385
|
+
|
|
1386
|
+
if (disabled) {
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* - 非范围选择时,trigger 为原生输入框,已在组件内处理了 focus 逻辑
|
|
1391
|
+
* - isEventTarget 函数用于判断触发事件的是否为 input wrapper。如果是冒泡上来的不用处理,因为在子级已经处理了 focus 逻辑。
|
|
1392
|
+
*
|
|
1393
|
+
* - When type is not range type, Input component will automatically focus in the same case
|
|
1394
|
+
* - isEventTarget is used to judge whether the event is a bubbling event
|
|
1395
|
+
*/
|
|
1396
|
+
|
|
1397
|
+
|
|
1398
|
+
if (this._isRangeType() && !rangeInputFocus) {
|
|
1399
|
+
if (this._adapter.isEventTarget(e)) {
|
|
1400
|
+
setTimeout(() => {
|
|
1401
|
+
// using setTimeout get correct state value 'rangeInputFocus'
|
|
1402
|
+
this.handleInputFocus(e, 'rangeStart');
|
|
1403
|
+
}, 0);
|
|
1404
|
+
} else if (_isFunction(triggerRender)) {
|
|
1405
|
+
// 如果是 triggerRender 场景,因为没有 input,因此打开面板时默认 focus 在 rangeStart
|
|
1406
|
+
// If it is a triggerRender scene, because there is no input, the default focus is rangeStart when the panel is opened
|
|
1407
|
+
this._adapter.setRangeInputFocus('rangeStart');
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
this.openPanel();
|
|
1411
|
+
} else {
|
|
1412
|
+
this.openPanel();
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
handlePanelVisibleChange(visible) {
|
|
1417
|
+
if (visible) {
|
|
1418
|
+
this._adapter.setInsetInputFocus();
|
|
1419
|
+
/**
|
|
1420
|
+
* After the panel is closed, the trigger input is disabled
|
|
1421
|
+
* 面板关闭后,trigger input 禁用
|
|
1422
|
+
*/
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
setTimeout(() => {
|
|
1426
|
+
this._adapter.setTriggerDisabled(true);
|
|
1427
|
+
}, 0);
|
|
1428
|
+
} else {
|
|
1429
|
+
this._adapter.setTriggerDisabled(false);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
}
|