@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
|
@@ -2,65 +2,52 @@ import _isObject from "lodash/isObject";
|
|
|
2
2
|
import _isUndefined from "lodash/isUndefined";
|
|
3
3
|
import _isNumber from "lodash/isNumber";
|
|
4
4
|
import _isString from "lodash/isString";
|
|
5
|
-
|
|
6
5
|
/* eslint-disable prefer-const, max-len */
|
|
7
6
|
import BaseFoundation from '../base/foundation';
|
|
8
7
|
import warning from '../utils/warning';
|
|
9
8
|
import KeyCode from '../utils/keyCode';
|
|
10
|
-
|
|
11
9
|
class AutoCompleteFoundation extends BaseFoundation {
|
|
12
10
|
constructor(adapter) {
|
|
13
11
|
super(Object.assign({}, adapter));
|
|
14
12
|
this.isPanelOpen = false;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
init() {
|
|
18
15
|
this._setDropdownWidth();
|
|
19
|
-
|
|
20
16
|
const {
|
|
21
17
|
defaultOpen,
|
|
22
18
|
data,
|
|
23
19
|
defaultValue,
|
|
24
20
|
value
|
|
25
21
|
} = this.getProps();
|
|
26
|
-
|
|
27
22
|
if (data && data.length) {
|
|
28
23
|
const initOptions = this._generateList(data);
|
|
29
|
-
|
|
30
24
|
this._adapter.updateOptionList(initOptions);
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
if (defaultOpen) {
|
|
34
27
|
this.openDropdown();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
}
|
|
29
|
+
// When both defaultValue and value exist, finally the value of value will be taken as initValue
|
|
38
30
|
let initValue;
|
|
39
|
-
|
|
40
31
|
if (typeof defaultValue !== 'undefined') {
|
|
41
32
|
initValue = defaultValue;
|
|
42
33
|
}
|
|
43
|
-
|
|
44
34
|
if (typeof value !== 'undefined') {
|
|
45
35
|
initValue = value;
|
|
46
36
|
}
|
|
47
|
-
|
|
48
37
|
if (typeof initValue !== 'undefined') {
|
|
49
38
|
this.handleValueChange(initValue);
|
|
50
39
|
}
|
|
51
40
|
}
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
destroy() {
|
|
42
|
+
// this._adapter.unregisterClickOutsideHandler();
|
|
54
43
|
// this.unBindKeyBoardEvent();
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
_setDropdownWidth() {
|
|
58
46
|
const {
|
|
59
47
|
style,
|
|
60
48
|
dropdownMatchSelectWidth
|
|
61
49
|
} = this.getProps();
|
|
62
50
|
let width;
|
|
63
|
-
|
|
64
51
|
if (dropdownMatchSelectWidth) {
|
|
65
52
|
if (style && _isNumber(style.width)) {
|
|
66
53
|
width = style.width;
|
|
@@ -69,11 +56,9 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
69
56
|
} else {
|
|
70
57
|
width = this._adapter.getTriggerWidth();
|
|
71
58
|
}
|
|
72
|
-
|
|
73
59
|
this._adapter.setOptionWrapperWidth(width);
|
|
74
60
|
}
|
|
75
61
|
}
|
|
76
|
-
|
|
77
62
|
handleInputClick(e) {
|
|
78
63
|
const {
|
|
79
64
|
options
|
|
@@ -81,7 +66,6 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
81
66
|
const {
|
|
82
67
|
disabled
|
|
83
68
|
} = this.getProps();
|
|
84
|
-
|
|
85
69
|
if (!disabled) {
|
|
86
70
|
if (this.isPanelOpen) {
|
|
87
71
|
this.closeDropdown();
|
|
@@ -90,43 +74,32 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
90
74
|
}
|
|
91
75
|
}
|
|
92
76
|
}
|
|
93
|
-
|
|
94
77
|
openDropdown() {
|
|
95
78
|
this.isPanelOpen = true;
|
|
96
|
-
|
|
97
79
|
this._adapter.toggleListVisible(true);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
80
|
+
this._setDropdownWidth();
|
|
81
|
+
// this._adapter.registerClickOutsideHandler(e => this.closeDropdown(e));
|
|
102
82
|
this._adapter.notifyDropdownVisibleChange(true);
|
|
103
|
-
|
|
104
83
|
this._modifyFocusIndexOnPanelOpen();
|
|
105
84
|
}
|
|
106
|
-
|
|
107
85
|
closeDropdown(e) {
|
|
108
86
|
this.isPanelOpen = false;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
this._adapter.notifyDropdownVisibleChange(false); // After closing the panel, you can still open the panel by pressing the enter key
|
|
87
|
+
this._adapter.toggleListVisible(false);
|
|
88
|
+
// this._adapter.unregisterClickOutsideHandler();
|
|
89
|
+
this._adapter.notifyDropdownVisibleChange(false);
|
|
90
|
+
// After closing the panel, you can still open the panel by pressing the enter key
|
|
114
91
|
// this.unBindKeyBoardEvent();
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
92
|
+
}
|
|
93
|
+
// props.data => optionList
|
|
119
94
|
_generateList(data) {
|
|
120
95
|
const {
|
|
121
96
|
renderItem
|
|
122
97
|
} = this.getProps();
|
|
123
98
|
const options = [];
|
|
124
|
-
|
|
125
99
|
if (data && data.length) {
|
|
126
100
|
data.forEach((item, i) => {
|
|
127
101
|
const key = String(new Date().getTime()) + i;
|
|
128
102
|
let option = {};
|
|
129
|
-
|
|
130
103
|
if (_isString(item) || _isNumber(item)) {
|
|
131
104
|
option = {
|
|
132
105
|
value: item,
|
|
@@ -139,47 +112,36 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
139
112
|
show: true
|
|
140
113
|
}, item);
|
|
141
114
|
}
|
|
142
|
-
|
|
143
115
|
if (renderItem && typeof renderItem === 'function') {
|
|
144
116
|
option.label = renderItem(item);
|
|
145
117
|
}
|
|
146
|
-
|
|
147
118
|
options.push(option);
|
|
148
119
|
});
|
|
149
120
|
}
|
|
150
|
-
|
|
151
121
|
return options;
|
|
152
122
|
}
|
|
153
|
-
|
|
154
123
|
handleSearch(inputValue) {
|
|
155
124
|
this._adapter.updateInputValue(inputValue);
|
|
156
|
-
|
|
157
125
|
this._adapter.notifySearch(inputValue);
|
|
158
|
-
|
|
159
126
|
this._adapter.notifyChange(inputValue);
|
|
160
|
-
|
|
161
127
|
this._modifyFocusIndex(inputValue);
|
|
162
|
-
|
|
163
128
|
if (!this.isPanelOpen) {
|
|
164
129
|
this.openDropdown();
|
|
165
130
|
}
|
|
166
131
|
}
|
|
167
|
-
|
|
168
132
|
handleSelect(option, optionIndex) {
|
|
169
133
|
const {
|
|
170
134
|
renderSelectedItem
|
|
171
135
|
} = this.getProps();
|
|
172
136
|
let newInputValue = '';
|
|
173
|
-
|
|
174
137
|
if (renderSelectedItem && typeof renderSelectedItem === 'function') {
|
|
175
138
|
newInputValue = renderSelectedItem(option);
|
|
176
139
|
warning(typeof newInputValue !== 'string', 'Warning: [Semi AutoComplete] renderSelectedItem must return string, please check your function return');
|
|
177
140
|
} else {
|
|
178
141
|
newInputValue = option.value;
|
|
179
|
-
}
|
|
142
|
+
}
|
|
143
|
+
// 1. trigger onSelect
|
|
180
144
|
// 2. close Dropdown
|
|
181
|
-
|
|
182
|
-
|
|
183
145
|
if (this._isControlledComponent()) {
|
|
184
146
|
this.closeDropdown();
|
|
185
147
|
this.notifySelect(option);
|
|
@@ -189,27 +151,20 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
189
151
|
// 3. trigger onSelect
|
|
190
152
|
// 4. close Dropdown
|
|
191
153
|
this._adapter.updateInputValue(newInputValue);
|
|
192
|
-
|
|
193
154
|
this.updateSelection(option);
|
|
194
155
|
this.notifySelect(option);
|
|
195
156
|
this.closeDropdown();
|
|
196
157
|
}
|
|
197
|
-
|
|
198
158
|
this._adapter.notifyChange(newInputValue);
|
|
199
|
-
|
|
200
159
|
this._adapter.updateFocusIndex(optionIndex);
|
|
201
160
|
}
|
|
202
|
-
|
|
203
161
|
updateSelection(option) {
|
|
204
162
|
const selection = new Map();
|
|
205
|
-
|
|
206
163
|
if (option) {
|
|
207
164
|
selection.set(option.label, option);
|
|
208
165
|
}
|
|
209
|
-
|
|
210
166
|
this._adapter.updateSelection(selection);
|
|
211
167
|
}
|
|
212
|
-
|
|
213
168
|
notifySelect(option) {
|
|
214
169
|
if (this._backwardLabelInValue()) {
|
|
215
170
|
this._adapter.notifySelect(option);
|
|
@@ -217,7 +172,6 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
217
172
|
this._adapter.notifySelect(option.value);
|
|
218
173
|
}
|
|
219
174
|
}
|
|
220
|
-
|
|
221
175
|
_backwardLabelInValue() {
|
|
222
176
|
const props = this.getProps();
|
|
223
177
|
let {
|
|
@@ -225,38 +179,29 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
225
179
|
} = props;
|
|
226
180
|
return onSelectWithObject;
|
|
227
181
|
}
|
|
228
|
-
|
|
229
182
|
handleDataChange(newData) {
|
|
230
183
|
const options = this._generateList(newData);
|
|
231
|
-
|
|
232
184
|
this._adapter.updateOptionList(options);
|
|
233
|
-
|
|
234
185
|
this._adapter.rePositionDropdown();
|
|
235
186
|
}
|
|
236
|
-
|
|
237
187
|
handleValueChange(propValue) {
|
|
238
188
|
let {
|
|
239
189
|
data,
|
|
240
190
|
defaultActiveFirstOption
|
|
241
191
|
} = this.getProps();
|
|
242
192
|
let selectedValue = '';
|
|
243
|
-
|
|
244
193
|
if (this._backwardLabelInValue() && Object.prototype.toString.call(propValue) === '[object Object]') {
|
|
245
194
|
selectedValue = propValue.value;
|
|
246
195
|
} else {
|
|
247
196
|
selectedValue = propValue;
|
|
248
197
|
}
|
|
249
|
-
|
|
250
198
|
let renderSelectedItem = this._getRenderSelectedItem();
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
199
|
+
const options = this._generateList(data);
|
|
200
|
+
// Get the option whose value match from options
|
|
255
201
|
let selectedOption = options.filter(option => renderSelectedItem(option) === selectedValue);
|
|
256
202
|
const canMatchInData = selectedOption.length;
|
|
257
203
|
const selectedOptionIndex = options.findIndex(option => renderSelectedItem(option) === selectedValue);
|
|
258
204
|
let inputValue = '';
|
|
259
|
-
|
|
260
205
|
if (canMatchInData) {
|
|
261
206
|
selectedOption = selectedOption[0];
|
|
262
207
|
inputValue = renderSelectedItem(selectedOption);
|
|
@@ -267,18 +212,14 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
267
212
|
};
|
|
268
213
|
inputValue = renderSelectedItem(cbItem);
|
|
269
214
|
}
|
|
270
|
-
|
|
271
215
|
this._adapter.updateInputValue(inputValue);
|
|
272
|
-
|
|
273
216
|
this.updateSelection(canMatchInData ? selectedOption : null);
|
|
274
|
-
|
|
275
217
|
if (selectedOptionIndex === -1 && defaultActiveFirstOption) {
|
|
276
218
|
this._adapter.updateFocusIndex(0);
|
|
277
219
|
} else {
|
|
278
220
|
this._adapter.updateFocusIndex(selectedOptionIndex);
|
|
279
221
|
}
|
|
280
222
|
}
|
|
281
|
-
|
|
282
223
|
_modifyFocusIndex(searchValue) {
|
|
283
224
|
let {
|
|
284
225
|
focusIndex
|
|
@@ -287,13 +228,9 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
287
228
|
data,
|
|
288
229
|
defaultActiveFirstOption
|
|
289
230
|
} = this.getProps();
|
|
290
|
-
|
|
291
231
|
let renderSelectedItem = this._getRenderSelectedItem();
|
|
292
|
-
|
|
293
232
|
const options = this._generateList(data);
|
|
294
|
-
|
|
295
233
|
const selectedOptionIndex = options.findIndex(option => renderSelectedItem(option) === searchValue);
|
|
296
|
-
|
|
297
234
|
if (selectedOptionIndex === -1 && defaultActiveFirstOption) {
|
|
298
235
|
if (focusIndex !== 0) {
|
|
299
236
|
this._adapter.updateFocusIndex(0);
|
|
@@ -304,87 +241,66 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
304
241
|
}
|
|
305
242
|
}
|
|
306
243
|
}
|
|
307
|
-
|
|
308
244
|
_modifyFocusIndexOnPanelOpen() {
|
|
309
245
|
let {
|
|
310
246
|
inputValue
|
|
311
247
|
} = this.getStates();
|
|
312
|
-
|
|
313
248
|
this._modifyFocusIndex(inputValue);
|
|
314
249
|
}
|
|
315
|
-
|
|
316
250
|
_getRenderSelectedItem() {
|
|
317
251
|
let {
|
|
318
252
|
renderSelectedItem
|
|
319
253
|
} = this.getProps();
|
|
320
|
-
|
|
321
254
|
if (typeof renderSelectedItem === 'undefined') {
|
|
322
255
|
renderSelectedItem = option => option.value;
|
|
323
|
-
} else if (renderSelectedItem && typeof renderSelectedItem === 'function') {
|
|
256
|
+
} else if (renderSelectedItem && typeof renderSelectedItem === 'function') {
|
|
257
|
+
// do nothing
|
|
324
258
|
}
|
|
325
|
-
|
|
326
259
|
return renderSelectedItem;
|
|
327
260
|
}
|
|
328
|
-
|
|
329
261
|
handleClear() {
|
|
330
262
|
this._adapter.notifyClear();
|
|
331
263
|
}
|
|
332
|
-
|
|
333
264
|
bindKeyBoardEvent() {
|
|
334
265
|
this._keydownHandler = event => {
|
|
335
266
|
this._handleKeyDown(event);
|
|
336
267
|
};
|
|
337
|
-
|
|
338
268
|
this._adapter.registerKeyDown(this._keydownHandler);
|
|
339
|
-
}
|
|
269
|
+
}
|
|
270
|
+
// unBindKeyBoardEvent() {
|
|
340
271
|
// if (this._keydownHandler) {
|
|
341
272
|
// this._adapter.unregisterKeyDown(this._keydownHandler);
|
|
342
273
|
// }
|
|
343
274
|
// }
|
|
344
|
-
|
|
345
|
-
|
|
346
275
|
_handleKeyDown(event) {
|
|
347
276
|
const key = event.keyCode;
|
|
348
277
|
const {
|
|
349
278
|
visible
|
|
350
279
|
} = this.getStates();
|
|
351
|
-
|
|
352
280
|
switch (key) {
|
|
353
281
|
case KeyCode.UP:
|
|
354
282
|
// Prevent Input's cursor from following the movement
|
|
355
283
|
event.preventDefault();
|
|
356
|
-
|
|
357
284
|
this._handleArrowKeyDown(-1);
|
|
358
|
-
|
|
359
285
|
break;
|
|
360
|
-
|
|
361
286
|
case KeyCode.DOWN:
|
|
362
287
|
// Prevent Input's cursor from following the movement
|
|
363
288
|
event.preventDefault();
|
|
364
|
-
|
|
365
289
|
this._handleArrowKeyDown(1);
|
|
366
|
-
|
|
367
290
|
break;
|
|
368
|
-
|
|
369
291
|
case KeyCode.ENTER:
|
|
370
292
|
// when custom trigger, prevent outer open panel again
|
|
371
293
|
event.preventDefault();
|
|
372
|
-
|
|
373
294
|
this._handleEnterKeyDown();
|
|
374
|
-
|
|
375
295
|
break;
|
|
376
|
-
|
|
377
296
|
case KeyCode.ESC:
|
|
378
297
|
this.closeDropdown();
|
|
379
298
|
break;
|
|
380
|
-
|
|
381
299
|
default:
|
|
382
300
|
break;
|
|
383
301
|
}
|
|
384
|
-
|
|
385
302
|
this._adapter.notifyKeyDown(event);
|
|
386
303
|
}
|
|
387
|
-
|
|
388
304
|
_getEnableFocusIndex(offset) {
|
|
389
305
|
const {
|
|
390
306
|
focusIndex,
|
|
@@ -393,72 +309,56 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
393
309
|
const visibleOptions = options.filter(item => item.show);
|
|
394
310
|
const optionsLength = visibleOptions.length;
|
|
395
311
|
let index = focusIndex + offset;
|
|
396
|
-
|
|
397
312
|
if (index < 0) {
|
|
398
313
|
index = optionsLength - 1;
|
|
399
314
|
}
|
|
400
|
-
|
|
401
315
|
if (index >= optionsLength) {
|
|
402
316
|
index = 0;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
|
|
317
|
+
}
|
|
318
|
+
// avoid newIndex option is disabled
|
|
406
319
|
if (offset > 0) {
|
|
407
320
|
let nearestActiveOption = -1;
|
|
408
|
-
|
|
409
321
|
for (let i = 0; i < visibleOptions.length; i++) {
|
|
410
322
|
const optionIsActive = !visibleOptions[i].disabled;
|
|
411
|
-
|
|
412
323
|
if (optionIsActive) {
|
|
413
324
|
nearestActiveOption = i;
|
|
414
325
|
}
|
|
415
|
-
|
|
416
326
|
if (nearestActiveOption >= index) {
|
|
417
327
|
break;
|
|
418
328
|
}
|
|
419
329
|
}
|
|
420
|
-
|
|
421
330
|
index = nearestActiveOption;
|
|
422
331
|
} else {
|
|
423
332
|
let nearestActiveOption = visibleOptions.length;
|
|
424
|
-
|
|
425
333
|
for (let i = optionsLength - 1; i >= 0; i--) {
|
|
426
334
|
const optionIsActive = !visibleOptions[i].disabled;
|
|
427
|
-
|
|
428
335
|
if (optionIsActive) {
|
|
429
336
|
nearestActiveOption = i;
|
|
430
337
|
}
|
|
431
|
-
|
|
432
338
|
if (nearestActiveOption <= index) {
|
|
433
339
|
break;
|
|
434
340
|
}
|
|
435
341
|
}
|
|
436
|
-
|
|
437
342
|
index = nearestActiveOption;
|
|
438
343
|
}
|
|
439
|
-
|
|
440
344
|
this._adapter.updateFocusIndex(index);
|
|
441
345
|
}
|
|
442
|
-
|
|
443
346
|
_handleArrowKeyDown(offset) {
|
|
444
347
|
const {
|
|
445
348
|
visible
|
|
446
349
|
} = this.getStates();
|
|
447
|
-
|
|
448
350
|
if (!visible) {
|
|
449
351
|
this.openDropdown();
|
|
450
352
|
} else {
|
|
451
353
|
this._getEnableFocusIndex(offset);
|
|
452
354
|
}
|
|
453
355
|
}
|
|
454
|
-
|
|
455
356
|
_handleEnterKeyDown() {
|
|
456
357
|
const {
|
|
457
358
|
visible,
|
|
458
359
|
options,
|
|
459
360
|
focusIndex
|
|
460
361
|
} = this.getStates();
|
|
461
|
-
|
|
462
362
|
if (!visible) {
|
|
463
363
|
this.openDropdown();
|
|
464
364
|
} else {
|
|
@@ -471,33 +371,25 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
471
371
|
}
|
|
472
372
|
}
|
|
473
373
|
}
|
|
474
|
-
|
|
475
374
|
handleOptionMouseEnter(optionIndex) {
|
|
476
375
|
this._adapter.updateFocusIndex(optionIndex);
|
|
477
376
|
}
|
|
478
|
-
|
|
479
377
|
handleFocus(e) {
|
|
480
378
|
// If you get the focus through the tab key, you need to manually bind keyboard events
|
|
481
379
|
// Then you can open the panel by pressing the enter key
|
|
482
380
|
this.bindKeyBoardEvent();
|
|
483
|
-
|
|
484
381
|
this._adapter.notifyFocus(e);
|
|
485
382
|
}
|
|
486
|
-
|
|
487
383
|
handleBlur(e) {
|
|
488
384
|
// only need persist on react adapter
|
|
489
385
|
// https://reactjs.org/docs/legacy-event-pooling.html
|
|
490
|
-
this._persistEvent(e);
|
|
386
|
+
this._persistEvent(e);
|
|
387
|
+
// In order to handle the problem of losing onClick binding when clicking on the padding area, the onBlur event is triggered first to cause the react view to be updated
|
|
491
388
|
// internal-issues:1231
|
|
492
|
-
|
|
493
|
-
|
|
494
389
|
setTimeout(() => {
|
|
495
390
|
this._adapter.notifyBlur(e);
|
|
496
|
-
|
|
497
391
|
this.closeDropdown();
|
|
498
392
|
}, 100);
|
|
499
393
|
}
|
|
500
|
-
|
|
501
394
|
}
|
|
502
|
-
|
|
503
395
|
export default AutoCompleteFoundation;
|
|
@@ -2,24 +2,18 @@ import BaseFoundation from '../base/foundation';
|
|
|
2
2
|
export default class OptionFoundation extends BaseFoundation {
|
|
3
3
|
constructor(adapter) {
|
|
4
4
|
super(Object.assign({}, adapter));
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
}
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
7
|
+
init() {}
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
11
9
|
destroy() {}
|
|
12
|
-
|
|
13
10
|
onOptionClick(option) {
|
|
14
11
|
const isDisabled = this._isDisabled();
|
|
15
|
-
|
|
16
12
|
if (!isDisabled) {
|
|
17
13
|
this._adapter.notifyClick(option);
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
_isDisabled() {
|
|
22
17
|
return this.getProp('disabled');
|
|
23
18
|
}
|
|
24
|
-
|
|
25
19
|
}
|
|
@@ -3,12 +3,10 @@ import warning from '../utils/warning';
|
|
|
3
3
|
export default class AvatarFoundation extends BaseFoundation {
|
|
4
4
|
constructor(adapter) {
|
|
5
5
|
super(Object.assign({}, adapter));
|
|
6
|
-
|
|
7
6
|
this.handleFocusVisible = event => {
|
|
8
7
|
const {
|
|
9
8
|
target
|
|
10
9
|
} = event;
|
|
11
|
-
|
|
12
10
|
try {
|
|
13
11
|
if (target.matches(':focus-visible')) {
|
|
14
12
|
this._adapter.setFocusVisible(true);
|
|
@@ -17,35 +15,25 @@ export default class AvatarFoundation extends BaseFoundation {
|
|
|
17
15
|
warning(true, 'Warning: [Semi Avatar] The current browser does not support the focus-visible');
|
|
18
16
|
}
|
|
19
17
|
};
|
|
20
|
-
|
|
21
18
|
this.handleBlur = () => {
|
|
22
19
|
this._adapter.setFocusVisible(false);
|
|
23
20
|
};
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
init() {} // eslint-disable-line
|
|
27
|
-
|
|
28
|
-
|
|
29
23
|
destroy() {} // eslint-disable-line
|
|
30
|
-
|
|
31
|
-
|
|
32
24
|
handleImgLoadError() {
|
|
33
25
|
const {
|
|
34
26
|
onError
|
|
35
27
|
} = this.getProps();
|
|
36
28
|
const errorFlag = onError ? onError() : undefined;
|
|
37
|
-
|
|
38
29
|
if (errorFlag !== false) {
|
|
39
30
|
this._adapter.notifyImgState(false);
|
|
40
31
|
}
|
|
41
32
|
}
|
|
42
|
-
|
|
43
33
|
handleEnter(e) {
|
|
44
34
|
this._adapter.notifyEnter(e);
|
|
45
35
|
}
|
|
46
|
-
|
|
47
36
|
handleLeave(e) {
|
|
48
37
|
this._adapter.notifyLeave(e);
|
|
49
38
|
}
|
|
50
|
-
|
|
51
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type BackTopClickEvent = any;
|
|
3
|
+
export type Target = any;
|
|
4
4
|
export interface BackTopAdapter extends DefaultAdapter {
|
|
5
5
|
updateVisible: (visible: boolean) => void;
|
|
6
6
|
notifyClick: (e: BackTopClickEvent) => void;
|
|
@@ -3,7 +3,6 @@ import { Animation } from '@douyinfe/semi-animation';
|
|
|
3
3
|
export default class BackTopFoundation extends BaseFoundation {
|
|
4
4
|
constructor(adapter) {
|
|
5
5
|
super(Object.assign({}, adapter));
|
|
6
|
-
|
|
7
6
|
this.scrollTo = (targetNode, from, to) => {
|
|
8
7
|
const {
|
|
9
8
|
duration
|
|
@@ -23,29 +22,23 @@ export default class BackTopFoundation extends BaseFoundation {
|
|
|
23
22
|
let {
|
|
24
23
|
scrollTop
|
|
25
24
|
} = _ref;
|
|
26
|
-
|
|
27
25
|
this._adapter.targetScrollToTop(targetNode, scrollTop);
|
|
28
26
|
});
|
|
29
27
|
this.animation.start();
|
|
30
28
|
};
|
|
31
|
-
|
|
32
29
|
this.handleScroll = () => {
|
|
33
30
|
const {
|
|
34
31
|
target,
|
|
35
32
|
visibilityHeight
|
|
36
33
|
} = this.getProps();
|
|
37
34
|
const targetNode = target();
|
|
38
|
-
|
|
39
35
|
const update = () => {
|
|
40
36
|
const scrollTop = this.getScroll(targetNode);
|
|
41
|
-
|
|
42
37
|
this._adapter.updateVisible(scrollTop > visibilityHeight);
|
|
43
38
|
};
|
|
44
|
-
|
|
45
39
|
requestAnimationFrame(update);
|
|
46
40
|
};
|
|
47
41
|
}
|
|
48
|
-
|
|
49
42
|
init() {
|
|
50
43
|
const {
|
|
51
44
|
target
|
|
@@ -54,7 +47,6 @@ export default class BackTopFoundation extends BaseFoundation {
|
|
|
54
47
|
targetNode.addEventListener('scroll', this.handleScroll);
|
|
55
48
|
this.handleScroll();
|
|
56
49
|
}
|
|
57
|
-
|
|
58
50
|
destroy() {
|
|
59
51
|
const {
|
|
60
52
|
target
|
|
@@ -63,21 +55,16 @@ export default class BackTopFoundation extends BaseFoundation {
|
|
|
63
55
|
targetNode && targetNode.removeEventListener('scroll', this.handleScroll);
|
|
64
56
|
this.animation && this.animation.destroy();
|
|
65
57
|
}
|
|
66
|
-
|
|
67
58
|
getScroll(target) {
|
|
68
59
|
if (this._adapter.isWindowUndefined()) {
|
|
69
60
|
return 0;
|
|
70
61
|
}
|
|
71
|
-
|
|
72
62
|
const prop = 'pageYOffset';
|
|
73
63
|
const method = 'scrollTop';
|
|
74
|
-
|
|
75
64
|
const isWindow = this._adapter.targetIsWindow(target);
|
|
76
|
-
|
|
77
65
|
const scroll = isWindow ? target[prop] : target[method];
|
|
78
66
|
return scroll;
|
|
79
67
|
}
|
|
80
|
-
|
|
81
68
|
setScrollTop(to) {
|
|
82
69
|
const {
|
|
83
70
|
target
|
|
@@ -86,11 +73,8 @@ export default class BackTopFoundation extends BaseFoundation {
|
|
|
86
73
|
const from = this.getScroll(targetNode);
|
|
87
74
|
this.scrollTo(targetNode, from, to);
|
|
88
75
|
}
|
|
89
|
-
|
|
90
76
|
onClick(e) {
|
|
91
77
|
this.setScrollTop(0);
|
|
92
|
-
|
|
93
78
|
this._adapter.notifyClick(e);
|
|
94
79
|
}
|
|
95
|
-
|
|
96
80
|
}
|
|
@@ -3,11 +3,8 @@ export default class BannerFoundation extends BaseFoundation {
|
|
|
3
3
|
constructor(adapter) {
|
|
4
4
|
super(Object.assign(Object.assign({}, BannerFoundation.defaultAdapter), adapter));
|
|
5
5
|
}
|
|
6
|
-
|
|
7
6
|
removeBanner(e) {
|
|
8
7
|
this._adapter.notifyClose(e);
|
|
9
|
-
|
|
10
8
|
this._adapter.setVisible();
|
|
11
9
|
}
|
|
12
|
-
|
|
13
10
|
}
|
package/lib/es/base/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { BASE_CLASS_PREFIX } from './env';
|
|
2
|
-
const VALIDATE_STATUS = ['default', 'error', 'warning', 'success'];
|
|
3
|
-
|
|
2
|
+
const VALIDATE_STATUS = ['default', 'error', 'warning', 'success'];
|
|
3
|
+
// const VALIDATE_STATUS = ['default', 'error', 'warning', 'success', 'validating'] as const;
|
|
4
4
|
export { BASE_CLASS_PREFIX, VALIDATE_STATUS };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* We re-implemented our own code based on the principle and added more functions we need according to actual needs.
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type noopFunction = (...args: any) => any;
|
|
7
7
|
export interface DefaultAdapter<P = Record<string, any>, S = Record<string, any>> {
|
|
8
8
|
getContext(key: string): any;
|
|
9
9
|
getContexts(): any;
|