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