@douyinfe/semi-foundation 2.36.0-beta.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/foundation.ts +2 -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/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.js +0 -4
- 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 +24 -24
- 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 +3 -3
- package/lib/cjs/datePicker/monthsGridFoundation.js +43 -238
- package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +1 -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.js +3 -21
- 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/constants.js +0 -2
- 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 +71 -302
- 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/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 +1 -1
- package/lib/cjs/timePicker/foundation.js +3 -97
- 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/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.js +0 -2
- package/lib/cjs/typography/formatNumeral.d.ts +3 -3
- package/lib/cjs/typography/formatNumeral.js +16 -32
- 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/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.js +0 -3
- 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 +24 -24
- 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 +3 -3
- package/lib/es/datePicker/monthsGridFoundation.js +42 -222
- package/lib/es/datePicker/yearAndMonthFoundation.d.ts +1 -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.js +3 -18
- 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/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 +71 -309
- 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/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 +1 -1
- package/lib/es/timePicker/foundation.js +4 -90
- 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/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/formatNumeral.d.ts +3 -3
- package/lib/es/typography/formatNumeral.js +16 -29
- 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/package.json +2 -2
- package/table/foundation.ts +7 -10
- package/upload/foundation.ts +8 -8
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _isEmpty from "lodash/isEmpty";
|
|
2
2
|
import _get from "lodash/get";
|
|
3
|
+
/* eslint-disable no-param-reassign */
|
|
4
|
+
/* eslint-disable prefer-destructuring, max-lines-per-function, one-var, max-len, @typescript-eslint/restrict-plus-operands */
|
|
5
|
+
/* argus-disable unPkgSensitiveInfo */
|
|
3
6
|
import BaseFoundation from '../base/foundation';
|
|
4
7
|
import { handlePrevent } from '../utils/a11y';
|
|
5
8
|
const REGS = {
|
|
@@ -19,28 +22,22 @@ const defaultRect = {
|
|
|
19
22
|
export default class Tooltip extends BaseFoundation {
|
|
20
23
|
constructor(adapter) {
|
|
21
24
|
var _this;
|
|
22
|
-
|
|
23
25
|
super(Object.assign({}, adapter));
|
|
24
26
|
_this = this;
|
|
25
|
-
|
|
26
27
|
this.removePortal = () => {
|
|
27
28
|
this._adapter.removePortal();
|
|
28
29
|
};
|
|
29
|
-
|
|
30
30
|
this.setDisplayNone = (displayNone, cb) => {
|
|
31
31
|
this._adapter.setDisplayNone(displayNone, cb);
|
|
32
32
|
};
|
|
33
|
-
|
|
34
33
|
this.onResize = () => {
|
|
35
34
|
// this.log('resize');
|
|
36
35
|
// rePosition when window resize
|
|
37
36
|
this.calcPosition();
|
|
38
37
|
};
|
|
39
|
-
|
|
40
38
|
this.delayShow = () => {
|
|
41
39
|
const mouseEnterDelay = this.getProp('mouseEnterDelay');
|
|
42
40
|
this.clearDelayTimer();
|
|
43
|
-
|
|
44
41
|
if (mouseEnterDelay > 0) {
|
|
45
42
|
this._timer = setTimeout(() => {
|
|
46
43
|
this.show();
|
|
@@ -50,7 +47,6 @@ export default class Tooltip extends BaseFoundation {
|
|
|
50
47
|
this.show();
|
|
51
48
|
}
|
|
52
49
|
};
|
|
53
|
-
|
|
54
50
|
this.show = () => {
|
|
55
51
|
const content = this.getProp('content');
|
|
56
52
|
const trigger = this.getProp('trigger');
|
|
@@ -59,36 +55,28 @@ export default class Tooltip extends BaseFoundation {
|
|
|
59
55
|
visible,
|
|
60
56
|
displayNone
|
|
61
57
|
} = this.getStates();
|
|
62
|
-
|
|
63
58
|
if (displayNone) {
|
|
64
59
|
this.setDisplayNone(false);
|
|
65
60
|
}
|
|
66
|
-
|
|
67
61
|
if (visible) {
|
|
68
62
|
return;
|
|
69
63
|
}
|
|
70
|
-
|
|
71
64
|
this.clearDelayTimer();
|
|
72
65
|
/**
|
|
73
66
|
* If you emit an event in setState callback, you need to place the event listener function before setState to execute.
|
|
74
67
|
* This is to avoid event registration being executed later than setState callback when setState is executed in setTimeout.
|
|
75
68
|
* internal-issues:1402#note_38969412
|
|
76
69
|
*/
|
|
77
|
-
|
|
78
70
|
this._adapter.on('portalInserted', () => {
|
|
79
71
|
this.calcPosition();
|
|
80
72
|
});
|
|
81
|
-
|
|
82
73
|
this._adapter.on('positionUpdated', () => {
|
|
83
74
|
this._togglePortalVisible(true);
|
|
84
75
|
});
|
|
85
|
-
|
|
86
76
|
this._adapter.insertPortal(content, {
|
|
87
77
|
left: -9999,
|
|
88
78
|
top: -9999
|
|
89
79
|
}); // offscreen rendering
|
|
90
|
-
|
|
91
|
-
|
|
92
80
|
if (trigger === 'custom') {
|
|
93
81
|
// eslint-disable-next-line
|
|
94
82
|
this._adapter.registerClickOutsideHandler(() => {});
|
|
@@ -102,14 +90,10 @@ export default class Tooltip extends BaseFoundation {
|
|
|
102
90
|
* Because the handler needs to be bound to the document. If you bind during the constructor phase
|
|
103
91
|
* When there are multiple container instances in a page, one click triggers the handler of multiple containers
|
|
104
92
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
93
|
if (trigger === 'click' || clickTriggerToHide) {
|
|
108
94
|
this._adapter.registerClickOutsideHandler(this.hide);
|
|
109
95
|
}
|
|
110
|
-
|
|
111
96
|
this._bindScrollEvent();
|
|
112
|
-
|
|
113
97
|
this._bindResizeEvent();
|
|
114
98
|
};
|
|
115
99
|
/**
|
|
@@ -125,22 +109,18 @@ export default class Tooltip extends BaseFoundation {
|
|
|
125
109
|
* - decide whether to automatically adjust the position according to the current position and the boundingClient of wrapper
|
|
126
110
|
* - adjust the current style according to the current position, the boundingClient of trigger and motion.handle Style
|
|
127
111
|
*/
|
|
128
|
-
|
|
129
|
-
|
|
130
112
|
this.calcPosition = function (triggerRect, wrapperRect, containerRect) {
|
|
131
113
|
let shouldUpdatePos = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
132
114
|
triggerRect = (_isEmpty(triggerRect) ? _this._adapter.getTriggerBounding() : triggerRect) || Object.assign({}, defaultRect);
|
|
133
115
|
containerRect = (_isEmpty(containerRect) ? _this._adapter.getPopupContainerRect() : containerRect) || Object.assign({}, defaultRect);
|
|
134
|
-
wrapperRect = (_isEmpty(wrapperRect) ? _this._adapter.getWrapperBounding() : wrapperRect) || Object.assign({}, defaultRect);
|
|
135
|
-
|
|
116
|
+
wrapperRect = (_isEmpty(wrapperRect) ? _this._adapter.getWrapperBounding() : wrapperRect) || Object.assign({}, defaultRect);
|
|
117
|
+
// console.log('containerRect: ', containerRect, 'triggerRect: ', triggerRect, 'wrapperRect: ', wrapperRect);
|
|
136
118
|
let style = _this.calcPosStyle({
|
|
137
119
|
triggerRect,
|
|
138
120
|
wrapperRect,
|
|
139
121
|
containerRect
|
|
140
122
|
});
|
|
141
|
-
|
|
142
123
|
let position = _this.getProp('position');
|
|
143
|
-
|
|
144
124
|
if (_this.getProp('autoAdjustOverflow')) {
|
|
145
125
|
// console.log('style: ', style, '\ntriggerRect: ', triggerRect, '\nwrapperRect: ', wrapperRect);
|
|
146
126
|
const {
|
|
@@ -148,7 +128,6 @@ export default class Tooltip extends BaseFoundation {
|
|
|
148
128
|
isHeightOverFlow,
|
|
149
129
|
isWidthOverFlow
|
|
150
130
|
} = _this.adjustPosIfNeed(position, style, triggerRect, wrapperRect, containerRect);
|
|
151
|
-
|
|
152
131
|
if (position !== adjustedPos || isHeightOverFlow || isWidthOverFlow) {
|
|
153
132
|
position = adjustedPos;
|
|
154
133
|
style = _this.calcPosStyle({
|
|
@@ -161,21 +140,17 @@ export default class Tooltip extends BaseFoundation {
|
|
|
161
140
|
});
|
|
162
141
|
}
|
|
163
142
|
}
|
|
164
|
-
|
|
165
143
|
if (shouldUpdatePos && _this._mounted) {
|
|
166
144
|
// this._adapter.updatePlacementAttr(style.position);
|
|
167
145
|
_this._adapter.setPosition(Object.assign(Object.assign({}, style), {
|
|
168
146
|
position
|
|
169
147
|
}));
|
|
170
148
|
}
|
|
171
|
-
|
|
172
149
|
return style;
|
|
173
150
|
};
|
|
174
|
-
|
|
175
151
|
this.delayHide = () => {
|
|
176
152
|
const mouseLeaveDelay = this.getProp('mouseLeaveDelay');
|
|
177
153
|
this.clearDelayTimer();
|
|
178
|
-
|
|
179
154
|
if (mouseLeaveDelay > 0) {
|
|
180
155
|
this._timer = setTimeout(() => {
|
|
181
156
|
// console.log('delayHide for ', mouseLeaveDelay, ' ms, ', ...args);
|
|
@@ -186,36 +161,26 @@ export default class Tooltip extends BaseFoundation {
|
|
|
186
161
|
this.hide();
|
|
187
162
|
}
|
|
188
163
|
};
|
|
189
|
-
|
|
190
164
|
this.hide = () => {
|
|
191
165
|
this.clearDelayTimer();
|
|
192
|
-
|
|
193
166
|
this._togglePortalVisible(false);
|
|
194
|
-
|
|
195
167
|
this._adapter.off('portalInserted');
|
|
196
|
-
|
|
197
168
|
this._adapter.off('positionUpdated');
|
|
198
169
|
};
|
|
199
|
-
|
|
200
170
|
this.handleContainerKeydown = event => {
|
|
201
171
|
const {
|
|
202
172
|
guardFocus,
|
|
203
173
|
closeOnEsc
|
|
204
174
|
} = this.getProps();
|
|
205
|
-
|
|
206
175
|
switch (event && event.key) {
|
|
207
176
|
case "Escape":
|
|
208
177
|
closeOnEsc && this._handleEscKeyDown(event);
|
|
209
178
|
break;
|
|
210
|
-
|
|
211
179
|
case "Tab":
|
|
212
180
|
if (guardFocus) {
|
|
213
181
|
const container = this._adapter.getContainer();
|
|
214
|
-
|
|
215
182
|
const focusableElements = this._adapter.getFocusableElements(container);
|
|
216
|
-
|
|
217
183
|
const focusableNum = focusableElements.length;
|
|
218
|
-
|
|
219
184
|
if (focusableNum) {
|
|
220
185
|
// Shift + Tab will move focus backward
|
|
221
186
|
if (event.shiftKey) {
|
|
@@ -225,104 +190,77 @@ export default class Tooltip extends BaseFoundation {
|
|
|
225
190
|
}
|
|
226
191
|
}
|
|
227
192
|
}
|
|
228
|
-
|
|
229
193
|
break;
|
|
230
|
-
|
|
231
194
|
default:
|
|
232
195
|
break;
|
|
233
196
|
}
|
|
234
197
|
};
|
|
235
|
-
|
|
236
198
|
this._timer = null;
|
|
237
199
|
}
|
|
238
|
-
|
|
239
200
|
init() {
|
|
240
201
|
const {
|
|
241
202
|
wrapperId
|
|
242
203
|
} = this.getProps();
|
|
243
204
|
this._mounted = true;
|
|
244
|
-
|
|
245
205
|
this._bindEvent();
|
|
246
|
-
|
|
247
206
|
this._shouldShow();
|
|
248
|
-
|
|
249
207
|
this._initContainerPosition();
|
|
250
|
-
|
|
251
208
|
if (!wrapperId) {
|
|
252
209
|
this._adapter.setId();
|
|
253
210
|
}
|
|
254
211
|
}
|
|
255
|
-
|
|
256
212
|
destroy() {
|
|
257
213
|
this._mounted = false;
|
|
258
214
|
this.unBindEvent();
|
|
259
215
|
}
|
|
260
|
-
|
|
261
216
|
_bindEvent() {
|
|
262
217
|
const trigger = this.getProp('trigger'); // get trigger type
|
|
263
|
-
|
|
264
218
|
const {
|
|
265
219
|
triggerEventSet,
|
|
266
220
|
portalEventSet
|
|
267
221
|
} = this._generateEvent(trigger);
|
|
268
|
-
|
|
269
222
|
this._bindTriggerEvent(triggerEventSet);
|
|
270
|
-
|
|
271
223
|
this._bindPortalEvent(portalEventSet);
|
|
272
|
-
|
|
273
224
|
this._bindResizeEvent();
|
|
274
225
|
}
|
|
275
|
-
|
|
276
226
|
unBindEvent() {
|
|
277
227
|
this._adapter.unregisterClickOutsideHandler();
|
|
278
|
-
|
|
279
228
|
this.unBindResizeEvent();
|
|
280
229
|
this.unBindScrollEvent();
|
|
281
230
|
}
|
|
282
|
-
|
|
283
231
|
_bindTriggerEvent(triggerEventSet) {
|
|
284
232
|
this._adapter.registerTriggerEvent(triggerEventSet);
|
|
285
233
|
}
|
|
286
|
-
|
|
287
234
|
_bindPortalEvent(portalEventSet) {
|
|
288
235
|
this._adapter.registerPortalEvent(portalEventSet);
|
|
289
236
|
}
|
|
290
|
-
|
|
291
237
|
_bindResizeEvent() {
|
|
292
238
|
this._adapter.registerResizeHandler(this.onResize);
|
|
293
239
|
}
|
|
294
|
-
|
|
295
240
|
unBindResizeEvent() {
|
|
296
241
|
this._adapter.unregisterResizeHandler(this.onResize);
|
|
297
242
|
}
|
|
298
|
-
|
|
299
243
|
_adjustPos() {
|
|
300
244
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
301
245
|
let isVertical = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
302
246
|
let adjustType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'reverse';
|
|
303
247
|
let concatPos = arguments.length > 3 ? arguments[3] : undefined;
|
|
304
|
-
|
|
305
248
|
switch (adjustType) {
|
|
306
249
|
case 'reverse':
|
|
307
250
|
return this._reversePos(position, isVertical);
|
|
308
|
-
|
|
309
251
|
case 'expand':
|
|
310
252
|
// only happens when position is top/bottom/left/right
|
|
311
253
|
return this._expandPos(position, concatPos);
|
|
312
|
-
|
|
313
254
|
case 'reduce':
|
|
314
255
|
// only happens when position other than top/bottom/left/right
|
|
315
256
|
return this._reducePos(position);
|
|
316
|
-
|
|
317
257
|
default:
|
|
318
258
|
return this._reversePos(position, isVertical);
|
|
319
259
|
}
|
|
320
260
|
}
|
|
321
|
-
|
|
322
261
|
_reversePos() {
|
|
323
262
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
324
263
|
let isVertical = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
325
|
-
|
|
326
264
|
if (isVertical) {
|
|
327
265
|
if (REGS.TOP.test(position)) {
|
|
328
266
|
return position.replace('top', 'bottom').replace('Top', 'Bottom');
|
|
@@ -334,33 +272,27 @@ export default class Tooltip extends BaseFoundation {
|
|
|
334
272
|
} else if (REGS.RIGHT.test(position)) {
|
|
335
273
|
return position.replace('right', 'left').replace('Right', 'Left');
|
|
336
274
|
}
|
|
337
|
-
|
|
338
275
|
return position;
|
|
339
276
|
}
|
|
340
|
-
|
|
341
277
|
_expandPos() {
|
|
342
278
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
343
279
|
let concatPos = arguments.length > 1 ? arguments[1] : undefined;
|
|
344
280
|
return position.concat(concatPos);
|
|
345
281
|
}
|
|
346
|
-
|
|
347
282
|
_reducePos() {
|
|
348
283
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
349
284
|
// if cur position consists of two directions, remove the last position
|
|
350
285
|
const found = ['Top', 'Bottom', 'Left', 'Right'].find(pos => position.endsWith(pos));
|
|
351
286
|
return found ? position.replace(found, '') : position;
|
|
352
287
|
}
|
|
353
|
-
|
|
354
288
|
clearDelayTimer() {
|
|
355
289
|
if (this._timer) {
|
|
356
290
|
clearTimeout(this._timer);
|
|
357
291
|
this._timer = null;
|
|
358
292
|
}
|
|
359
293
|
}
|
|
360
|
-
|
|
361
294
|
_generateEvent(types) {
|
|
362
295
|
const eventNames = this._adapter.getEventName();
|
|
363
|
-
|
|
364
296
|
const triggerEventSet = {
|
|
365
297
|
// bind esc keydown on trigger for a11y
|
|
366
298
|
[eventNames.keydown]: event => {
|
|
@@ -368,122 +300,101 @@ export default class Tooltip extends BaseFoundation {
|
|
|
368
300
|
}
|
|
369
301
|
};
|
|
370
302
|
let portalEventSet = {};
|
|
371
|
-
|
|
372
303
|
switch (types) {
|
|
373
304
|
case 'focus':
|
|
374
305
|
triggerEventSet[eventNames.focus] = () => {
|
|
375
306
|
this.delayShow();
|
|
376
307
|
};
|
|
377
|
-
|
|
378
308
|
triggerEventSet[eventNames.blur] = () => {
|
|
379
309
|
this.delayHide();
|
|
380
310
|
};
|
|
381
|
-
|
|
382
311
|
portalEventSet = triggerEventSet;
|
|
383
312
|
break;
|
|
384
|
-
|
|
385
313
|
case 'click':
|
|
386
314
|
triggerEventSet[eventNames.click] = () => {
|
|
387
315
|
// this.delayShow();
|
|
388
316
|
this.show();
|
|
389
317
|
};
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
318
|
+
portalEventSet = {};
|
|
319
|
+
// Click outside needs special treatment, can not be directly tied to the trigger Element, need to be bound to the document
|
|
393
320
|
break;
|
|
394
|
-
|
|
395
321
|
case 'hover':
|
|
396
322
|
triggerEventSet[eventNames.mouseEnter] = () => {
|
|
397
323
|
// console.log(e);
|
|
398
324
|
this.setCache('isClickToHide', false);
|
|
399
|
-
this.delayShow();
|
|
325
|
+
this.delayShow();
|
|
326
|
+
// this.show('trigger');
|
|
400
327
|
};
|
|
401
328
|
|
|
402
329
|
triggerEventSet[eventNames.mouseLeave] = () => {
|
|
403
330
|
// console.log(e);
|
|
404
|
-
this.delayHide();
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
331
|
+
this.delayHide();
|
|
332
|
+
// this.hide('trigger');
|
|
333
|
+
};
|
|
334
|
+
// bind focus to hover trigger for a11y
|
|
408
335
|
triggerEventSet[eventNames.focus] = () => {
|
|
409
336
|
const {
|
|
410
337
|
disableFocusListener
|
|
411
338
|
} = this.getProps();
|
|
412
339
|
!disableFocusListener && this.delayShow();
|
|
413
340
|
};
|
|
414
|
-
|
|
415
341
|
triggerEventSet[eventNames.blur] = () => {
|
|
416
342
|
const {
|
|
417
343
|
disableFocusListener
|
|
418
344
|
} = this.getProps();
|
|
419
345
|
!disableFocusListener && this.delayHide();
|
|
420
346
|
};
|
|
421
|
-
|
|
422
347
|
portalEventSet = Object.assign({}, triggerEventSet);
|
|
423
|
-
|
|
424
348
|
if (this.getProp('clickToHide')) {
|
|
425
349
|
portalEventSet[eventNames.click] = () => {
|
|
426
350
|
this.setCache('isClickToHide', true);
|
|
427
351
|
this.hide();
|
|
428
352
|
};
|
|
429
|
-
|
|
430
353
|
portalEventSet[eventNames.mouseEnter] = () => {
|
|
431
354
|
if (this.getCache('isClickToHide')) {
|
|
432
355
|
return;
|
|
433
356
|
}
|
|
434
|
-
|
|
435
357
|
this.delayShow();
|
|
436
358
|
};
|
|
437
359
|
}
|
|
438
|
-
|
|
439
360
|
break;
|
|
440
|
-
|
|
441
361
|
case 'custom':
|
|
442
362
|
// when trigger type is 'custom', no need to bind eventHandler
|
|
443
363
|
// show/hide completely depend on props.visible which change by user
|
|
444
364
|
break;
|
|
445
|
-
|
|
446
365
|
default:
|
|
447
366
|
break;
|
|
448
367
|
}
|
|
449
|
-
|
|
450
368
|
return {
|
|
451
369
|
triggerEventSet,
|
|
452
370
|
portalEventSet
|
|
453
371
|
};
|
|
454
372
|
}
|
|
455
|
-
|
|
456
373
|
_shouldShow() {
|
|
457
374
|
const visible = this.getProp('visible');
|
|
458
|
-
|
|
459
375
|
if (visible) {
|
|
460
376
|
this.show();
|
|
461
|
-
} else {
|
|
377
|
+
} else {
|
|
378
|
+
// this.hide();
|
|
462
379
|
}
|
|
463
380
|
}
|
|
464
|
-
|
|
465
381
|
_togglePortalVisible(isVisible) {
|
|
466
382
|
const nowVisible = this.getState('visible');
|
|
467
|
-
|
|
468
383
|
if (nowVisible !== isVisible) {
|
|
469
384
|
this._adapter.togglePortalVisible(isVisible, () => {
|
|
470
385
|
if (isVisible) {
|
|
471
386
|
this._adapter.setInitialFocus();
|
|
472
387
|
}
|
|
473
|
-
|
|
474
388
|
this._adapter.notifyVisibleChange(isVisible);
|
|
475
389
|
});
|
|
476
390
|
}
|
|
477
391
|
}
|
|
478
|
-
|
|
479
392
|
_roundPixel(pixel) {
|
|
480
393
|
if (typeof pixel === 'number') {
|
|
481
394
|
return Math.round(pixel);
|
|
482
395
|
}
|
|
483
|
-
|
|
484
396
|
return pixel;
|
|
485
397
|
}
|
|
486
|
-
|
|
487
398
|
calcTransformOrigin(position, triggerRect, translateX, translateY) {
|
|
488
399
|
// eslint-disable-next-line
|
|
489
400
|
if (position && triggerRect && translateX != null && translateY != null) {
|
|
@@ -491,26 +402,20 @@ export default class Tooltip extends BaseFoundation {
|
|
|
491
402
|
if (['topLeft', 'bottomLeft'].includes(position)) {
|
|
492
403
|
return `${this._roundPixel(triggerRect.width / 2)}px ${-translateY * 100}%`;
|
|
493
404
|
}
|
|
494
|
-
|
|
495
405
|
if (['topRight', 'bottomRight'].includes(position)) {
|
|
496
406
|
return `calc(100% - ${this._roundPixel(triggerRect.width / 2)}px) ${-translateY * 100}%`;
|
|
497
407
|
}
|
|
498
|
-
|
|
499
408
|
if (['leftTop', 'rightTop'].includes(position)) {
|
|
500
409
|
return `${-translateX * 100}% ${this._roundPixel(triggerRect.height / 2)}px`;
|
|
501
410
|
}
|
|
502
|
-
|
|
503
411
|
if (['leftBottom', 'rightBottom'].includes(position)) {
|
|
504
412
|
return `${-translateX * 100}% calc(100% - ${this._roundPixel(triggerRect.height / 2)}px)`;
|
|
505
413
|
}
|
|
506
414
|
}
|
|
507
|
-
|
|
508
415
|
return `${-translateX * 100}% ${-translateY * 100}%`;
|
|
509
416
|
}
|
|
510
|
-
|
|
511
417
|
return null;
|
|
512
418
|
}
|
|
513
|
-
|
|
514
419
|
calcPosStyle(props) {
|
|
515
420
|
const {
|
|
516
421
|
spacing,
|
|
@@ -521,10 +426,10 @@ export default class Tooltip extends BaseFoundation {
|
|
|
521
426
|
} = window;
|
|
522
427
|
const triggerRect = (_isEmpty(props.triggerRect) ? props.triggerRect : this._adapter.getTriggerBounding()) || Object.assign({}, defaultRect);
|
|
523
428
|
const containerRect = (_isEmpty(props.containerRect) ? props.containerRect : this._adapter.getPopupContainerRect()) || Object.assign({}, defaultRect);
|
|
524
|
-
const wrapperRect = (_isEmpty(props.wrapperRect) ? props.wrapperRect : this._adapter.getWrapperBounding()) || Object.assign({}, defaultRect);
|
|
525
|
-
|
|
526
|
-
const position = props.position != null ? props.position : this.getProp('position');
|
|
527
|
-
|
|
429
|
+
const wrapperRect = (_isEmpty(props.wrapperRect) ? props.wrapperRect : this._adapter.getWrapperBounding()) || Object.assign({}, defaultRect);
|
|
430
|
+
// eslint-disable-next-line
|
|
431
|
+
const position = props.position != null ? props.position : this.getProp('position');
|
|
432
|
+
// eslint-disable-next-line
|
|
528
433
|
const SPACING = spacing != null ? spacing : this.getProp('spacing');
|
|
529
434
|
const {
|
|
530
435
|
arrowPointAtCenter,
|
|
@@ -532,23 +437,17 @@ export default class Tooltip extends BaseFoundation {
|
|
|
532
437
|
arrowBounding
|
|
533
438
|
} = this.getProps();
|
|
534
439
|
const pointAtCenter = showArrow && arrowPointAtCenter;
|
|
535
|
-
|
|
536
440
|
const horizontalArrowWidth = _get(arrowBounding, 'width', 24);
|
|
537
|
-
|
|
538
441
|
const verticalArrowHeight = _get(arrowBounding, 'width', 24);
|
|
539
|
-
|
|
540
442
|
const arrowOffsetY = _get(arrowBounding, 'offsetY', 0);
|
|
541
|
-
|
|
542
443
|
const positionOffsetX = 6;
|
|
543
|
-
const positionOffsetY = 6;
|
|
444
|
+
const positionOffsetY = 6;
|
|
445
|
+
// You must use left/top when rendering, using right/bottom does not render the element position correctly
|
|
544
446
|
// Use left/top + translate to achieve tooltip positioning perfectly without knowing the size of the tooltip expansion layer
|
|
545
|
-
|
|
546
447
|
let left;
|
|
547
448
|
let top;
|
|
548
449
|
let translateX = 0; // Container x-direction translation distance
|
|
549
|
-
|
|
550
450
|
let translateY = 0; // Container y-direction translation distance
|
|
551
|
-
|
|
552
451
|
const middleX = triggerRect.left + triggerRect.width / 2;
|
|
553
452
|
const middleY = triggerRect.top + triggerRect.height / 2;
|
|
554
453
|
const offsetXWithArrow = positionOffsetX + horizontalArrowWidth / 2;
|
|
@@ -562,7 +461,6 @@ export default class Tooltip extends BaseFoundation {
|
|
|
562
461
|
const isTriggerNearLeft = middleX - containerRect.left < containerRect.right - middleX;
|
|
563
462
|
const isTriggerNearTop = middleY - containerRect.top < containerRect.bottom - middleY;
|
|
564
463
|
const isWrapperWidthOverflow = wrapperRect.width > innerWidth;
|
|
565
|
-
|
|
566
464
|
switch (position) {
|
|
567
465
|
case 'top':
|
|
568
466
|
// left = middleX;
|
|
@@ -572,7 +470,6 @@ export default class Tooltip extends BaseFoundation {
|
|
|
572
470
|
translateX = -0.5;
|
|
573
471
|
translateY = -1;
|
|
574
472
|
break;
|
|
575
|
-
|
|
576
473
|
case 'topLeft':
|
|
577
474
|
// left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
578
475
|
// top = triggerRect.top - SPACING;
|
|
@@ -580,7 +477,6 @@ export default class Tooltip extends BaseFoundation {
|
|
|
580
477
|
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
|
|
581
478
|
translateY = -1;
|
|
582
479
|
break;
|
|
583
|
-
|
|
584
480
|
case 'topRight':
|
|
585
481
|
// left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
586
482
|
// top = triggerRect.top - SPACING;
|
|
@@ -589,7 +485,6 @@ export default class Tooltip extends BaseFoundation {
|
|
|
589
485
|
translateY = -1;
|
|
590
486
|
translateX = -1;
|
|
591
487
|
break;
|
|
592
|
-
|
|
593
488
|
case 'left':
|
|
594
489
|
// left = triggerRect.left - SPACING;
|
|
595
490
|
// top = middleY;
|
|
@@ -599,7 +494,6 @@ export default class Tooltip extends BaseFoundation {
|
|
|
599
494
|
translateX = -1;
|
|
600
495
|
translateY = -0.5;
|
|
601
496
|
break;
|
|
602
|
-
|
|
603
497
|
case 'leftTop':
|
|
604
498
|
// left = triggerRect.left - SPACING;
|
|
605
499
|
// top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
@@ -607,7 +501,6 @@ export default class Tooltip extends BaseFoundation {
|
|
|
607
501
|
top = isHeightOverFlow ? containerRect.top : pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
608
502
|
translateX = -1;
|
|
609
503
|
break;
|
|
610
|
-
|
|
611
504
|
case 'leftBottom':
|
|
612
505
|
// left = triggerRect.left - SPACING;
|
|
613
506
|
// top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
@@ -616,7 +509,6 @@ export default class Tooltip extends BaseFoundation {
|
|
|
616
509
|
translateX = -1;
|
|
617
510
|
translateY = -1;
|
|
618
511
|
break;
|
|
619
|
-
|
|
620
512
|
case 'bottom':
|
|
621
513
|
// left = middleX;
|
|
622
514
|
// top = triggerRect.top + triggerRect.height + SPACING;
|
|
@@ -624,14 +516,12 @@ export default class Tooltip extends BaseFoundation {
|
|
|
624
516
|
top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
|
|
625
517
|
translateX = -0.5;
|
|
626
518
|
break;
|
|
627
|
-
|
|
628
519
|
case 'bottomLeft':
|
|
629
520
|
// left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
630
521
|
// top = triggerRect.bottom + SPACING;
|
|
631
522
|
left = isWidthOverFlow ? isWrapperWidthOverflow ? containerRect.left : containerRect.right - wrapperRect.width : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
632
523
|
top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
|
|
633
524
|
break;
|
|
634
|
-
|
|
635
525
|
case 'bottomRight':
|
|
636
526
|
// left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
637
527
|
// top = triggerRect.bottom + SPACING;
|
|
@@ -639,7 +529,6 @@ export default class Tooltip extends BaseFoundation {
|
|
|
639
529
|
top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
|
|
640
530
|
translateX = -1;
|
|
641
531
|
break;
|
|
642
|
-
|
|
643
532
|
case 'right':
|
|
644
533
|
// left = triggerRect.right + SPACING;
|
|
645
534
|
// top = middleY;
|
|
@@ -647,14 +536,12 @@ export default class Tooltip extends BaseFoundation {
|
|
|
647
536
|
top = isHeightOverFlow ? isTriggerNearTop ? containerRect.top + wrapperRect.height / 2 : containerRect.bottom - wrapperRect.height / 2 + offsetHeight : middleY;
|
|
648
537
|
translateY = -0.5;
|
|
649
538
|
break;
|
|
650
|
-
|
|
651
539
|
case 'rightTop':
|
|
652
540
|
// left = triggerRect.right + SPACING;
|
|
653
541
|
// top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
654
542
|
left = isWidthOverFlow ? containerRect.left - SPACING + offsetXWithArrow : triggerRect.right + SPACING;
|
|
655
543
|
top = isHeightOverFlow ? containerRect.top : pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
656
544
|
break;
|
|
657
|
-
|
|
658
545
|
case 'rightBottom':
|
|
659
546
|
// left = triggerRect.right + SPACING;
|
|
660
547
|
// top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
@@ -662,40 +549,32 @@ export default class Tooltip extends BaseFoundation {
|
|
|
662
549
|
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
663
550
|
translateY = -1;
|
|
664
551
|
break;
|
|
665
|
-
|
|
666
552
|
case 'leftTopOver':
|
|
667
553
|
left = triggerRect.left - SPACING;
|
|
668
554
|
top = triggerRect.top - SPACING;
|
|
669
555
|
break;
|
|
670
|
-
|
|
671
556
|
case 'rightTopOver':
|
|
672
557
|
left = triggerRect.right + SPACING;
|
|
673
558
|
top = triggerRect.top - SPACING;
|
|
674
559
|
translateX = -1;
|
|
675
560
|
break;
|
|
676
|
-
|
|
677
561
|
case 'leftBottomOver':
|
|
678
562
|
left = triggerRect.left - SPACING;
|
|
679
563
|
top = triggerRect.bottom + SPACING;
|
|
680
564
|
translateY = -1;
|
|
681
565
|
break;
|
|
682
|
-
|
|
683
566
|
case 'rightBottomOver':
|
|
684
567
|
left = triggerRect.right + SPACING;
|
|
685
568
|
top = triggerRect.bottom + SPACING;
|
|
686
569
|
translateX = -1;
|
|
687
570
|
translateY = -1;
|
|
688
571
|
break;
|
|
689
|
-
|
|
690
572
|
default:
|
|
691
573
|
break;
|
|
692
574
|
}
|
|
693
|
-
|
|
694
575
|
const transformOrigin = this.calcTransformOrigin(position, triggerRect, translateX, translateY); // Transform origin
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
576
|
+
const _containerIsBody = this._adapter.containerIsBody();
|
|
577
|
+
// Calculate container positioning relative to window
|
|
699
578
|
left = left - containerRect.left;
|
|
700
579
|
top = top - containerRect.top;
|
|
701
580
|
/**
|
|
@@ -705,99 +584,82 @@ export default class Tooltip extends BaseFoundation {
|
|
|
705
584
|
* When container is body, if position is not relative or absolute, then the top/left calculated by trigger will be positioned according to html
|
|
706
585
|
* At this time, if the body has a margin, the calculated position will have a problem relative to the body fix issue #1368
|
|
707
586
|
*/
|
|
708
|
-
|
|
709
587
|
if (_containerIsBody && !this._adapter.containerIsRelativeOrAbsolute()) {
|
|
710
|
-
const documentEleRect = this._adapter.getDocumentElementBounding();
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
588
|
+
const documentEleRect = this._adapter.getDocumentElementBounding();
|
|
589
|
+
// Represents the left of the body relative to html
|
|
590
|
+
left += containerRect.left - documentEleRect.left;
|
|
591
|
+
// Represents the top of the body relative to html
|
|
715
592
|
top += containerRect.top - documentEleRect.top;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
|
|
593
|
+
}
|
|
594
|
+
// ContainerRect.scrollLeft to solve the inner scrolling of the container
|
|
719
595
|
left = _containerIsBody ? left : left + containerRect.scrollLeft;
|
|
720
596
|
top = _containerIsBody ? top : top + containerRect.scrollTop;
|
|
721
597
|
const triggerHeight = triggerRect.height;
|
|
722
|
-
|
|
723
598
|
if (this.getProp('showArrow') && !arrowPointAtCenter && triggerHeight <= (verticalArrowHeight / 2 + arrowOffsetY) * 2) {
|
|
724
599
|
const offsetY = triggerHeight / 2 - (arrowOffsetY + verticalArrowHeight / 2);
|
|
725
|
-
|
|
726
600
|
if ((position.includes('Top') || position.includes('Bottom')) && !position.includes('Over')) {
|
|
727
601
|
top = position.includes('Top') ? top + offsetY : top - offsetY;
|
|
728
602
|
}
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
|
|
603
|
+
}
|
|
604
|
+
// The left/top value here must be rounded, otherwise it will cause the small triangle to shake
|
|
732
605
|
const style = {
|
|
733
606
|
left: this._roundPixel(left),
|
|
734
607
|
top: this._roundPixel(top)
|
|
735
608
|
};
|
|
736
|
-
let transform = '';
|
|
737
|
-
|
|
609
|
+
let transform = '';
|
|
610
|
+
// eslint-disable-next-line
|
|
738
611
|
if (translateX != null) {
|
|
739
612
|
transform += `translateX(${translateX * 100}%) `;
|
|
740
613
|
Object.defineProperty(style, 'translateX', {
|
|
741
614
|
enumerable: false,
|
|
742
615
|
value: translateX
|
|
743
616
|
});
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
|
|
617
|
+
}
|
|
618
|
+
// eslint-disable-next-line
|
|
747
619
|
if (translateY != null) {
|
|
748
620
|
transform += `translateY(${translateY * 100}%) `;
|
|
749
621
|
Object.defineProperty(style, 'translateY', {
|
|
750
622
|
enumerable: false,
|
|
751
623
|
value: translateY
|
|
752
624
|
});
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
|
|
625
|
+
}
|
|
626
|
+
// eslint-disable-next-line
|
|
756
627
|
if (transformOrigin != null) {
|
|
757
628
|
style.transformOrigin = transformOrigin;
|
|
758
629
|
}
|
|
759
|
-
|
|
760
630
|
if (transform) {
|
|
761
631
|
style.transform = transform;
|
|
762
632
|
}
|
|
763
|
-
|
|
764
633
|
return style;
|
|
765
634
|
}
|
|
766
|
-
|
|
767
635
|
isLR() {
|
|
768
636
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
769
637
|
return position.includes('left') || position.includes('right');
|
|
770
638
|
}
|
|
771
|
-
|
|
772
639
|
isTB() {
|
|
773
640
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
774
641
|
return position.includes('top') || position.includes('bottom');
|
|
775
642
|
}
|
|
776
|
-
|
|
777
643
|
isReverse(rowSpace, reverseSpace, size) {
|
|
778
644
|
// 原空间不足,反向空间足够
|
|
779
645
|
// Insufficient original space, enough reverse space
|
|
780
646
|
return rowSpace < size && reverseSpace > size;
|
|
781
647
|
}
|
|
782
|
-
|
|
783
648
|
isOverFlow(rowSpace, reverseSpace, size) {
|
|
784
649
|
// 原空间且反向空间都不足
|
|
785
650
|
// The original space and the reverse space are not enough
|
|
786
651
|
return rowSpace < size && reverseSpace < size;
|
|
787
652
|
}
|
|
788
|
-
|
|
789
653
|
isHalfOverFlow(posSpace, negSpace, size) {
|
|
790
654
|
// 正半空间或者负半空间不足,即表示有遮挡,需要偏移
|
|
791
655
|
// Insufficient positive half space or negative half space means that there is occlusion and needs to be offset
|
|
792
656
|
return posSpace < size || negSpace < size;
|
|
793
657
|
}
|
|
794
|
-
|
|
795
658
|
isHalfAllEnough(posSpace, negSpace, size) {
|
|
796
659
|
// 正半空间和负半空间都足够,即表示可以从 topLeft/topRight 变成 top
|
|
797
660
|
// Both positive and negative half-spaces are sufficient, which means you can change from topLeft/topRight to top
|
|
798
661
|
return posSpace >= size || negSpace >= size;
|
|
799
662
|
}
|
|
800
|
-
|
|
801
663
|
getReverse(viewOverFlow, containerOverFlow, shouldReverseView, shouldReverseContainer) {
|
|
802
664
|
/**
|
|
803
665
|
* 基于视口和容器一起判断,以下几种情况允许从原方向转到反方向,以判断是否应该由top->bottom为例子
|
|
@@ -813,9 +675,8 @@ export default class Tooltip extends BaseFoundation {
|
|
|
813
675
|
* 3. Viewport upper space ❌ lower space✅ and container upper space ❌ lower space✅
|
|
814
676
|
*/
|
|
815
677
|
return viewOverFlow && shouldReverseContainer || shouldReverseView && containerOverFlow || shouldReverseView && shouldReverseContainer;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
|
|
678
|
+
}
|
|
679
|
+
// place the dom correctly
|
|
819
680
|
adjustPosIfNeed(position, style, triggerRect, wrapperRect, containerRect) {
|
|
820
681
|
const {
|
|
821
682
|
innerWidth,
|
|
@@ -831,7 +692,6 @@ export default class Tooltip extends BaseFoundation {
|
|
|
831
692
|
const marginBottom = typeof margin === 'number' ? margin : margin.marginBottom;
|
|
832
693
|
let isHeightOverFlow = false;
|
|
833
694
|
let isWidthOverFlow = false;
|
|
834
|
-
|
|
835
695
|
if (wrapperRect.width > 0 && wrapperRect.height > 0) {
|
|
836
696
|
// let clientLeft = left + translateX * wrapperRect.width - containerRect.scrollLeft;
|
|
837
697
|
// let clientTop = top + translateY * wrapperRect.height - containerRect.scrollTop;
|
|
@@ -852,10 +712,10 @@ export default class Tooltip extends BaseFoundation {
|
|
|
852
712
|
const restClientRight = innerWidth - clientRight;
|
|
853
713
|
const restClientBottom = innerHeight - clientBottom;
|
|
854
714
|
const widthIsBigger = wrapperRect.width > triggerRect.width;
|
|
855
|
-
const heightIsBigger = wrapperRect.height > triggerRect.height;
|
|
715
|
+
const heightIsBigger = wrapperRect.height > triggerRect.height;
|
|
716
|
+
// The wrapperR ect.top|bottom equivalent cannot be directly used here for comparison, which is easy to cause jitter
|
|
856
717
|
// 基于视口的微调判断
|
|
857
718
|
// Fine-tuning judgment based on viewport
|
|
858
|
-
|
|
859
719
|
const shouldViewReverseTop = clientTop - marginTop < wrapperRect.height + spacing && restClientBottom - marginBottom > wrapperRect.height + spacing;
|
|
860
720
|
const shouldViewReverseLeft = clientLeft - marginLeft < wrapperRect.width + spacing && restClientRight - marginRight > wrapperRect.width + spacing;
|
|
861
721
|
const shouldViewReverseBottom = restClientBottom - marginBottom < wrapperRect.height + spacing && clientTop - marginTop > wrapperRect.height + spacing;
|
|
@@ -869,9 +729,9 @@ export default class Tooltip extends BaseFoundation {
|
|
|
869
729
|
const shouldReverseTopOver = restClientTop < wrapperRect.height + spacing && clientBottom > wrapperRect.height + spacing;
|
|
870
730
|
const shouldReverseBottomOver = clientBottom < wrapperRect.height + spacing && restClientTop > wrapperRect.height + spacing;
|
|
871
731
|
const shouldReverseLeftOver = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
872
|
-
const shouldReverseRightOver = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
732
|
+
const shouldReverseRightOver = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
733
|
+
// 基于容器的微调判断
|
|
873
734
|
// Fine-tuning judgment based on container
|
|
874
|
-
|
|
875
735
|
const clientTopInContainer = clientTop - containerRect.top;
|
|
876
736
|
const clientLeftInContainer = clientLeft - containerRect.left;
|
|
877
737
|
const clientBottomInContainer = clientTopInContainer + triggerRect.height;
|
|
@@ -879,9 +739,9 @@ export default class Tooltip extends BaseFoundation {
|
|
|
879
739
|
const restClientBottomInContainer = containerRect.bottom - clientBottom;
|
|
880
740
|
const restClientRightInContainer = containerRect.right - clientRight;
|
|
881
741
|
const restClientTopInContainer = restClientBottomInContainer + triggerRect.height;
|
|
882
|
-
const restClientLeftInContainer = restClientRightInContainer + triggerRect.width;
|
|
742
|
+
const restClientLeftInContainer = restClientRightInContainer + triggerRect.width;
|
|
743
|
+
// 当原空间不足,反向空间足够时,可以反向。
|
|
883
744
|
// When the original space is insufficient and the reverse space is sufficient, the reverse can be performed.
|
|
884
|
-
|
|
885
745
|
const shouldContainerReverseTop = this.isReverse(clientTopInContainer - marginTop, restClientBottomInContainer - marginBottom, wrapperRect.height + spacing);
|
|
886
746
|
const shouldContainerReverseLeft = this.isReverse(clientLeftInContainer - marginLeft, restClientRightInContainer - marginRight, wrapperRect.width + spacing);
|
|
887
747
|
const shouldContainerReverseBottom = this.isReverse(restClientBottomInContainer - marginBottom, clientTopInContainer - marginTop, wrapperRect.height + spacing);
|
|
@@ -893,9 +753,9 @@ export default class Tooltip extends BaseFoundation {
|
|
|
893
753
|
const shouldContainerReverseLeftSide = this.isReverse(restClientLeftInContainer, clientRightInContainer, wrapperRect.width);
|
|
894
754
|
const shouldContainerReverseRightSide = this.isReverse(clientRightInContainer, restClientLeftInContainer, wrapperRect.width);
|
|
895
755
|
const halfHeight = triggerRect.height / 2;
|
|
896
|
-
const halfWidth = triggerRect.width / 2;
|
|
756
|
+
const halfWidth = triggerRect.width / 2;
|
|
757
|
+
// 视口, 原空间与反向空间是否都不足判断
|
|
897
758
|
// Viewport, whether the original space and the reverse space are insufficient to judge
|
|
898
|
-
|
|
899
759
|
const isViewYOverFlow = this.isOverFlow(clientTop - marginTop, restClientBottom - marginBottom, wrapperRect.height + spacing);
|
|
900
760
|
const isViewXOverFlow = this.isOverFlow(clientLeft - marginLeft, restClientRight - marginRight, wrapperRect.width + spacing);
|
|
901
761
|
const isViewYOverFlowSide = this.isOverFlow(clientBottom - marginTop, restClientTop - marginBottom, wrapperRect.height + spacing);
|
|
@@ -903,9 +763,9 @@ export default class Tooltip extends BaseFoundation {
|
|
|
903
763
|
const isViewYOverFlowSideHalf = this.isHalfOverFlow(clientBottom - halfHeight, restClientTop - halfHeight, wrapperRect.height / 2);
|
|
904
764
|
const isViewXOverFlowSideHalf = this.isHalfOverFlow(clientRight - halfWidth, restClientLeft - halfWidth, wrapperRect.width / 2);
|
|
905
765
|
const isViewYEnoughSideHalf = this.isHalfAllEnough(clientBottom - halfHeight, restClientTop - halfHeight, wrapperRect.height / 2);
|
|
906
|
-
const isViewXEnoughSideHalf = this.isHalfAllEnough(clientRight - halfWidth, restClientLeft - halfWidth, wrapperRect.width / 2);
|
|
766
|
+
const isViewXEnoughSideHalf = this.isHalfAllEnough(clientRight - halfWidth, restClientLeft - halfWidth, wrapperRect.width / 2);
|
|
767
|
+
// 容器, 原空间与反向空间是否都不足判断
|
|
907
768
|
// container, whether the original space and the reverse space are insufficient to judge
|
|
908
|
-
|
|
909
769
|
const isContainerYOverFlow = this.isOverFlow(clientTopInContainer - marginTop, restClientBottomInContainer - marginBottom, wrapperRect.height + spacing);
|
|
910
770
|
const isContainerXOverFlow = this.isOverFlow(clientLeftInContainer - marginLeft, restClientRightInContainer - marginRight, wrapperRect.width + spacing);
|
|
911
771
|
const isContainerYOverFlowSide = this.isOverFlow(clientBottomInContainer - marginTop, restClientTopInContainer - marginBottom, wrapperRect.height + spacing);
|
|
@@ -913,254 +773,195 @@ export default class Tooltip extends BaseFoundation {
|
|
|
913
773
|
const isContainerYOverFlowSideHalf = this.isHalfOverFlow(clientBottomInContainer - halfHeight, restClientTopInContainer - halfHeight, wrapperRect.height / 2);
|
|
914
774
|
const isContainerXOverFlowSideHalf = this.isHalfOverFlow(clientRightInContainer - halfWidth, restClientLeftInContainer - halfWidth, wrapperRect.width / 2);
|
|
915
775
|
const isContainerYEnoughSideHalf = this.isHalfAllEnough(clientBottomInContainer - halfHeight, restClientTopInContainer - halfHeight, wrapperRect.height / 2);
|
|
916
|
-
const isContainerXEnoughSideHalf = this.isHalfAllEnough(clientRightInContainer - halfWidth, restClientLeftInContainer - halfWidth, wrapperRect.width / 2);
|
|
776
|
+
const isContainerXEnoughSideHalf = this.isHalfAllEnough(clientRightInContainer - halfWidth, restClientLeftInContainer - halfWidth, wrapperRect.width / 2);
|
|
777
|
+
// 综合 viewport + container 判断微调,即视口 + 容器都放置不行时才能考虑位置调整
|
|
917
778
|
// Comprehensive viewport + container judgment fine-tuning, that is, the position adjustment can only be considered when the viewport + container cannot be placed.
|
|
918
|
-
|
|
919
779
|
const shouldReverseTop = this.getReverse(isViewYOverFlow, isContainerYOverFlow, shouldViewReverseTop, shouldContainerReverseTop);
|
|
920
780
|
const shouldReverseLeft = this.getReverse(isViewXOverFlow, isContainerXOverFlow, shouldViewReverseLeft, shouldContainerReverseLeft);
|
|
921
781
|
const shouldReverseBottom = this.getReverse(isViewYOverFlow, isContainerYOverFlow, shouldViewReverseBottom, shouldContainerReverseBottom);
|
|
922
|
-
const shouldReverseRight = this.getReverse(isViewXOverFlow, isContainerXOverFlow, shouldViewReverseRight, shouldContainerReverseRight);
|
|
782
|
+
const shouldReverseRight = this.getReverse(isViewXOverFlow, isContainerXOverFlow, shouldViewReverseRight, shouldContainerReverseRight);
|
|
783
|
+
// const shouldReverseTopOver = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseTopOver, shouldContainerReverseTopOver);
|
|
923
784
|
// const shouldReverseBottomOver = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseBottomOver, shouldContainerReverseBottomOver);
|
|
924
|
-
|
|
925
785
|
const shouldReverseTopSide = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseTopSide, shouldContainerReverseTopSide);
|
|
926
786
|
const shouldReverseBottomSide = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseBottomSide, shouldContainerReverseBottomSide);
|
|
927
787
|
const shouldReverseLeftSide = this.getReverse(isViewXOverFlowSide, isContainerXOverFlowSide, shouldViewReverseLeftSide, shouldContainerReverseLeftSide);
|
|
928
788
|
const shouldReverseRightSide = this.getReverse(isViewXOverFlowSide, isContainerXOverFlowSide, shouldViewReverseRightSide, shouldContainerReverseRightSide);
|
|
929
789
|
const isYOverFlowSideHalf = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf;
|
|
930
790
|
const isXOverFlowSideHalf = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf;
|
|
931
|
-
|
|
932
791
|
switch (position) {
|
|
933
792
|
case 'top':
|
|
934
793
|
if (shouldReverseTop) {
|
|
935
794
|
position = this._adjustPos(position, true);
|
|
936
795
|
}
|
|
937
|
-
|
|
938
796
|
if (isXOverFlowSideHalf && (shouldReverseLeftSide || shouldReverseRightSide)) {
|
|
939
797
|
position = this._adjustPos(position, true, 'expand', shouldReverseLeftSide ? 'Right' : 'Left');
|
|
940
798
|
}
|
|
941
|
-
|
|
942
799
|
break;
|
|
943
|
-
|
|
944
800
|
case 'topLeft':
|
|
945
801
|
if (shouldReverseTop) {
|
|
946
802
|
position = this._adjustPos(position, true);
|
|
947
803
|
}
|
|
948
|
-
|
|
949
804
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
950
805
|
position = this._adjustPos(position);
|
|
951
806
|
}
|
|
952
|
-
|
|
953
807
|
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
954
808
|
position = this._adjustPos(position, true, 'reduce');
|
|
955
809
|
}
|
|
956
|
-
|
|
957
810
|
break;
|
|
958
|
-
|
|
959
811
|
case 'topRight':
|
|
960
812
|
if (shouldReverseTop) {
|
|
961
813
|
position = this._adjustPos(position, true);
|
|
962
814
|
}
|
|
963
|
-
|
|
964
815
|
if (shouldReverseRightSide && widthIsBigger) {
|
|
965
816
|
position = this._adjustPos(position);
|
|
966
817
|
}
|
|
967
|
-
|
|
968
818
|
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
969
819
|
position = this._adjustPos(position, true, 'reduce');
|
|
970
820
|
}
|
|
971
|
-
|
|
972
821
|
break;
|
|
973
|
-
|
|
974
822
|
case 'left':
|
|
975
823
|
if (shouldReverseLeft) {
|
|
976
824
|
position = this._adjustPos(position);
|
|
977
825
|
}
|
|
978
|
-
|
|
979
826
|
if (isYOverFlowSideHalf && (shouldReverseTopSide || shouldReverseBottomSide)) {
|
|
980
827
|
position = this._adjustPos(position, false, 'expand', shouldReverseTopSide ? 'Bottom' : 'Top');
|
|
981
828
|
}
|
|
982
|
-
|
|
983
829
|
break;
|
|
984
|
-
|
|
985
830
|
case 'leftTop':
|
|
986
831
|
if (shouldReverseLeft) {
|
|
987
832
|
position = this._adjustPos(position);
|
|
988
833
|
}
|
|
989
|
-
|
|
990
834
|
if (shouldReverseTopSide && heightIsBigger) {
|
|
991
835
|
position = this._adjustPos(position, true);
|
|
992
836
|
}
|
|
993
|
-
|
|
994
837
|
if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
|
|
995
838
|
position = this._adjustPos(position, false, 'reduce');
|
|
996
839
|
}
|
|
997
|
-
|
|
998
840
|
break;
|
|
999
|
-
|
|
1000
841
|
case 'leftBottom':
|
|
1001
842
|
if (shouldReverseLeft) {
|
|
1002
843
|
position = this._adjustPos(position);
|
|
1003
844
|
}
|
|
1004
|
-
|
|
1005
845
|
if (shouldReverseBottomSide && heightIsBigger) {
|
|
1006
846
|
position = this._adjustPos(position, true);
|
|
1007
847
|
}
|
|
1008
|
-
|
|
1009
848
|
if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
|
|
1010
849
|
position = this._adjustPos(position, false, 'reduce');
|
|
1011
850
|
}
|
|
1012
|
-
|
|
1013
851
|
break;
|
|
1014
|
-
|
|
1015
852
|
case 'bottom':
|
|
1016
853
|
if (shouldReverseBottom) {
|
|
1017
854
|
position = this._adjustPos(position, true);
|
|
1018
855
|
}
|
|
1019
|
-
|
|
1020
856
|
if (isXOverFlowSideHalf && (shouldReverseLeftSide || shouldReverseRightSide)) {
|
|
1021
857
|
position = this._adjustPos(position, true, 'expand', shouldReverseLeftSide ? 'Right' : 'Left');
|
|
1022
858
|
}
|
|
1023
|
-
|
|
1024
859
|
break;
|
|
1025
|
-
|
|
1026
860
|
case 'bottomLeft':
|
|
1027
861
|
if (shouldReverseBottom) {
|
|
1028
862
|
position = this._adjustPos(position, true);
|
|
1029
863
|
}
|
|
1030
|
-
|
|
1031
864
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
1032
865
|
position = this._adjustPos(position);
|
|
1033
866
|
}
|
|
1034
|
-
|
|
1035
867
|
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
1036
868
|
position = this._adjustPos(position, true, 'reduce');
|
|
1037
869
|
}
|
|
1038
|
-
|
|
1039
870
|
break;
|
|
1040
|
-
|
|
1041
871
|
case 'bottomRight':
|
|
1042
872
|
if (shouldReverseBottom) {
|
|
1043
873
|
position = this._adjustPos(position, true);
|
|
1044
874
|
}
|
|
1045
|
-
|
|
1046
875
|
if (shouldReverseRightSide && widthIsBigger) {
|
|
1047
876
|
position = this._adjustPos(position);
|
|
1048
877
|
}
|
|
1049
|
-
|
|
1050
878
|
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
1051
879
|
position = this._adjustPos(position, true, 'reduce');
|
|
1052
880
|
}
|
|
1053
|
-
|
|
1054
881
|
break;
|
|
1055
|
-
|
|
1056
882
|
case 'right':
|
|
1057
883
|
if (shouldReverseRight) {
|
|
1058
884
|
position = this._adjustPos(position);
|
|
1059
885
|
}
|
|
1060
|
-
|
|
1061
886
|
if (isYOverFlowSideHalf && (shouldReverseTopSide || shouldReverseBottomSide)) {
|
|
1062
887
|
position = this._adjustPos(position, false, 'expand', shouldReverseTopSide ? 'Bottom' : 'Top');
|
|
1063
888
|
}
|
|
1064
|
-
|
|
1065
889
|
break;
|
|
1066
|
-
|
|
1067
890
|
case 'rightTop':
|
|
1068
891
|
if (shouldReverseRight) {
|
|
1069
892
|
position = this._adjustPos(position);
|
|
1070
893
|
}
|
|
1071
|
-
|
|
1072
894
|
if (shouldReverseTopSide && heightIsBigger) {
|
|
1073
895
|
position = this._adjustPos(position, true);
|
|
1074
896
|
}
|
|
1075
|
-
|
|
1076
897
|
if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
|
|
1077
898
|
position = this._adjustPos(position, false, 'reduce');
|
|
1078
899
|
}
|
|
1079
|
-
|
|
1080
900
|
break;
|
|
1081
|
-
|
|
1082
901
|
case 'rightBottom':
|
|
1083
902
|
if (shouldReverseRight) {
|
|
1084
903
|
position = this._adjustPos(position);
|
|
1085
904
|
}
|
|
1086
|
-
|
|
1087
905
|
if (shouldReverseBottomSide && heightIsBigger) {
|
|
1088
906
|
position = this._adjustPos(position, true);
|
|
1089
907
|
}
|
|
1090
|
-
|
|
1091
908
|
if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
|
|
1092
909
|
position = this._adjustPos(position, false, 'reduce');
|
|
1093
910
|
}
|
|
1094
|
-
|
|
1095
911
|
break;
|
|
1096
|
-
|
|
1097
912
|
case 'leftTopOver':
|
|
1098
913
|
if (shouldReverseTopOver) {
|
|
1099
914
|
position = this._adjustPos(position, true);
|
|
1100
915
|
}
|
|
1101
|
-
|
|
1102
916
|
if (shouldReverseLeftOver) {
|
|
1103
917
|
position = this._adjustPos(position);
|
|
1104
918
|
}
|
|
1105
|
-
|
|
1106
919
|
break;
|
|
1107
|
-
|
|
1108
920
|
case 'leftBottomOver':
|
|
1109
921
|
if (shouldReverseBottomOver) {
|
|
1110
922
|
position = this._adjustPos(position, true);
|
|
1111
923
|
}
|
|
1112
|
-
|
|
1113
924
|
if (shouldReverseLeftOver) {
|
|
1114
925
|
position = this._adjustPos(position);
|
|
1115
926
|
}
|
|
1116
|
-
|
|
1117
927
|
break;
|
|
1118
|
-
|
|
1119
928
|
case 'rightTopOver':
|
|
1120
929
|
if (shouldReverseTopOver) {
|
|
1121
930
|
position = this._adjustPos(position, true);
|
|
1122
931
|
}
|
|
1123
|
-
|
|
1124
932
|
if (shouldReverseRightOver) {
|
|
1125
933
|
position = this._adjustPos(position);
|
|
1126
934
|
}
|
|
1127
|
-
|
|
1128
935
|
break;
|
|
1129
|
-
|
|
1130
936
|
case 'rightBottomOver':
|
|
1131
937
|
if (shouldReverseBottomOver) {
|
|
1132
938
|
position = this._adjustPos(position, true);
|
|
1133
939
|
}
|
|
1134
|
-
|
|
1135
940
|
if (shouldReverseRightOver) {
|
|
1136
941
|
position = this._adjustPos(position);
|
|
1137
942
|
}
|
|
1138
|
-
|
|
1139
943
|
break;
|
|
1140
|
-
|
|
1141
944
|
default:
|
|
1142
945
|
break;
|
|
1143
|
-
}
|
|
946
|
+
}
|
|
947
|
+
// 判断溢出 Judgment overflow
|
|
1144
948
|
// 上下方向 top and bottom
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
949
|
if (this.isTB(position)) {
|
|
1148
|
-
isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow;
|
|
950
|
+
isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow;
|
|
951
|
+
// Related PR: https://github.com/DouyinFE/semi-design/pull/1297
|
|
1149
952
|
// If clientRight or restClientRight less than 0, means that the left and right parts of the trigger are blocked
|
|
1150
953
|
// Then the display of the wrapper will also be affected, make width overflow to offset the wrapper
|
|
1151
|
-
|
|
1152
954
|
if (position === 'top' || position === 'bottom') {
|
|
1153
955
|
isWidthOverFlow = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf || clientRight < 0 || restClientRight < 0;
|
|
1154
956
|
} else {
|
|
1155
957
|
isWidthOverFlow = isViewXOverFlowSide && isContainerXOverFlowSide || clientRight < 0 || restClientRight < 0;
|
|
1156
958
|
}
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
|
|
959
|
+
}
|
|
960
|
+
// 左右方向 left and right
|
|
1160
961
|
if (this.isLR(position)) {
|
|
1161
|
-
isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow;
|
|
962
|
+
isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow;
|
|
963
|
+
// If clientTop or restClientTop less than 0, means that the top and bottom parts of the trigger are blocked
|
|
1162
964
|
// Then the display of the wrapper will also be affected, make height overflow to offset the wrapper
|
|
1163
|
-
|
|
1164
965
|
if (position === 'left' || position === 'right') {
|
|
1165
966
|
isHeightOverFlow = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf || clientTop < 0 || restClientTop < 0;
|
|
1166
967
|
} else {
|
|
@@ -1168,55 +969,44 @@ export default class Tooltip extends BaseFoundation {
|
|
|
1168
969
|
}
|
|
1169
970
|
}
|
|
1170
971
|
}
|
|
1171
|
-
|
|
1172
972
|
return {
|
|
1173
973
|
position,
|
|
1174
974
|
isHeightOverFlow,
|
|
1175
975
|
isWidthOverFlow
|
|
1176
976
|
};
|
|
1177
977
|
}
|
|
1178
|
-
|
|
1179
978
|
_bindScrollEvent() {
|
|
1180
|
-
this._adapter.registerScrollHandler(() => this.calcPosition());
|
|
979
|
+
this._adapter.registerScrollHandler(() => this.calcPosition());
|
|
980
|
+
// Capture scroll events on the window to determine whether the current scrolling area (e.target) will affect the positioning of the pop-up layer relative to the viewport when scrolling
|
|
1181
981
|
// (By determining whether the e.target contains the triggerDom of the current tooltip) If so, the pop-up layer will also be affected and needs to be repositioned
|
|
1182
|
-
|
|
1183
982
|
}
|
|
1184
983
|
|
|
1185
984
|
unBindScrollEvent() {
|
|
1186
985
|
this._adapter.unregisterScrollHandler();
|
|
1187
986
|
}
|
|
1188
|
-
|
|
1189
987
|
_initContainerPosition() {
|
|
1190
988
|
this._adapter.updateContainerPosition();
|
|
1191
989
|
}
|
|
1192
|
-
|
|
1193
990
|
_handleTriggerKeydown(event) {
|
|
1194
991
|
const {
|
|
1195
992
|
closeOnEsc,
|
|
1196
993
|
disableArrowKeyDown
|
|
1197
994
|
} = this.getProps();
|
|
1198
|
-
|
|
1199
995
|
const container = this._adapter.getContainer();
|
|
1200
|
-
|
|
1201
996
|
const focusableElements = this._adapter.getFocusableElements(container);
|
|
1202
|
-
|
|
1203
997
|
const focusableNum = focusableElements.length;
|
|
1204
|
-
|
|
1205
998
|
switch (event && event.key) {
|
|
1206
999
|
case "Escape":
|
|
1207
1000
|
handlePrevent(event);
|
|
1208
1001
|
closeOnEsc && this._handleEscKeyDown(event);
|
|
1209
1002
|
break;
|
|
1210
|
-
|
|
1211
1003
|
case "ArrowUp":
|
|
1212
1004
|
// when disableArrowKeyDown is true, disable tooltip's arrow keyboard event action
|
|
1213
1005
|
!disableArrowKeyDown && focusableNum && this._handleTriggerArrowUpKeydown(focusableElements, event);
|
|
1214
1006
|
break;
|
|
1215
|
-
|
|
1216
1007
|
case "ArrowDown":
|
|
1217
1008
|
!disableArrowKeyDown && focusableNum && this._handleTriggerArrowDownKeydown(focusableElements, event);
|
|
1218
1009
|
break;
|
|
1219
|
-
|
|
1220
1010
|
default:
|
|
1221
1011
|
break;
|
|
1222
1012
|
}
|
|
@@ -1230,18 +1020,14 @@ export default class Tooltip extends BaseFoundation {
|
|
|
1230
1020
|
* 如果 trigger 是 focus 或者 hover,则它绑定了 onFocus,这里我们如果重新 focus 的话,popup 会再次打开
|
|
1231
1021
|
* 因此 returnFocusOnClose 只支持 click trigger
|
|
1232
1022
|
*/
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
1023
|
focusTrigger() {
|
|
1236
1024
|
const {
|
|
1237
1025
|
trigger,
|
|
1238
1026
|
returnFocusOnClose,
|
|
1239
1027
|
preventScroll
|
|
1240
1028
|
} = this.getProps();
|
|
1241
|
-
|
|
1242
1029
|
if (returnFocusOnClose && trigger !== 'custom') {
|
|
1243
1030
|
const triggerNode = this._adapter.getTriggerNode();
|
|
1244
|
-
|
|
1245
1031
|
if (triggerNode && 'focus' in triggerNode) {
|
|
1246
1032
|
triggerNode.focus({
|
|
1247
1033
|
preventScroll
|
|
@@ -1249,31 +1035,24 @@ export default class Tooltip extends BaseFoundation {
|
|
|
1249
1035
|
}
|
|
1250
1036
|
}
|
|
1251
1037
|
}
|
|
1252
|
-
|
|
1253
1038
|
_handleEscKeyDown(event) {
|
|
1254
1039
|
const {
|
|
1255
1040
|
trigger
|
|
1256
1041
|
} = this.getProps();
|
|
1257
|
-
|
|
1258
1042
|
if (trigger !== 'custom') {
|
|
1259
1043
|
// Move the focus into the trigger first and then close the pop-up layer
|
|
1260
1044
|
// to avoid the problem of opening the pop-up layer again when the focus returns to the trigger in the case of hover and focus
|
|
1261
1045
|
this.focusTrigger();
|
|
1262
1046
|
this.hide();
|
|
1263
1047
|
}
|
|
1264
|
-
|
|
1265
1048
|
this._adapter.notifyEscKeydown(event);
|
|
1266
1049
|
}
|
|
1267
|
-
|
|
1268
1050
|
_handleContainerTabKeyDown(focusableElements, event) {
|
|
1269
1051
|
const {
|
|
1270
1052
|
preventScroll
|
|
1271
1053
|
} = this.getProps();
|
|
1272
|
-
|
|
1273
1054
|
const activeElement = this._adapter.getActiveElement();
|
|
1274
|
-
|
|
1275
1055
|
const isLastCurrentFocus = focusableElements[focusableElements.length - 1] === activeElement;
|
|
1276
|
-
|
|
1277
1056
|
if (isLastCurrentFocus) {
|
|
1278
1057
|
focusableElements[0].focus({
|
|
1279
1058
|
preventScroll
|
|
@@ -1286,11 +1065,8 @@ export default class Tooltip extends BaseFoundation {
|
|
|
1286
1065
|
const {
|
|
1287
1066
|
preventScroll
|
|
1288
1067
|
} = this.getProps();
|
|
1289
|
-
|
|
1290
1068
|
const activeElement = this._adapter.getActiveElement();
|
|
1291
|
-
|
|
1292
1069
|
const isFirstCurrentFocus = focusableElements[0] === activeElement;
|
|
1293
|
-
|
|
1294
1070
|
if (isFirstCurrentFocus) {
|
|
1295
1071
|
focusableElements[focusableElements.length - 1].focus({
|
|
1296
1072
|
preventScroll
|
|
@@ -1318,5 +1094,4 @@ export default class Tooltip extends BaseFoundation {
|
|
|
1318
1094
|
});
|
|
1319
1095
|
event.preventDefault(); // prevent browser default scroll behavior
|
|
1320
1096
|
}
|
|
1321
|
-
|
|
1322
1097
|
}
|