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