@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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _isEqual from "lodash/isEqual";
|
|
2
2
|
import _isSet from "lodash/isSet";
|
|
3
3
|
import _includes from "lodash/includes";
|
|
4
|
-
|
|
5
4
|
/* eslint-disable max-len */
|
|
6
5
|
import BaseFoundation from '../base/foundation';
|
|
7
6
|
import { strings } from './constants';
|
|
@@ -24,31 +23,26 @@ const dateCalcFns = {
|
|
|
24
23
|
};
|
|
25
24
|
export default class MonthsGridFoundation extends BaseFoundation {
|
|
26
25
|
constructor(adapter) {
|
|
27
|
-
super(Object.assign({}, adapter));
|
|
28
|
-
|
|
26
|
+
super(Object.assign({}, adapter));
|
|
27
|
+
// Date change data when double panels
|
|
29
28
|
this.newBiMonthPanelDate = [this.getState('monthLeft').pickerDate, this.getState('monthRight').pickerDate];
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
init() {
|
|
33
31
|
const defaultValue = this.getProp('defaultValue');
|
|
34
32
|
this.initDefaultPickerValue();
|
|
35
33
|
this.updateSelectedFromProps(defaultValue);
|
|
36
34
|
}
|
|
37
|
-
|
|
38
35
|
initDefaultPickerValue() {
|
|
39
36
|
const defaultPickerValue = compatibleParse(this.getProp('defaultPickerValue'));
|
|
40
|
-
|
|
41
37
|
if (defaultPickerValue && isValidDate(defaultPickerValue)) {
|
|
42
38
|
this._updatePanelDetail(strings.PANEL_TYPE_LEFT, {
|
|
43
39
|
pickerDate: defaultPickerValue
|
|
44
40
|
});
|
|
45
|
-
|
|
46
41
|
this._updatePanelDetail(strings.PANEL_TYPE_RIGHT, {
|
|
47
42
|
pickerDate: addMonths(defaultPickerValue, 1)
|
|
48
43
|
});
|
|
49
44
|
}
|
|
50
45
|
}
|
|
51
|
-
|
|
52
46
|
updateSelectedFromProps(values) {
|
|
53
47
|
let refreshPicker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
54
48
|
const type = this.getProp('type');
|
|
@@ -57,29 +51,20 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
57
51
|
rangeStart,
|
|
58
52
|
rangeEnd
|
|
59
53
|
} = this.getStates();
|
|
60
|
-
|
|
61
54
|
if (values && (values === null || values === void 0 ? void 0 : values.length)) {
|
|
62
55
|
switch (type) {
|
|
63
56
|
case 'date':
|
|
64
57
|
this._initDatePickerFromValue(values, refreshPicker);
|
|
65
|
-
|
|
66
58
|
break;
|
|
67
|
-
|
|
68
59
|
case 'dateRange':
|
|
69
60
|
this._initDateRangePickerFromValue(values);
|
|
70
|
-
|
|
71
61
|
break;
|
|
72
|
-
|
|
73
62
|
case 'dateTime':
|
|
74
63
|
this._initDateTimePickerFromValue(values);
|
|
75
|
-
|
|
76
64
|
break;
|
|
77
|
-
|
|
78
65
|
case 'dateTimeRange':
|
|
79
66
|
this._initDateTimeRangePickerFormValue(values);
|
|
80
|
-
|
|
81
67
|
break;
|
|
82
|
-
|
|
83
68
|
default:
|
|
84
69
|
break;
|
|
85
70
|
}
|
|
@@ -88,23 +73,19 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
88
73
|
if (_isSet(selected) && selected.size) {
|
|
89
74
|
this._adapter.updateDaySelected(new Set());
|
|
90
75
|
}
|
|
91
|
-
|
|
92
76
|
if (rangeStart) {
|
|
93
77
|
this._adapter.setRangeStart('');
|
|
94
78
|
}
|
|
95
|
-
|
|
96
79
|
if (rangeEnd) {
|
|
97
80
|
this._adapter.setRangeEnd('');
|
|
98
81
|
}
|
|
99
82
|
}
|
|
100
83
|
}
|
|
101
|
-
|
|
102
84
|
calcDisabledTime(panelType) {
|
|
103
85
|
const {
|
|
104
86
|
disabledTime,
|
|
105
87
|
type
|
|
106
88
|
} = this.getProps();
|
|
107
|
-
|
|
108
89
|
if (typeof disabledTime === 'function' && panelType && ['dateTime', 'dateTimeRange'].includes(type)) {
|
|
109
90
|
const {
|
|
110
91
|
rangeStart,
|
|
@@ -112,40 +93,31 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
112
93
|
monthLeft
|
|
113
94
|
} = this.getStates();
|
|
114
95
|
const selected = [];
|
|
115
|
-
|
|
116
96
|
if (type === 'dateTimeRange') {
|
|
117
97
|
if (rangeStart) {
|
|
118
98
|
selected.push(rangeStart);
|
|
119
99
|
}
|
|
120
|
-
|
|
121
100
|
if (rangeStart && rangeEnd) {
|
|
122
101
|
selected.push(rangeEnd);
|
|
123
102
|
}
|
|
124
103
|
} else if (monthLeft && monthLeft.showDate) {
|
|
125
104
|
selected.push(monthLeft.showDate);
|
|
126
105
|
}
|
|
127
|
-
|
|
128
106
|
const selectedDates = selected.map(str => str instanceof Date ? str : parseISO(str));
|
|
129
107
|
const cbDates = type === 'dateTimeRange' ? selectedDates : selectedDates[0];
|
|
130
108
|
return disabledTime(cbDates, panelType);
|
|
131
109
|
}
|
|
132
110
|
}
|
|
133
|
-
|
|
134
111
|
_initDatePickerFromValue(values) {
|
|
135
112
|
let refreshPicker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
136
|
-
|
|
137
113
|
const {
|
|
138
114
|
monthLeft
|
|
139
115
|
} = this._adapter.getStates();
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
116
|
+
const newMonthLeft = Object.assign({}, monthLeft);
|
|
117
|
+
// REMOVE:
|
|
143
118
|
this._adapter.updateMonthOnLeft(newMonthLeft);
|
|
144
|
-
|
|
145
119
|
const newSelected = new Set();
|
|
146
|
-
|
|
147
120
|
const isMultiple = this._isMultiple();
|
|
148
|
-
|
|
149
121
|
if (!isMultiple) {
|
|
150
122
|
values[0] && newSelected.add(format(values[0], strings.FORMAT_FULL_DATE));
|
|
151
123
|
} else {
|
|
@@ -153,7 +125,6 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
153
125
|
date && newSelected.add(format(date, strings.FORMAT_FULL_DATE));
|
|
154
126
|
});
|
|
155
127
|
}
|
|
156
|
-
|
|
157
128
|
if (refreshPicker) {
|
|
158
129
|
if (isMultiple) {
|
|
159
130
|
const leftPickerDateInSelected = values === null || values === void 0 ? void 0 : values.some(item => item && differenceInCalendarMonths(item, monthLeft.pickerDate) === 0);
|
|
@@ -165,66 +136,52 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
165
136
|
// FIXME:
|
|
166
137
|
this.handleShowDateAndTime(strings.PANEL_TYPE_LEFT, newMonthLeft.pickerDate);
|
|
167
138
|
}
|
|
168
|
-
|
|
169
139
|
this._adapter.updateDaySelected(newSelected);
|
|
170
140
|
}
|
|
171
|
-
|
|
172
141
|
_initDateRangePickerFromValue(values) {
|
|
173
142
|
let withTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
174
143
|
// init month panel
|
|
175
144
|
const monthLeft = this.getState('monthLeft');
|
|
176
145
|
const monthRight = this.getState('monthRight');
|
|
177
|
-
|
|
178
146
|
const adjustResult = this._autoAdjustMonth(Object.assign(Object.assign({}, monthLeft), {
|
|
179
147
|
pickerDate: values[0] || monthLeft.pickerDate
|
|
180
148
|
}), Object.assign(Object.assign({}, monthRight), {
|
|
181
149
|
pickerDate: values[1] || monthRight.pickerDate
|
|
182
150
|
}));
|
|
183
|
-
|
|
184
151
|
const validValue = Array.isArray(values) && values.filter(item => item).length > 1;
|
|
185
|
-
|
|
186
152
|
if (validValue) {
|
|
187
153
|
this.handleShowDateAndTime(strings.PANEL_TYPE_LEFT, adjustResult.monthLeft.pickerDate);
|
|
188
154
|
this.handleShowDateAndTime(strings.PANEL_TYPE_RIGHT, adjustResult.monthRight.pickerDate);
|
|
189
155
|
} else {
|
|
190
|
-
const selectedDate = values.find(item => item);
|
|
191
|
-
|
|
156
|
+
const selectedDate = values.find(item => item);
|
|
157
|
+
// 如果日期不完整且输入日期不在面板范围内,则更新面板
|
|
192
158
|
if (selectedDate) {
|
|
193
159
|
const notLeftPanelDate = Math.abs(differenceInCalendarMonths(selectedDate, monthLeft.pickerDate)) > 0;
|
|
194
160
|
const notRightPanelDate = Math.abs(differenceInCalendarMonths(selectedDate, monthRight.pickerDate)) > 0;
|
|
195
|
-
|
|
196
161
|
if (notLeftPanelDate && notRightPanelDate) {
|
|
197
162
|
this.handleShowDateAndTime(strings.PANEL_TYPE_LEFT, adjustResult.monthLeft.pickerDate);
|
|
198
163
|
this.handleShowDateAndTime(strings.PANEL_TYPE_RIGHT, adjustResult.monthRight.pickerDate);
|
|
199
164
|
}
|
|
200
165
|
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
166
|
+
}
|
|
167
|
+
// init range
|
|
204
168
|
const formatToken = withTime ? strings.FORMAT_DATE_TIME : strings.FORMAT_FULL_DATE;
|
|
205
169
|
let rangeStart = values[0] && format(values[0], formatToken);
|
|
206
170
|
let rangeEnd = values[1] && format(values[1], formatToken);
|
|
207
|
-
|
|
208
171
|
if (this._isNeedSwap(rangeStart, rangeEnd)) {
|
|
209
172
|
[rangeStart, rangeEnd] = [rangeEnd, rangeStart];
|
|
210
173
|
}
|
|
211
|
-
|
|
212
174
|
this._adapter.setRangeStart(rangeStart);
|
|
213
|
-
|
|
214
175
|
this._adapter.setRangeEnd(rangeEnd);
|
|
215
|
-
|
|
216
176
|
this._adapter.setHoverDay(rangeEnd);
|
|
217
177
|
}
|
|
218
|
-
|
|
219
178
|
_initDateTimePickerFromValue(values) {
|
|
220
179
|
this._initDatePickerFromValue(values);
|
|
221
180
|
}
|
|
222
|
-
|
|
223
181
|
_initDateTimeRangePickerFormValue(values) {
|
|
224
182
|
this._initDateRangePickerFromValue(values, true);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
183
|
+
}
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
228
185
|
destroy() {}
|
|
229
186
|
/**
|
|
230
187
|
* sync change another panel month when change months from the else yam panel
|
|
@@ -235,23 +192,18 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
235
192
|
* - panelType=right, target=new Date('2022-09-01') and left panel is in '2022-09' => call it, left panel minus one month to '2022-08'
|
|
236
193
|
* - panelType=left, target=new Date('2021-12-01') and right panel is in '2021-12' => call it, right panel add one month to '2021-01'
|
|
237
194
|
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
195
|
handleSyncChangeMonths(options) {
|
|
241
196
|
const {
|
|
242
197
|
panelType,
|
|
243
198
|
target
|
|
244
199
|
} = options;
|
|
245
|
-
|
|
246
200
|
const {
|
|
247
201
|
type
|
|
248
202
|
} = this._adapter.getProps();
|
|
249
|
-
|
|
250
203
|
const {
|
|
251
204
|
monthLeft,
|
|
252
205
|
monthRight
|
|
253
206
|
} = this._adapter.getStates();
|
|
254
|
-
|
|
255
207
|
if (this.isRangeType(type)) {
|
|
256
208
|
if (panelType === 'right' && differenceInCalendarMonths(target, monthLeft.pickerDate) === 0) {
|
|
257
209
|
this.handleYearOrMonthChange('prevMonth', 'left', 1, true);
|
|
@@ -263,56 +215,42 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
263
215
|
/**
|
|
264
216
|
* Get the target date based on the panel type and switch type
|
|
265
217
|
*/
|
|
266
|
-
|
|
267
|
-
|
|
268
218
|
getTargetChangeDate(options) {
|
|
269
219
|
const {
|
|
270
220
|
panelType,
|
|
271
221
|
switchType
|
|
272
222
|
} = options;
|
|
273
|
-
|
|
274
223
|
const {
|
|
275
224
|
monthRight,
|
|
276
225
|
monthLeft
|
|
277
226
|
} = this._adapter.getStates();
|
|
278
|
-
|
|
279
227
|
const currentDate = panelType === 'left' ? monthLeft.pickerDate : monthRight.pickerDate;
|
|
280
228
|
let target;
|
|
281
|
-
|
|
282
229
|
switch (switchType) {
|
|
283
230
|
case 'prevMonth':
|
|
284
231
|
target = addMonths(currentDate, -1);
|
|
285
232
|
break;
|
|
286
|
-
|
|
287
233
|
case 'nextMonth':
|
|
288
234
|
target = addMonths(currentDate, 1);
|
|
289
235
|
break;
|
|
290
|
-
|
|
291
236
|
case 'prevYear':
|
|
292
237
|
target = addYears(currentDate, -1);
|
|
293
238
|
break;
|
|
294
|
-
|
|
295
239
|
case 'nextYear':
|
|
296
240
|
target = addYears(currentDate, 1);
|
|
297
241
|
break;
|
|
298
242
|
}
|
|
299
|
-
|
|
300
243
|
return target;
|
|
301
244
|
}
|
|
302
245
|
/**
|
|
303
246
|
* Change month by yam panel
|
|
304
247
|
*/
|
|
305
|
-
|
|
306
|
-
|
|
307
248
|
toMonth(panelType, target) {
|
|
308
249
|
const {
|
|
309
250
|
type
|
|
310
251
|
} = this._adapter.getProps();
|
|
311
|
-
|
|
312
252
|
const diff = this._getDiff('month', target, panelType);
|
|
313
|
-
|
|
314
253
|
this.handleYearOrMonthChange(diff < 0 ? 'prevMonth' : 'nextMonth', panelType, Math.abs(diff), false);
|
|
315
|
-
|
|
316
254
|
if (this.isRangeType(type)) {
|
|
317
255
|
this.handleSyncChangeMonths({
|
|
318
256
|
panelType,
|
|
@@ -320,18 +258,14 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
320
258
|
});
|
|
321
259
|
}
|
|
322
260
|
}
|
|
323
|
-
|
|
324
261
|
toYear(panelType, target) {
|
|
325
262
|
const diff = this._getDiff('year', target, panelType);
|
|
326
|
-
|
|
327
263
|
this.handleYearOrMonthChange(diff < 0 ? 'prevYear' : 'nextYear', panelType, Math.abs(diff), false);
|
|
328
264
|
}
|
|
329
|
-
|
|
330
265
|
toYearMonth(panelType, target) {
|
|
331
266
|
this.toYear(panelType, target);
|
|
332
267
|
this.toMonth(panelType, target);
|
|
333
268
|
}
|
|
334
|
-
|
|
335
269
|
isRangeType(type) {
|
|
336
270
|
const {
|
|
337
271
|
type: typeFromProp
|
|
@@ -339,14 +273,13 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
339
273
|
const realType = type ? type : typeFromProp;
|
|
340
274
|
return typeof realType === 'string' && /range/i.test(realType);
|
|
341
275
|
}
|
|
342
|
-
|
|
343
276
|
handleSwitchMonthOrYear(switchType, panelType) {
|
|
344
277
|
const {
|
|
345
278
|
type,
|
|
346
279
|
syncSwitchMonth
|
|
347
280
|
} = this.getProps();
|
|
348
|
-
const rangeType = this.isRangeType(type);
|
|
349
|
-
|
|
281
|
+
const rangeType = this.isRangeType(type);
|
|
282
|
+
// range type and syncSwitchMonth, we should change panels at same time
|
|
350
283
|
if (rangeType && syncSwitchMonth) {
|
|
351
284
|
this.handleYearOrMonthChange(switchType, 'left', 1, true);
|
|
352
285
|
this.handleYearOrMonthChange(switchType, 'right', 1, true);
|
|
@@ -357,7 +290,6 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
357
290
|
* In order to prevent the two panels from being the same month, this will confuse the user when selecting the range
|
|
358
291
|
* https://github.com/DouyinFE/semi-design/issues/260
|
|
359
292
|
*/
|
|
360
|
-
|
|
361
293
|
if (rangeType) {
|
|
362
294
|
const target = this.getTargetChangeDate({
|
|
363
295
|
panelType,
|
|
@@ -370,34 +302,26 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
370
302
|
}
|
|
371
303
|
}
|
|
372
304
|
}
|
|
373
|
-
|
|
374
305
|
prevMonth(panelType) {
|
|
375
306
|
this.handleSwitchMonthOrYear('prevMonth', panelType);
|
|
376
307
|
}
|
|
377
|
-
|
|
378
308
|
nextMonth(panelType) {
|
|
379
309
|
this.handleSwitchMonthOrYear('nextMonth', panelType);
|
|
380
310
|
}
|
|
381
|
-
|
|
382
311
|
prevYear(panelType) {
|
|
383
312
|
this.handleSwitchMonthOrYear('prevYear', panelType);
|
|
384
313
|
}
|
|
385
|
-
|
|
386
314
|
nextYear(panelType) {
|
|
387
315
|
this.handleSwitchMonthOrYear('nextYear', panelType);
|
|
388
316
|
}
|
|
389
317
|
/**
|
|
390
318
|
* Calculate the year and month difference
|
|
391
319
|
*/
|
|
392
|
-
|
|
393
|
-
|
|
394
320
|
_getDiff(type, target, panelType) {
|
|
395
321
|
const panelDetail = this._getPanelDetail(panelType);
|
|
396
|
-
|
|
397
322
|
const diff = dateDiffFns[type] && dateDiffFns[type](target, panelDetail.pickerDate);
|
|
398
323
|
return diff;
|
|
399
324
|
}
|
|
400
|
-
|
|
401
325
|
_getPanelDetail(panelType) {
|
|
402
326
|
return panelType === strings.PANEL_TYPE_RIGHT ? this.getState('monthRight') : this.getState('monthLeft');
|
|
403
327
|
}
|
|
@@ -408,11 +332,8 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
408
332
|
* @param {String} token
|
|
409
333
|
* @returns
|
|
410
334
|
*/
|
|
411
|
-
|
|
412
|
-
|
|
413
335
|
localeFormat(date, token) {
|
|
414
336
|
const dateFnsLocale = this._adapter.getProp('dateFnsLocale');
|
|
415
|
-
|
|
416
337
|
return format(date, token, {
|
|
417
338
|
locale: dateFnsLocale
|
|
418
339
|
});
|
|
@@ -444,21 +365,15 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
444
365
|
*
|
|
445
366
|
* @param {Date|Date[]} value
|
|
446
367
|
*/
|
|
447
|
-
|
|
448
|
-
|
|
449
368
|
disposeCallbackArgs(value) {
|
|
450
369
|
let _value = Array.isArray(value) ? value : value && [value] || [];
|
|
451
|
-
|
|
452
370
|
const timeZone = this.getProp('timeZone');
|
|
453
|
-
|
|
454
371
|
if (isValidTimeZone(timeZone)) {
|
|
455
372
|
_value = _value.map(date => zonedTimeToUtc(date, timeZone));
|
|
456
373
|
}
|
|
457
|
-
|
|
458
374
|
const type = this.getProp('type');
|
|
459
375
|
const formatToken = this.getProp('format') || getDefaultFormatTokenByType(type);
|
|
460
376
|
let notifyValue, notifyDate;
|
|
461
|
-
|
|
462
377
|
switch (type) {
|
|
463
378
|
case 'date':
|
|
464
379
|
case 'dateTime':
|
|
@@ -470,25 +385,20 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
470
385
|
notifyValue = _value.map(v => v && this.localeFormat(v, formatToken));
|
|
471
386
|
notifyDate = [..._value];
|
|
472
387
|
}
|
|
473
|
-
|
|
474
388
|
break;
|
|
475
|
-
|
|
476
389
|
case 'dateRange':
|
|
477
390
|
case 'dateTimeRange':
|
|
478
391
|
notifyValue = _value.map(v => v && this.localeFormat(v, formatToken));
|
|
479
392
|
notifyDate = [..._value];
|
|
480
393
|
break;
|
|
481
|
-
|
|
482
394
|
default:
|
|
483
395
|
break;
|
|
484
396
|
}
|
|
485
|
-
|
|
486
397
|
return {
|
|
487
398
|
notifyValue,
|
|
488
399
|
notifyDate
|
|
489
400
|
};
|
|
490
401
|
}
|
|
491
|
-
|
|
492
402
|
handleYearOrMonthChange(type) {
|
|
493
403
|
let panelType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : strings.PANEL_TYPE_LEFT;
|
|
494
404
|
let step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
@@ -503,21 +413,17 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
503
413
|
} = this.getStates();
|
|
504
414
|
const isRangeType = this.isRangeType(datePanelType);
|
|
505
415
|
const isLeftPanelInRange = isRangeType && panelType === strings.PANEL_TYPE_LEFT;
|
|
506
|
-
|
|
507
416
|
const panelDetail = this._getPanelDetail(panelType);
|
|
508
|
-
|
|
509
417
|
const {
|
|
510
418
|
pickerDate
|
|
511
419
|
} = panelDetail;
|
|
512
420
|
const fn = dateCalcFns[type];
|
|
513
|
-
const targetMonth = fn(pickerDate, step);
|
|
514
|
-
|
|
421
|
+
const targetMonth = fn(pickerDate, step);
|
|
422
|
+
// Determine if the date has changed
|
|
515
423
|
const panelDateHasUpdate = panelType === strings.PANEL_TYPE_LEFT && !_isEqual(targetMonth, monthLeft.pickerDate) || panelType === strings.PANEL_TYPE_RIGHT && !_isEqual(targetMonth, monthRight.pickerDate);
|
|
516
|
-
|
|
517
424
|
this._updatePanelDetail(panelType, {
|
|
518
425
|
pickerDate: targetMonth
|
|
519
426
|
});
|
|
520
|
-
|
|
521
427
|
if (panelDateHasUpdate) {
|
|
522
428
|
// When the date changes
|
|
523
429
|
if (!isRangeType) {
|
|
@@ -526,7 +432,6 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
526
432
|
notifyValue,
|
|
527
433
|
notifyDate
|
|
528
434
|
} = this.disposeCallbackArgs(targetMonth);
|
|
529
|
-
|
|
530
435
|
this._adapter.notifyPanelChange(notifyDate, notifyValue);
|
|
531
436
|
} else {
|
|
532
437
|
// Double Panel Type
|
|
@@ -537,19 +442,16 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
537
442
|
// Right panel
|
|
538
443
|
this.newBiMonthPanelDate[1] = targetMonth;
|
|
539
444
|
}
|
|
540
|
-
|
|
541
445
|
if (!(isLeftPanelInRange && notSeparateInRange)) {
|
|
542
446
|
// Not synchronously switching the left panel in the scene
|
|
543
447
|
const {
|
|
544
448
|
notifyValue,
|
|
545
449
|
notifyDate
|
|
546
450
|
} = this.disposeCallbackArgs(this.newBiMonthPanelDate);
|
|
547
|
-
|
|
548
451
|
this._adapter.notifyPanelChange(notifyDate, notifyValue);
|
|
549
452
|
}
|
|
550
453
|
}
|
|
551
454
|
}
|
|
552
|
-
|
|
553
455
|
if (autoSwitchDate) {
|
|
554
456
|
this.updateDateAfterChangeYM(type, targetMonth);
|
|
555
457
|
}
|
|
@@ -559,8 +461,6 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
559
461
|
* @param {*} type
|
|
560
462
|
* @param {*} targetDate
|
|
561
463
|
*/
|
|
562
|
-
|
|
563
|
-
|
|
564
464
|
updateDateAfterChangeYM(type, targetDate) {
|
|
565
465
|
const {
|
|
566
466
|
multiple,
|
|
@@ -572,13 +472,12 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
572
472
|
rangeStart,
|
|
573
473
|
rangeEnd,
|
|
574
474
|
monthLeft
|
|
575
|
-
} = this.getStates();
|
|
576
|
-
|
|
475
|
+
} = this.getStates();
|
|
476
|
+
// FIXME:
|
|
577
477
|
const includeRange = ['dateRange', 'dateTimeRange'].includes(type);
|
|
578
478
|
const options = {
|
|
579
479
|
closePanel: false
|
|
580
480
|
};
|
|
581
|
-
|
|
582
481
|
if (!multiple && !includeRange && selectedSet.size) {
|
|
583
482
|
const selectedStr = Array.from(selectedSet)[0];
|
|
584
483
|
const selectedDate = new Date(selectedStr);
|
|
@@ -588,7 +487,6 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
588
487
|
year,
|
|
589
488
|
month
|
|
590
489
|
});
|
|
591
|
-
|
|
592
490
|
if (dateType === 'dateTime') {
|
|
593
491
|
/**
|
|
594
492
|
* 如果是 type dateTime 切换月份要读取只取的time
|
|
@@ -596,42 +494,34 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
596
494
|
*/
|
|
597
495
|
fullDate = this._mergeDateAndTime(fullDate, monthLeft.pickerDate);
|
|
598
496
|
}
|
|
599
|
-
|
|
600
497
|
if (disabledDate(fullDate, {
|
|
601
498
|
rangeStart,
|
|
602
499
|
rangeEnd
|
|
603
500
|
})) {
|
|
604
501
|
return;
|
|
605
502
|
}
|
|
606
|
-
|
|
607
503
|
this._adapter.notifySelectedChange([fullDate], options);
|
|
608
504
|
}
|
|
609
505
|
}
|
|
610
|
-
|
|
611
506
|
_isMultiple() {
|
|
612
507
|
return Boolean(this.getProp('multiple')) && this.getProp('type') === 'date';
|
|
613
508
|
}
|
|
614
|
-
|
|
615
|
-
|
|
509
|
+
_isRange() {
|
|
510
|
+
// return this._adapter.getProp('type') === dateRangeTypeKey;
|
|
616
511
|
}
|
|
617
|
-
|
|
618
512
|
handleDayClick(day, panelType) {
|
|
619
513
|
const type = this.getProp('type');
|
|
620
|
-
|
|
621
514
|
switch (true) {
|
|
622
515
|
case type === 'date' || type === 'dateTime':
|
|
623
516
|
this.handleDateSelected(day, panelType);
|
|
624
517
|
break;
|
|
625
|
-
|
|
626
518
|
case type === 'dateRange' || type === 'dateTimeRange':
|
|
627
519
|
this.handleRangeSelected(day);
|
|
628
520
|
break;
|
|
629
|
-
|
|
630
521
|
default:
|
|
631
522
|
break;
|
|
632
523
|
}
|
|
633
524
|
}
|
|
634
|
-
|
|
635
525
|
handleDateSelected(day, panelType) {
|
|
636
526
|
const {
|
|
637
527
|
max,
|
|
@@ -639,22 +529,17 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
639
529
|
isControlledComponent,
|
|
640
530
|
dateFnsLocale
|
|
641
531
|
} = this.getProps();
|
|
642
|
-
|
|
643
532
|
const multiple = this._isMultiple();
|
|
644
|
-
|
|
645
533
|
const {
|
|
646
534
|
selected
|
|
647
535
|
} = this.getStates();
|
|
648
|
-
|
|
649
536
|
const monthDetail = this._getPanelDetail(panelType);
|
|
650
|
-
|
|
651
537
|
const newSelected = new Set(multiple ? [...selected] : []);
|
|
652
538
|
const {
|
|
653
539
|
fullDate
|
|
654
540
|
} = day;
|
|
655
541
|
const time = monthDetail.pickerDate;
|
|
656
542
|
const dateStr = type === 'dateTime' ? this._mergeDateAndTime(fullDate, time) : fullDate;
|
|
657
|
-
|
|
658
543
|
if (!multiple) {
|
|
659
544
|
newSelected.add(dateStr);
|
|
660
545
|
} else {
|
|
@@ -666,24 +551,19 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
666
551
|
newSelected.add(dateStr);
|
|
667
552
|
}
|
|
668
553
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
554
|
+
const dateFormat = this.getValidDateFormat();
|
|
555
|
+
// When passed to the upper layer, it is converted into a Date object to ensure that the input parameter format of initFormDefaultValue is consistent
|
|
672
556
|
const newSelectedDates = [...newSelected].map(_dateStr => compatibleParse(_dateStr, dateFormat, undefined, dateFnsLocale));
|
|
673
557
|
this.handleShowDateAndTime(panelType, time);
|
|
674
|
-
|
|
675
558
|
if (!isControlledComponent) {
|
|
676
559
|
// Uncontrolled components, update internal values when operating, and notify external
|
|
677
560
|
// MonthGrid internally uses string to represent fullDate for easy rendering
|
|
678
561
|
this._adapter.updateDaySelected(newSelected);
|
|
679
562
|
}
|
|
680
|
-
|
|
681
563
|
this._adapter.notifySelectedChange(newSelectedDates);
|
|
682
564
|
}
|
|
683
|
-
|
|
684
565
|
handleShowDateAndTime(panelType, pickerDate, showDate) {
|
|
685
566
|
const _showDate = showDate || pickerDate;
|
|
686
|
-
|
|
687
567
|
this._updatePanelDetail(panelType, {
|
|
688
568
|
showDate: _showDate,
|
|
689
569
|
pickerDate
|
|
@@ -696,23 +576,18 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
696
576
|
* @param {Date|string} time
|
|
697
577
|
* @returns {Date}
|
|
698
578
|
*/
|
|
699
|
-
|
|
700
|
-
|
|
701
579
|
_mergeDateAndTime(date, time) {
|
|
702
580
|
const dateFnsLocale = this._adapter.getProp('dateFnsLocale');
|
|
703
|
-
|
|
704
581
|
const dateStr = format(isValidDate(date) ? date : compatibleParse(date, strings.FORMAT_FULL_DATE, undefined, dateFnsLocale), strings.FORMAT_FULL_DATE);
|
|
705
582
|
const timeStr = format(isValidDate(time) ? time : compatibleParse(time, strings.FORMAT_TIME_PICKER, undefined, dateFnsLocale), strings.FORMAT_TIME_PICKER);
|
|
706
583
|
const timeFormat = this.getValidTimeFormat();
|
|
707
584
|
return compatibleParse(`${dateStr} ${timeStr}`, timeFormat, undefined, dateFnsLocale);
|
|
708
585
|
}
|
|
709
|
-
|
|
710
586
|
handleRangeSelected(day) {
|
|
711
587
|
let {
|
|
712
588
|
rangeStart,
|
|
713
589
|
rangeEnd
|
|
714
590
|
} = this.getStates();
|
|
715
|
-
|
|
716
591
|
const {
|
|
717
592
|
startDateOffset,
|
|
718
593
|
endDateOffset,
|
|
@@ -721,81 +596,70 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
721
596
|
rangeInputFocus,
|
|
722
597
|
triggerRender
|
|
723
598
|
} = this._adapter.getProps();
|
|
724
|
-
|
|
725
599
|
const {
|
|
726
600
|
fullDate
|
|
727
601
|
} = day;
|
|
728
602
|
let rangeStartReset = false;
|
|
729
603
|
let rangeEndReset = false;
|
|
730
604
|
const isDateRangeAndHasOffset = (startDateOffset || endDateOffset) && type === 'dateRange';
|
|
731
|
-
|
|
732
605
|
if (isDateRangeAndHasOffset) {
|
|
733
606
|
rangeStart = getFullDateOffset(startDateOffset, fullDate);
|
|
734
607
|
rangeEnd = getFullDateOffset(endDateOffset, fullDate);
|
|
735
608
|
} else {
|
|
736
609
|
if (rangeInputFocus === 'rangeEnd') {
|
|
737
|
-
rangeEnd = fullDate;
|
|
738
|
-
|
|
610
|
+
rangeEnd = fullDate;
|
|
611
|
+
// rangStart Parten in dateTime: 'yyyy-MM-dd HH:MM:SS', rangeEnd parten: 'yyyy-MM-dd'
|
|
739
612
|
if (rangeStart && rangeEnd && isBefore(rangeEnd, rangeStart.trim().split(/\s+/)[0])) {
|
|
740
613
|
rangeStart = null;
|
|
741
614
|
rangeStartReset = true;
|
|
742
|
-
}
|
|
743
|
-
|
|
615
|
+
}
|
|
616
|
+
// Compatible to select date after opening the panel without click input
|
|
744
617
|
} else if (rangeInputFocus === 'rangeStart' || !rangeInputFocus) {
|
|
745
|
-
rangeStart = fullDate;
|
|
746
|
-
|
|
618
|
+
rangeStart = fullDate;
|
|
619
|
+
// rangEnd Parten in dateTime: 'yyyy-MM-dd HH:MM:SS', rangeStart parten: 'yyyy-MM-dd'
|
|
747
620
|
if (rangeStart && rangeEnd && isBefore(rangeEnd.trim().split(/\s+/)[0], rangeStart)) {
|
|
748
621
|
rangeEnd = null;
|
|
749
622
|
rangeEndReset = true;
|
|
750
623
|
}
|
|
751
624
|
}
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
|
|
625
|
+
}
|
|
626
|
+
// next focus logic
|
|
755
627
|
const isRangeType = /range/i.test(type);
|
|
756
|
-
|
|
757
628
|
if (isRangeType) {
|
|
758
629
|
if (isDateRangeAndHasOffset) {
|
|
759
630
|
this._adapter.setRangeStart(rangeStart);
|
|
760
|
-
|
|
761
631
|
this._adapter.setRangeEnd(rangeEnd);
|
|
762
632
|
} else {
|
|
763
633
|
if (rangeInputFocus === 'rangeEnd') {
|
|
764
634
|
this._adapter.setRangeEnd(rangeEnd);
|
|
765
|
-
|
|
766
635
|
if (rangeStartReset) {
|
|
767
636
|
this._adapter.setRangeStart(rangeStart);
|
|
768
637
|
}
|
|
769
|
-
|
|
770
638
|
if (!this._adapter.isAnotherPanelHasOpened('rangeEnd') || !rangeStart) {
|
|
771
639
|
this._adapter.setRangeInputFocus('rangeStart');
|
|
772
640
|
}
|
|
773
641
|
} else if (rangeInputFocus === 'rangeStart' || !rangeInputFocus) {
|
|
774
642
|
this._adapter.setRangeStart(rangeStart);
|
|
775
|
-
|
|
776
643
|
if (rangeEndReset) {
|
|
777
644
|
this._adapter.setRangeEnd(rangeEnd);
|
|
778
645
|
}
|
|
779
|
-
|
|
780
646
|
if (!this._adapter.isAnotherPanelHasOpened('rangeStart') || !rangeEnd) {
|
|
781
647
|
this._adapter.setRangeInputFocus('rangeEnd');
|
|
782
648
|
}
|
|
783
649
|
}
|
|
784
650
|
}
|
|
785
651
|
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
652
|
+
const dateFormat = this.getValidDateFormat();
|
|
653
|
+
// only notify when choose completed
|
|
789
654
|
if (rangeStart || rangeEnd) {
|
|
790
655
|
const [startDate, endDate] = [compatibleParse(rangeStart, dateFormat, undefined, dateFnsLocale), compatibleParse(rangeEnd, dateFormat, undefined, dateFnsLocale)];
|
|
791
|
-
let date = [startDate, endDate];
|
|
792
|
-
|
|
656
|
+
let date = [startDate, endDate];
|
|
657
|
+
// If the type is dateRangeTime, add the value of time
|
|
793
658
|
if (type === 'dateTimeRange') {
|
|
794
659
|
const startTime = this.getState('monthLeft').pickerDate;
|
|
795
660
|
const endTime = this.getState('monthRight').pickerDate;
|
|
796
661
|
const start = rangeStart ? this._mergeDateAndTime(rangeStart, startTime) : null;
|
|
797
662
|
const end = rangeEnd ? this._mergeDateAndTime(rangeEnd, endTime) : null;
|
|
798
|
-
|
|
799
663
|
if (isSameDay(startDate, endDate) && isBefore(end, start)) {
|
|
800
664
|
date = [start, start];
|
|
801
665
|
} else {
|
|
@@ -806,16 +670,12 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
806
670
|
* no need to check focus then
|
|
807
671
|
* - dateRange and isDateRangeAndHasOffset
|
|
808
672
|
*/
|
|
809
|
-
|
|
810
|
-
|
|
811
673
|
const needCheckFocusRecord = !(type === 'dateRange' && isDateRangeAndHasOffset);
|
|
812
|
-
|
|
813
674
|
this._adapter.notifySelectedChange(date, {
|
|
814
675
|
needCheckFocusRecord
|
|
815
676
|
});
|
|
816
677
|
}
|
|
817
678
|
}
|
|
818
|
-
|
|
819
679
|
_isNeedSwap(rangeStart, rangeEnd) {
|
|
820
680
|
// Check whether the start and end are reasonable and whether they need to be reversed
|
|
821
681
|
return rangeStart && rangeEnd && isBefore(rangeEnd, rangeStart);
|
|
@@ -824,8 +684,6 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
824
684
|
* Day may be empty, this is unhover state
|
|
825
685
|
* @param {*} day
|
|
826
686
|
*/
|
|
827
|
-
|
|
828
|
-
|
|
829
687
|
handleDayHover() {
|
|
830
688
|
let day = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
831
689
|
fullDate: ''
|
|
@@ -839,25 +697,19 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
839
697
|
endDateOffset,
|
|
840
698
|
type
|
|
841
699
|
} = this.getProps();
|
|
842
|
-
|
|
843
700
|
this._adapter.setHoverDay(fullDate);
|
|
844
|
-
|
|
845
701
|
if ((startDateOffset || endDateOffset) && type === 'dateRange') {
|
|
846
702
|
const offsetRangeStart = getFullDateOffset(startDateOffset, fullDate);
|
|
847
703
|
const offsetRangeEnd = getFullDateOffset(endDateOffset, fullDate);
|
|
848
|
-
|
|
849
704
|
this._adapter.setOffsetRangeStart(offsetRangeStart);
|
|
850
|
-
|
|
851
705
|
this._adapter.setOffsetRangeEnd(offsetRangeEnd);
|
|
852
706
|
}
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
|
|
707
|
+
}
|
|
708
|
+
// Guarantee that monthLeft, monthRight will not appear in the same month or monthLeft is greater than MonthRight
|
|
856
709
|
_autoAdjustMonth(monthLeft, monthRight) {
|
|
857
710
|
let newMonthLeft = monthLeft;
|
|
858
711
|
let newMonthRight = monthRight;
|
|
859
712
|
const difference = differenceInCalendarMonths(monthLeft.pickerDate, monthRight.pickerDate);
|
|
860
|
-
|
|
861
713
|
if (difference > 0) {
|
|
862
714
|
// The month on the left is larger than the month on the right, swap
|
|
863
715
|
newMonthLeft = Object.assign({}, monthRight);
|
|
@@ -869,36 +721,28 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
869
721
|
pickerDate: addMonths(monthRight.pickerDate, 1)
|
|
870
722
|
});
|
|
871
723
|
}
|
|
872
|
-
|
|
873
724
|
return {
|
|
874
725
|
monthLeft: newMonthLeft,
|
|
875
726
|
monthRight: newMonthRight
|
|
876
727
|
};
|
|
877
728
|
}
|
|
878
|
-
|
|
879
729
|
getValidTimeFormat() {
|
|
880
730
|
const formatProp = this.getProp('format') || strings.FORMAT_TIME_PICKER;
|
|
881
731
|
const timeFormatTokens = [];
|
|
882
|
-
|
|
883
732
|
if (_includes(formatProp, 'h') || _includes(formatProp, 'H')) {
|
|
884
733
|
timeFormatTokens.push('HH');
|
|
885
734
|
}
|
|
886
|
-
|
|
887
735
|
if (_includes(formatProp, 'm')) {
|
|
888
736
|
timeFormatTokens.push('mm');
|
|
889
737
|
}
|
|
890
|
-
|
|
891
738
|
if (_includes(formatProp, 's')) {
|
|
892
739
|
timeFormatTokens.push('ss');
|
|
893
740
|
}
|
|
894
|
-
|
|
895
741
|
return timeFormatTokens.join(':');
|
|
896
742
|
}
|
|
897
|
-
|
|
898
743
|
getValidDateFormat() {
|
|
899
744
|
return this.getProp('format') || getDefaultFormatToken(this.getProp('type'));
|
|
900
745
|
}
|
|
901
|
-
|
|
902
746
|
handleTimeChange(newTime, panelType) {
|
|
903
747
|
const {
|
|
904
748
|
rangeEnd,
|
|
@@ -907,21 +751,19 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
907
751
|
const dateFnsLocale = this.getProp('dateFnsLocale');
|
|
908
752
|
const ts = newTime.timeStampValue;
|
|
909
753
|
const type = this.getProp('type');
|
|
910
|
-
|
|
911
754
|
const panelDetail = this._getPanelDetail(panelType);
|
|
912
|
-
|
|
913
755
|
const {
|
|
914
756
|
showDate
|
|
915
757
|
} = panelDetail;
|
|
916
758
|
const timeDate = new Date(ts);
|
|
917
759
|
const dateFormat = this.getValidDateFormat();
|
|
918
760
|
const destRange = panelType === strings.PANEL_TYPE_RIGHT ? rangeEnd : rangeStart;
|
|
919
|
-
let year, monthNo, date;
|
|
761
|
+
let year, monthNo, date;
|
|
762
|
+
// if (pickerDate && isValidDate(pickerDate)) {
|
|
920
763
|
// year = pickerDate.getFullYear();
|
|
921
764
|
// monthNo = pickerDate.getMonth();
|
|
922
765
|
// date = pickerDate.getDate();
|
|
923
766
|
// } else
|
|
924
|
-
|
|
925
767
|
if (type === 'dateTimeRange' && destRange) {
|
|
926
768
|
const rangeDate = compatibleParse(destRange, dateFormat, undefined, dateFnsLocale);
|
|
927
769
|
year = rangeDate.getFullYear();
|
|
@@ -932,17 +774,14 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
932
774
|
monthNo = showDate.getMonth();
|
|
933
775
|
date = showDate.getDate();
|
|
934
776
|
}
|
|
935
|
-
|
|
936
777
|
const hours = timeDate.getHours();
|
|
937
778
|
const minutes = timeDate.getMinutes();
|
|
938
779
|
const seconds = timeDate.getSeconds();
|
|
939
780
|
const milSeconds = timeDate.getMilliseconds();
|
|
940
781
|
const dateArgs = [year, monthNo, date, hours, minutes, seconds, milSeconds];
|
|
941
782
|
const fullValidDate = new Date(...dateArgs);
|
|
942
|
-
|
|
943
783
|
if (type === 'dateTimeRange') {
|
|
944
784
|
this.handleShowDateAndTime(panelType, fullValidDate, showDate);
|
|
945
|
-
|
|
946
785
|
this._updateTimeInDateRange(panelType, fullValidDate);
|
|
947
786
|
} else {
|
|
948
787
|
const fullDate = formatFullDate(year, monthNo + 1, date);
|
|
@@ -951,7 +790,6 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
951
790
|
fullValidDate
|
|
952
791
|
}, panelType);
|
|
953
792
|
this.handleShowDateAndTime(panelType, fullValidDate);
|
|
954
|
-
|
|
955
793
|
this._adapter.notifySelectedChange([fullValidDate]);
|
|
956
794
|
}
|
|
957
795
|
}
|
|
@@ -960,8 +798,6 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
960
798
|
* @param {string} panelType
|
|
961
799
|
* @param {Date} timeDate
|
|
962
800
|
*/
|
|
963
|
-
|
|
964
|
-
|
|
965
801
|
_updateTimeInDateRange(panelType, timeDate) {
|
|
966
802
|
const {
|
|
967
803
|
isControlledComponent,
|
|
@@ -969,74 +805,63 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
969
805
|
} = this.getProps();
|
|
970
806
|
let rangeStart = this.getState('rangeStart');
|
|
971
807
|
let rangeEnd = this.getState('rangeEnd');
|
|
972
|
-
const dateFormat = this.getValidDateFormat();
|
|
973
|
-
|
|
808
|
+
const dateFormat = this.getValidDateFormat();
|
|
809
|
+
// TODO: Modify a time individually
|
|
974
810
|
if (rangeStart && rangeEnd) {
|
|
975
811
|
let startDate = compatibleParse(rangeStart, dateFormat, undefined, dateFnsLocale);
|
|
976
|
-
let endDate = compatibleParse(rangeEnd, dateFormat, undefined, dateFnsLocale);
|
|
977
|
-
|
|
812
|
+
let endDate = compatibleParse(rangeEnd, dateFormat, undefined, dateFnsLocale);
|
|
813
|
+
// console.log('_updateTimeInDateRange()', rangeStart, rangeEnd, startDate, endDate);
|
|
978
814
|
if (panelType === strings.PANEL_TYPE_RIGHT) {
|
|
979
815
|
endDate = this._mergeDateAndTime(timeDate, timeDate);
|
|
980
816
|
rangeEnd = format(endDate, strings.FORMAT_DATE_TIME);
|
|
981
|
-
|
|
982
817
|
if (this._isNeedSwap(rangeStart, rangeEnd)) {
|
|
983
818
|
[rangeStart, rangeEnd] = [rangeEnd, rangeStart];
|
|
984
819
|
[startDate, endDate] = [endDate, startDate];
|
|
985
820
|
}
|
|
986
|
-
|
|
987
821
|
if (!isControlledComponent) {
|
|
988
822
|
this._adapter.setRangeEnd(rangeEnd);
|
|
989
823
|
}
|
|
990
824
|
} else {
|
|
991
825
|
startDate = this._mergeDateAndTime(timeDate, timeDate);
|
|
992
826
|
rangeStart = format(startDate, strings.FORMAT_DATE_TIME);
|
|
993
|
-
|
|
994
827
|
if (this._isNeedSwap(rangeStart, rangeEnd)) {
|
|
995
828
|
[rangeStart, rangeEnd] = [rangeEnd, rangeStart];
|
|
996
829
|
[startDate, endDate] = [endDate, startDate];
|
|
997
830
|
}
|
|
998
|
-
|
|
999
831
|
if (!isControlledComponent) {
|
|
1000
832
|
this._adapter.setRangeStart(rangeStart);
|
|
1001
833
|
}
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
|
|
834
|
+
}
|
|
835
|
+
// console.log('_updateTimeInDateRange()', rangeStart, rangeEnd, startDate, endDate);
|
|
1005
836
|
this._adapter.notifySelectedChange([startDate, endDate]);
|
|
1006
837
|
}
|
|
1007
838
|
}
|
|
1008
|
-
|
|
1009
839
|
_updatePanelDetail(panelType, kvs) {
|
|
1010
840
|
const {
|
|
1011
841
|
monthLeft,
|
|
1012
842
|
monthRight
|
|
1013
843
|
} = this.getStates();
|
|
1014
|
-
|
|
1015
844
|
if (panelType === strings.PANEL_TYPE_RIGHT) {
|
|
1016
845
|
this._adapter.updateMonthOnRight(Object.assign(Object.assign({}, monthRight), kvs));
|
|
1017
846
|
} else {
|
|
1018
847
|
this._adapter.updateMonthOnLeft(Object.assign(Object.assign({}, monthLeft), kvs));
|
|
1019
848
|
}
|
|
1020
849
|
}
|
|
1021
|
-
|
|
1022
850
|
showYearPicker(panelType) {
|
|
1023
851
|
this._updatePanelDetail(panelType, {
|
|
1024
852
|
isTimePickerOpen: false,
|
|
1025
853
|
isYearPickerOpen: true
|
|
1026
854
|
});
|
|
1027
855
|
}
|
|
1028
|
-
|
|
1029
856
|
showTimePicker(panelType, opt) {
|
|
1030
857
|
if (this.getProp('disabledTimePicker')) {
|
|
1031
858
|
return;
|
|
1032
859
|
}
|
|
1033
|
-
|
|
1034
860
|
this._updatePanelDetail(panelType, {
|
|
1035
861
|
isTimePickerOpen: true,
|
|
1036
862
|
isYearPickerOpen: false
|
|
1037
863
|
});
|
|
1038
864
|
}
|
|
1039
|
-
|
|
1040
865
|
showDatePanel(panelType) {
|
|
1041
866
|
this._updatePanelDetail(panelType, {
|
|
1042
867
|
isTimePickerOpen: false,
|
|
@@ -1050,17 +875,13 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
1050
875
|
* - When yam open type is 'left' or 'right', weeks minHeight should be set
|
|
1051
876
|
* If the minHeight is not set, the change of the number of weeks will cause the scrollList to be unstable
|
|
1052
877
|
*/
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
878
|
getYAMOpenType() {
|
|
1056
879
|
const {
|
|
1057
880
|
monthLeft,
|
|
1058
881
|
monthRight
|
|
1059
882
|
} = this._adapter.getStates();
|
|
1060
|
-
|
|
1061
883
|
const leftYearPickerOpen = monthLeft.isYearPickerOpen;
|
|
1062
884
|
const rightYearPickerOpen = monthRight.isYearPickerOpen;
|
|
1063
|
-
|
|
1064
885
|
if (leftYearPickerOpen && rightYearPickerOpen) {
|
|
1065
886
|
return 'both';
|
|
1066
887
|
} else if (leftYearPickerOpen) {
|
|
@@ -1071,5 +892,4 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
1071
892
|
return 'none';
|
|
1072
893
|
}
|
|
1073
894
|
}
|
|
1074
|
-
|
|
1075
895
|
}
|