@douyinfe/semi-foundation 2.36.0-alpha.0 → 2.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/calendar/calendar.scss +1 -1
- package/calendar/foundation.ts +2 -1
- package/datePicker/_utils/getYears.ts +8 -4
- package/datePicker/foundation.ts +1 -1
- package/datePicker/monthsGridFoundation.ts +2 -1
- package/datePicker/yearAndMonthFoundation.ts +3 -1
- package/lib/cjs/anchor/constants.js +0 -2
- package/lib/cjs/anchor/foundation.js +10 -73
- package/lib/cjs/anchor/linkFoundation.js +4 -16
- package/lib/cjs/autoComplete/constants.js +0 -3
- package/lib/cjs/autoComplete/foundation.d.ts +1 -1
- package/lib/cjs/autoComplete/foundation.js +25 -139
- package/lib/cjs/autoComplete/optionFoundation.js +4 -14
- package/lib/cjs/avatar/constants.js +0 -2
- package/lib/cjs/avatar/foundation.js +0 -17
- package/lib/cjs/backtop/constants.js +0 -2
- package/lib/cjs/backtop/foundation.d.ts +2 -2
- package/lib/cjs/backtop/foundation.js +0 -21
- package/lib/cjs/badge/constants.js +0 -2
- package/lib/cjs/banner/constants.js +0 -2
- package/lib/cjs/banner/foundation.js +0 -7
- package/lib/cjs/base/constants.js +2 -4
- package/lib/cjs/base/foundation.d.ts +1 -1
- package/lib/cjs/base/foundation.js +12 -46
- package/lib/cjs/base/index.js +0 -3
- package/lib/cjs/breadcrumb/constants.js +0 -2
- package/lib/cjs/breadcrumb/foundation.js +1 -12
- package/lib/cjs/breadcrumb/itemFoundation.js +0 -7
- package/lib/cjs/button/constants.js +0 -2
- package/lib/cjs/calendar/calendar.css +2 -2
- package/lib/cjs/calendar/calendar.scss +1 -1
- package/lib/cjs/calendar/constants.js +0 -2
- package/lib/cjs/calendar/eventUtil.d.ts +1 -1
- package/lib/cjs/calendar/eventUtil.js +2 -74
- package/lib/cjs/calendar/foundation.d.ts +2 -2
- package/lib/cjs/calendar/foundation.js +28 -123
- package/lib/cjs/card/constants.js +0 -2
- package/lib/cjs/carousel/constants.js +0 -2
- package/lib/cjs/carousel/foundation.js +2 -52
- package/lib/cjs/cascader/constants.js +0 -3
- package/lib/cjs/cascader/foundation.d.ts +4 -4
- package/lib/cjs/cascader/foundation.js +28 -242
- package/lib/cjs/cascader/util.js +6 -24
- package/lib/cjs/checkbox/checkboxFoundation.js +2 -38
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +2 -23
- package/lib/cjs/checkbox/constants.js +0 -2
- package/lib/cjs/collapse/constants.js +0 -2
- package/lib/cjs/collapse/foundation.d.ts +1 -1
- package/lib/cjs/collapse/foundation.js +2 -13
- package/lib/cjs/collapsible/constants.js +0 -2
- package/lib/cjs/collapsible/foundation.js +0 -9
- package/lib/cjs/datePicker/_utils/formatter.js +4 -10
- package/lib/cjs/datePicker/_utils/getDayOfWeek.d.ts +1 -1
- package/lib/cjs/datePicker/_utils/getDayOfWeek.js +0 -4
- package/lib/cjs/datePicker/_utils/getDefaultFormatToken.js +0 -5
- package/lib/cjs/datePicker/_utils/getDefaultPickerDate.d.ts +1 -1
- package/lib/cjs/datePicker/_utils/getDefaultPickerDate.js +0 -15
- package/lib/cjs/datePicker/_utils/getFullDateOffset.js +0 -7
- package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +0 -5
- package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +0 -6
- package/lib/cjs/datePicker/_utils/getMonthTable.d.ts +1 -1
- package/lib/cjs/datePicker/_utils/getMonthTable.js +3 -14
- package/lib/cjs/datePicker/_utils/getMonthsInYear.js +0 -2
- package/lib/cjs/datePicker/_utils/getYears.d.ts +1 -1
- package/lib/cjs/datePicker/_utils/getYears.js +9 -7
- package/lib/cjs/datePicker/_utils/index.js +0 -13
- package/lib/cjs/datePicker/_utils/isAfter.js +0 -4
- package/lib/cjs/datePicker/_utils/isBefore.js +0 -4
- package/lib/cjs/datePicker/_utils/isBetween.js +0 -4
- package/lib/cjs/datePicker/_utils/isDate.js +0 -1
- package/lib/cjs/datePicker/_utils/isSameDay.js +0 -4
- package/lib/cjs/datePicker/_utils/isTimestamp.js +0 -4
- package/lib/cjs/datePicker/_utils/isUnixTimestamp.js +0 -4
- package/lib/cjs/datePicker/_utils/isValidDate.js +0 -1
- package/lib/cjs/datePicker/_utils/isValidTimeZone.js +0 -1
- package/lib/cjs/datePicker/_utils/isWithinInterval.js +0 -4
- package/lib/cjs/datePicker/_utils/parser.js +0 -10
- package/lib/cjs/datePicker/constants.js +0 -3
- package/lib/cjs/datePicker/foundation.d.ts +25 -25
- package/lib/cjs/datePicker/foundation.js +22 -333
- package/lib/cjs/datePicker/inputFoundation.d.ts +3 -3
- package/lib/cjs/datePicker/inputFoundation.js +5 -86
- package/lib/cjs/datePicker/monthFoundation.d.ts +1 -1
- package/lib/cjs/datePicker/monthFoundation.js +3 -28
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +5 -4
- package/lib/cjs/datePicker/monthsGridFoundation.js +43 -238
- package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +3 -1
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +12 -38
- package/lib/cjs/descriptions/constants.js +0 -2
- package/lib/cjs/divider/constants.js +0 -2
- package/lib/cjs/dropdown/constants.js +0 -3
- package/lib/cjs/dropdown/foundation.js +4 -23
- package/lib/cjs/dropdown/menuFoundation.js +8 -27
- package/lib/cjs/empty/constants.js +0 -2
- package/lib/cjs/form/constants.js +0 -2
- package/lib/cjs/form/foundation.js +75 -206
- package/lib/cjs/form/interface.d.ts +5 -5
- package/lib/cjs/form/utils.js +47 -77
- package/lib/cjs/grid/constants.js +0 -2
- package/lib/cjs/highlight/constants.js +0 -2
- package/lib/cjs/icons/constants.js +0 -2
- package/lib/cjs/image/constants.js +0 -2
- package/lib/cjs/image/imageFoundation.js +4 -18
- package/lib/cjs/image/previewFooterFoundation.js +0 -13
- package/lib/cjs/image/previewFoundation.js +0 -11
- package/lib/cjs/image/previewImageFoundation.js +6 -80
- package/lib/cjs/image/previewInnerFoundation.js +12 -77
- package/lib/cjs/image/utils.js +0 -14
- package/lib/cjs/input/constants.js +0 -2
- package/lib/cjs/input/foundation.js +17 -101
- package/lib/cjs/input/textareaFoundation.js +20 -85
- package/lib/cjs/input/util/calculateNodeHeight.js +6 -18
- package/lib/cjs/input/util/getSizingData.js +7 -11
- package/lib/cjs/inputNumber/constants.js +0 -2
- package/lib/cjs/inputNumber/foundation.js +29 -192
- package/lib/cjs/layout/constants.js +0 -2
- package/lib/cjs/list/constants.js +0 -2
- package/lib/cjs/modal/constants.js +0 -2
- package/lib/cjs/modal/modalContentFoundation.js +0 -20
- package/lib/cjs/modal/modalFoundation.d.ts +2 -2
- package/lib/cjs/modal/modalFoundation.js +2 -22
- package/lib/cjs/navigation/NavItem.js +0 -10
- package/lib/cjs/navigation/constants.js +0 -3
- package/lib/cjs/navigation/foundation.js +3 -67
- package/lib/cjs/navigation/itemFoundation.d.ts +0 -2
- package/lib/cjs/navigation/itemFoundation.js +3 -21
- package/lib/cjs/navigation/navigation.css +7 -77
- package/lib/cjs/navigation/navigation.scss +7 -119
- package/lib/cjs/navigation/subNavFoundation.d.ts +0 -2
- package/lib/cjs/navigation/subNavFoundation.js +4 -40
- package/lib/cjs/notification/constants.js +0 -3
- package/lib/cjs/notification/notificationFoundation.d.ts +3 -3
- package/lib/cjs/notification/notificationFoundation.js +0 -16
- package/lib/cjs/notification/notificationListFoundation.js +7 -17
- package/lib/cjs/overflowList/constants.js +0 -2
- package/lib/cjs/overflowList/foundation.js +11 -41
- package/lib/cjs/pagination/constants.js +0 -2
- package/lib/cjs/pagination/foundation.d.ts +3 -3
- package/lib/cjs/pagination/foundation.js +21 -90
- package/lib/cjs/popconfirm/constants.js +0 -2
- package/lib/cjs/popconfirm/popconfirmFoundation.js +1 -21
- package/lib/cjs/popover/constants.js +0 -3
- package/lib/cjs/progress/constants.js +0 -2
- package/lib/cjs/progress/generates.d.ts +2 -2
- package/lib/cjs/progress/generates.js +19 -60
- package/lib/cjs/radio/constants.js +0 -2
- package/lib/cjs/radio/radioFoundation.js +0 -14
- package/lib/cjs/radio/radioGroupFoundation.js +4 -23
- package/lib/cjs/radio/radioInnerFoundation.js +2 -19
- package/lib/cjs/rating/constants.js +0 -2
- package/lib/cjs/rating/foundation.js +11 -61
- package/lib/cjs/scrollList/constants.js +0 -2
- package/lib/cjs/scrollList/foundation.js +0 -4
- package/lib/cjs/scrollList/itemFoundation.js +8 -61
- package/lib/cjs/scrollList/scrollTo.js +2 -5
- package/lib/cjs/select/constants.js +0 -3
- package/lib/cjs/select/foundation.d.ts +2 -2
- package/lib/cjs/select/foundation.js +122 -425
- package/lib/cjs/select/optionFoundation.js +4 -14
- package/lib/cjs/sideSheet/constants.js +0 -2
- package/lib/cjs/sideSheet/sideSheetFoundation.js +0 -18
- package/lib/cjs/skeleton/constants.js +0 -2
- package/lib/cjs/slider/constants.js +0 -2
- package/lib/cjs/slider/foundation.d.ts +1 -1
- package/lib/cjs/slider/foundation.js +25 -204
- package/lib/cjs/space/constants.js +0 -2
- package/lib/cjs/spin/constants.js +0 -2
- package/lib/cjs/spin/foundation.js +3 -13
- package/lib/cjs/steps/bacisSteps.scss +238 -287
- package/lib/cjs/steps/constants.js +0 -2
- package/lib/cjs/steps/fillSteps.scss +142 -153
- package/lib/cjs/steps/navSteps.scss +40 -61
- package/lib/cjs/steps/steps.css +17 -381
- package/lib/cjs/switch/constants.js +0 -2
- package/lib/cjs/switch/foundation.js +2 -18
- package/lib/cjs/table/bodyFoundation.js +2 -34
- package/lib/cjs/table/cellFoundation.js +0 -5
- package/lib/cjs/table/constants.js +7 -8
- package/lib/cjs/table/foundation.d.ts +17 -14
- package/lib/cjs/table/foundation.js +72 -302
- package/lib/cjs/table/table.css +6 -0
- package/lib/cjs/table/table.scss +12 -0
- package/lib/cjs/table/tableRowFoundation.js +0 -11
- package/lib/cjs/table/tableSelectionCellFoundation.js +0 -6
- package/lib/cjs/table/utils.d.ts +2 -2
- package/lib/cjs/table/utils.js +5 -118
- package/lib/cjs/tabs/constants.js +0 -2
- package/lib/cjs/tabs/foundation.js +2 -40
- package/lib/cjs/tabs/tabs.css +14 -14
- package/lib/cjs/tabs/tabs.scss +16 -14
- package/lib/cjs/tag/constants.js +1 -2
- package/lib/cjs/tagInput/constants.js +0 -2
- package/lib/cjs/tagInput/foundation.d.ts +4 -4
- package/lib/cjs/tagInput/foundation.js +4 -94
- package/lib/cjs/tagInput/utils/getSplitedArray.js +0 -11
- package/lib/cjs/timePicker/ComboxFoundation.js +4 -39
- package/lib/cjs/timePicker/constants.js +0 -3
- package/lib/cjs/timePicker/foundation.d.ts +2 -2
- package/lib/cjs/timePicker/foundation.js +6 -102
- package/lib/cjs/timePicker/inputFoundation.js +6 -25
- package/lib/cjs/timePicker/utils/index.js +6 -45
- package/lib/cjs/timePicker/utils/localeDate.js +0 -10
- package/lib/cjs/timeline/constants.js +0 -2
- package/lib/cjs/timeline/timeline.css +0 -36
- package/lib/cjs/timeline/timeline.scss +46 -96
- package/lib/cjs/toast/constants.js +0 -3
- package/lib/cjs/toast/toastFoundation.d.ts +3 -3
- package/lib/cjs/toast/toastFoundation.js +0 -14
- package/lib/cjs/toast/toastListFoundation.js +4 -22
- package/lib/cjs/tooltip/constants.js +0 -2
- package/lib/cjs/tooltip/foundation.d.ts +1 -1
- package/lib/cjs/tooltip/foundation.js +63 -291
- package/lib/cjs/transfer/constants.js +0 -2
- package/lib/cjs/transfer/foundation.d.ts +1 -1
- package/lib/cjs/transfer/foundation.js +4 -68
- package/lib/cjs/transfer/transferUtils.js +5 -27
- package/lib/cjs/tree/constants.js +0 -2
- package/lib/cjs/tree/foundation.d.ts +3 -3
- package/lib/cjs/tree/foundation.js +34 -150
- package/lib/cjs/tree/treeUtil.js +54 -173
- package/lib/cjs/treeSelect/constants.js +0 -2
- package/lib/cjs/treeSelect/foundation.d.ts +7 -7
- package/lib/cjs/treeSelect/foundation.js +18 -192
- package/lib/cjs/typography/constants.d.ts +1 -0
- package/lib/cjs/typography/constants.js +1 -2
- package/lib/cjs/typography/formatNumeral.d.ts +3 -3
- package/lib/cjs/typography/formatNumeral.js +16 -32
- package/lib/cjs/typography/typography.css +120 -0
- package/lib/cjs/typography/typography.scss +131 -6
- package/lib/cjs/typography/variables.scss +48 -0
- package/lib/cjs/upload/constants.js +0 -2
- package/lib/cjs/upload/foundation.d.ts +5 -5
- package/lib/cjs/upload/foundation.js +36 -245
- package/lib/cjs/upload/utils.js +10 -29
- package/lib/cjs/utils/Event.js +2 -21
- package/lib/cjs/utils/FocusHandle.d.ts +1 -1
- package/lib/cjs/utils/FocusHandle.js +6 -35
- package/lib/cjs/utils/Logger.js +0 -21
- package/lib/cjs/utils/Store.js +0 -10
- package/lib/cjs/utils/a11y.js +18 -43
- package/lib/cjs/utils/array.d.ts +1 -1
- package/lib/cjs/utils/array.js +0 -7
- package/lib/cjs/utils/arrayMove.js +0 -1
- package/lib/cjs/utils/classnames.js +0 -12
- package/lib/cjs/utils/date-fns-extra.js +0 -35
- package/lib/cjs/utils/dom.d.ts +1 -1
- package/lib/cjs/utils/dom.js +0 -13
- package/lib/cjs/utils/function.js +0 -1
- package/lib/cjs/utils/getDataAttr.js +0 -2
- package/lib/cjs/utils/getHighlight.js +5 -26
- package/lib/cjs/utils/getMotionObjFromProps.js +0 -12
- package/lib/cjs/utils/index.js +0 -4
- package/lib/cjs/utils/isBothNaN.js +0 -2
- package/lib/cjs/utils/isElement.js +0 -1
- package/lib/cjs/utils/isEnterPress.js +0 -5
- package/lib/cjs/utils/isEscPress.js +0 -5
- package/lib/cjs/utils/isNullOrUndefined.js +0 -1
- package/lib/cjs/utils/isNumber.js +0 -1
- package/lib/cjs/utils/isObject.js +0 -1
- package/lib/cjs/utils/isPromise.js +0 -3
- package/lib/cjs/utils/isString.js +0 -1
- package/lib/cjs/utils/keyCode.js +0 -105
- package/lib/cjs/utils/log.js +0 -5
- package/lib/cjs/utils/number.js +0 -2
- package/lib/cjs/utils/object.d.ts +4 -4
- package/lib/cjs/utils/object.js +12 -34
- package/lib/cjs/utils/set.js +0 -8
- package/lib/cjs/utils/shallowEqualObjects.js +0 -7
- package/lib/cjs/utils/touchPolyfill.js +0 -7
- package/lib/cjs/utils/type.d.ts +3 -3
- package/lib/cjs/utils/uuid.js +2 -9
- package/lib/cjs/utils/warning.js +0 -1
- package/lib/es/anchor/foundation.js +10 -66
- package/lib/es/anchor/linkFoundation.js +4 -12
- package/lib/es/autoComplete/foundation.d.ts +1 -1
- package/lib/es/autoComplete/foundation.js +24 -132
- package/lib/es/autoComplete/optionFoundation.js +4 -10
- package/lib/es/avatar/foundation.js +0 -12
- package/lib/es/backtop/foundation.d.ts +2 -2
- package/lib/es/backtop/foundation.js +0 -16
- package/lib/es/banner/foundation.js +0 -3
- package/lib/es/base/constants.js +2 -2
- package/lib/es/base/foundation.d.ts +1 -1
- package/lib/es/base/foundation.js +11 -44
- package/lib/es/breadcrumb/foundation.js +0 -7
- package/lib/es/breadcrumb/itemFoundation.js +0 -3
- package/lib/es/calendar/calendar.css +2 -2
- package/lib/es/calendar/calendar.scss +1 -1
- package/lib/es/calendar/eventUtil.d.ts +1 -1
- package/lib/es/calendar/eventUtil.js +2 -36
- package/lib/es/calendar/foundation.d.ts +2 -2
- package/lib/es/calendar/foundation.js +28 -117
- package/lib/es/carousel/foundation.js +2 -47
- package/lib/es/cascader/constants.js +0 -1
- package/lib/es/cascader/foundation.d.ts +4 -4
- package/lib/es/cascader/foundation.js +30 -226
- package/lib/es/cascader/util.js +6 -15
- package/lib/es/checkbox/checkboxFoundation.js +2 -34
- package/lib/es/checkbox/checkboxGroupFoundation.js +2 -20
- package/lib/es/collapse/foundation.d.ts +1 -1
- package/lib/es/collapse/foundation.js +2 -9
- package/lib/es/collapsible/foundation.js +0 -7
- package/lib/es/datePicker/_utils/formatter.js +4 -8
- package/lib/es/datePicker/_utils/getDayOfWeek.d.ts +1 -1
- package/lib/es/datePicker/_utils/getDayOfWeek.js +0 -3
- package/lib/es/datePicker/_utils/getDefaultFormatToken.js +0 -2
- package/lib/es/datePicker/_utils/getDefaultPickerDate.d.ts +1 -1
- package/lib/es/datePicker/_utils/getDefaultPickerDate.js +0 -10
- package/lib/es/datePicker/_utils/getFullDateOffset.js +0 -3
- package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +0 -4
- package/lib/es/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +0 -5
- package/lib/es/datePicker/_utils/getMonthTable.d.ts +1 -1
- package/lib/es/datePicker/_utils/getMonthTable.js +4 -14
- package/lib/es/datePicker/_utils/getMonthsInYear.js +0 -1
- package/lib/es/datePicker/_utils/getYears.d.ts +1 -1
- package/lib/es/datePicker/_utils/getYears.js +9 -6
- package/lib/es/datePicker/_utils/isBetween.js +0 -1
- package/lib/es/datePicker/_utils/parser.js +0 -8
- package/lib/es/datePicker/foundation.d.ts +25 -25
- package/lib/es/datePicker/foundation.js +22 -318
- package/lib/es/datePicker/inputFoundation.d.ts +3 -3
- package/lib/es/datePicker/inputFoundation.js +5 -74
- package/lib/es/datePicker/monthFoundation.d.ts +1 -1
- package/lib/es/datePicker/monthFoundation.js +4 -22
- package/lib/es/datePicker/monthsGridFoundation.d.ts +5 -4
- package/lib/es/datePicker/monthsGridFoundation.js +42 -222
- package/lib/es/datePicker/yearAndMonthFoundation.d.ts +3 -1
- package/lib/es/datePicker/yearAndMonthFoundation.js +12 -36
- package/lib/es/dropdown/foundation.js +4 -18
- package/lib/es/dropdown/menuFoundation.js +8 -22
- package/lib/es/form/foundation.js +74 -195
- package/lib/es/form/interface.d.ts +5 -5
- package/lib/es/form/utils.js +47 -70
- package/lib/es/image/imageFoundation.js +4 -13
- package/lib/es/image/previewFooterFoundation.js +0 -9
- package/lib/es/image/previewFoundation.js +0 -7
- package/lib/es/image/previewImageFoundation.js +6 -72
- package/lib/es/image/previewInnerFoundation.js +12 -70
- package/lib/es/image/utils.js +0 -6
- package/lib/es/input/foundation.js +17 -93
- package/lib/es/input/textareaFoundation.js +20 -75
- package/lib/es/input/util/calculateNodeHeight.js +6 -18
- package/lib/es/input/util/getSizingData.js +7 -11
- package/lib/es/inputNumber/foundation.js +28 -183
- package/lib/es/modal/modalContentFoundation.js +0 -15
- package/lib/es/modal/modalFoundation.d.ts +2 -2
- package/lib/es/modal/modalFoundation.js +2 -17
- package/lib/es/navigation/NavItem.js +0 -6
- package/lib/es/navigation/constants.js +1 -1
- package/lib/es/navigation/foundation.js +2 -60
- package/lib/es/navigation/itemFoundation.d.ts +0 -2
- package/lib/es/navigation/itemFoundation.js +3 -18
- package/lib/es/navigation/navigation.css +7 -77
- package/lib/es/navigation/navigation.scss +7 -119
- package/lib/es/navigation/subNavFoundation.d.ts +0 -2
- package/lib/es/navigation/subNavFoundation.js +4 -36
- package/lib/es/notification/constants.js +1 -1
- package/lib/es/notification/notificationFoundation.d.ts +3 -3
- package/lib/es/notification/notificationFoundation.js +0 -11
- package/lib/es/notification/notificationListFoundation.js +6 -13
- package/lib/es/overflowList/foundation.js +11 -37
- package/lib/es/pagination/foundation.d.ts +3 -3
- package/lib/es/pagination/foundation.js +20 -87
- package/lib/es/popconfirm/popconfirmFoundation.js +1 -16
- package/lib/es/progress/generates.d.ts +2 -2
- package/lib/es/progress/generates.js +19 -59
- package/lib/es/radio/radioFoundation.js +0 -9
- package/lib/es/radio/radioGroupFoundation.js +4 -19
- package/lib/es/radio/radioInnerFoundation.js +2 -15
- package/lib/es/rating/foundation.js +10 -54
- package/lib/es/scrollList/itemFoundation.js +8 -60
- package/lib/es/scrollList/scrollTo.js +2 -4
- package/lib/es/select/foundation.d.ts +2 -2
- package/lib/es/select/foundation.js +122 -411
- package/lib/es/select/optionFoundation.js +4 -10
- package/lib/es/sideSheet/sideSheetFoundation.js +0 -12
- package/lib/es/slider/foundation.d.ts +1 -1
- package/lib/es/slider/foundation.js +24 -197
- package/lib/es/spin/foundation.js +3 -11
- package/lib/es/steps/bacisSteps.scss +238 -287
- package/lib/es/steps/fillSteps.scss +142 -153
- package/lib/es/steps/navSteps.scss +40 -61
- package/lib/es/steps/steps.css +17 -381
- package/lib/es/switch/foundation.js +2 -13
- package/lib/es/table/bodyFoundation.js +2 -25
- package/lib/es/table/cellFoundation.js +0 -1
- package/lib/es/table/constants.js +6 -6
- package/lib/es/table/foundation.d.ts +17 -14
- package/lib/es/table/foundation.js +72 -309
- package/lib/es/table/table.css +6 -0
- package/lib/es/table/table.scss +12 -0
- package/lib/es/table/tableRowFoundation.js +2 -9
- package/lib/es/table/tableSelectionCellFoundation.js +0 -2
- package/lib/es/table/utils.d.ts +2 -2
- package/lib/es/table/utils.js +5 -81
- package/lib/es/tabs/foundation.js +2 -35
- package/lib/es/tabs/tabs.css +14 -14
- package/lib/es/tabs/tabs.scss +16 -14
- package/lib/es/tagInput/foundation.d.ts +4 -4
- package/lib/es/tagInput/foundation.js +4 -84
- package/lib/es/tagInput/utils/getSplitedArray.js +0 -7
- package/lib/es/timePicker/ComboxFoundation.js +4 -30
- package/lib/es/timePicker/foundation.d.ts +2 -2
- package/lib/es/timePicker/foundation.js +7 -95
- package/lib/es/timePicker/inputFoundation.js +6 -22
- package/lib/es/timePicker/utils/index.js +6 -25
- package/lib/es/timePicker/utils/localeDate.js +0 -8
- package/lib/es/timeline/timeline.css +0 -36
- package/lib/es/timeline/timeline.scss +46 -96
- package/lib/es/toast/constants.js +1 -1
- package/lib/es/toast/toastFoundation.d.ts +3 -3
- package/lib/es/toast/toastFoundation.js +0 -9
- package/lib/es/toast/toastListFoundation.js +4 -18
- package/lib/es/tooltip/foundation.d.ts +1 -1
- package/lib/es/tooltip/foundation.js +63 -288
- package/lib/es/transfer/foundation.d.ts +1 -1
- package/lib/es/transfer/foundation.js +6 -62
- package/lib/es/transfer/transferUtils.js +5 -21
- package/lib/es/tree/foundation.d.ts +3 -3
- package/lib/es/tree/foundation.js +34 -143
- package/lib/es/tree/treeUtil.js +54 -139
- package/lib/es/treeSelect/foundation.d.ts +7 -7
- package/lib/es/treeSelect/foundation.js +20 -179
- package/lib/es/typography/constants.d.ts +1 -0
- package/lib/es/typography/constants.js +1 -0
- package/lib/es/typography/formatNumeral.d.ts +3 -3
- package/lib/es/typography/formatNumeral.js +16 -29
- package/lib/es/typography/typography.css +120 -0
- package/lib/es/typography/typography.scss +131 -6
- package/lib/es/typography/variables.scss +48 -0
- package/lib/es/upload/foundation.d.ts +5 -5
- package/lib/es/upload/foundation.js +36 -238
- package/lib/es/upload/utils.js +10 -24
- package/lib/es/utils/Event.js +2 -17
- package/lib/es/utils/FocusHandle.d.ts +1 -1
- package/lib/es/utils/FocusHandle.js +6 -32
- package/lib/es/utils/Logger.js +0 -20
- package/lib/es/utils/Store.js +0 -9
- package/lib/es/utils/a11y.js +18 -31
- package/lib/es/utils/array.d.ts +1 -1
- package/lib/es/utils/array.js +0 -5
- package/lib/es/utils/classnames.js +0 -10
- package/lib/es/utils/date-fns-extra.js +0 -27
- package/lib/es/utils/dom.d.ts +1 -1
- package/lib/es/utils/dom.js +0 -9
- package/lib/es/utils/getDataAttr.js +0 -1
- package/lib/es/utils/getHighlight.js +5 -26
- package/lib/es/utils/getMotionObjFromProps.js +0 -8
- package/lib/es/utils/isBothNaN.js +0 -1
- package/lib/es/utils/isEnterPress.js +0 -2
- package/lib/es/utils/isEscPress.js +0 -2
- package/lib/es/utils/keyCode.js +0 -104
- package/lib/es/utils/log.js +0 -3
- package/lib/es/utils/object.d.ts +4 -4
- package/lib/es/utils/object.js +12 -28
- package/lib/es/utils/set.js +0 -5
- package/lib/es/utils/shallowEqualObjects.js +0 -6
- package/lib/es/utils/touchPolyfill.js +0 -5
- package/lib/es/utils/type.d.ts +3 -3
- package/lib/es/utils/uuid.js +2 -8
- package/navigation/itemFoundation.ts +1 -3
- package/navigation/navigation.scss +7 -119
- package/navigation/subNavFoundation.ts +1 -3
- package/overflowList/foundation.ts +4 -4
- package/package.json +2 -2
- package/steps/bacisSteps.scss +238 -287
- package/steps/fillSteps.scss +142 -153
- package/steps/navSteps.scss +40 -61
- package/table/foundation.ts +8 -10
- package/table/table.scss +12 -0
- package/tabs/tabs.scss +16 -14
- package/timePicker/foundation.ts +4 -6
- package/timeline/timeline.scss +46 -96
- package/typography/constants.ts +1 -0
- package/typography/typography.scss +131 -6
- package/typography/variables.scss +48 -0
- package/upload/foundation.ts +8 -8
|
@@ -16,56 +16,43 @@ const DefaultDOMRect = {
|
|
|
16
16
|
export default class PreviewImageFoundation extends BaseFoundation {
|
|
17
17
|
constructor(adapter) {
|
|
18
18
|
super(Object.assign({}, adapter));
|
|
19
|
-
|
|
20
19
|
this._isImageVertical = () => this.getProp("rotation") % 180 !== 0;
|
|
21
|
-
|
|
22
20
|
this._getImageBounds = () => {
|
|
23
21
|
const imageDOM = this._adapter.getImage();
|
|
24
|
-
|
|
25
22
|
if (imageDOM) {
|
|
26
23
|
return imageDOM.getBoundingClientRect();
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
return DefaultDOMRect;
|
|
30
26
|
};
|
|
31
|
-
|
|
32
27
|
this._getContainerBounds = () => {
|
|
33
28
|
const containerDOM = this._adapter.getContainer();
|
|
34
|
-
|
|
35
29
|
if (containerDOM) {
|
|
36
30
|
return containerDOM.getBoundingClientRect();
|
|
37
31
|
}
|
|
38
|
-
|
|
39
32
|
return DefaultDOMRect;
|
|
40
33
|
};
|
|
41
|
-
|
|
42
34
|
this._getOffset = e => {
|
|
43
35
|
const {
|
|
44
36
|
left,
|
|
45
37
|
top
|
|
46
38
|
} = this._getImageBounds();
|
|
47
|
-
|
|
48
39
|
return {
|
|
49
40
|
x: e.clientX - left,
|
|
50
41
|
y: e.clientY - top
|
|
51
42
|
};
|
|
52
43
|
};
|
|
53
|
-
|
|
54
44
|
this.setLoading = loading => {
|
|
55
45
|
this._adapter.setLoading(loading);
|
|
56
46
|
};
|
|
57
|
-
|
|
58
47
|
this.handleWindowResize = () => {
|
|
59
48
|
const {
|
|
60
49
|
ratio,
|
|
61
50
|
setRatio
|
|
62
51
|
} = this.getProps();
|
|
63
|
-
|
|
64
52
|
const {
|
|
65
53
|
originImageWidth,
|
|
66
54
|
originImageHeight
|
|
67
55
|
} = this._adapter.getOriginImageSize();
|
|
68
|
-
|
|
69
56
|
if (originImageWidth && originImageHeight) {
|
|
70
57
|
if (ratio !== "adaptation") {
|
|
71
58
|
setRatio("adaptation");
|
|
@@ -74,32 +61,27 @@ export default class PreviewImageFoundation extends BaseFoundation {
|
|
|
74
61
|
}
|
|
75
62
|
}
|
|
76
63
|
};
|
|
77
|
-
|
|
78
64
|
this.handleLoad = e => {
|
|
79
65
|
if (e.target) {
|
|
80
66
|
const {
|
|
81
67
|
width: w,
|
|
82
68
|
height: h
|
|
83
69
|
} = e.target;
|
|
84
|
-
|
|
85
70
|
this._adapter.setOriginImageSize({
|
|
86
71
|
originImageWidth: w,
|
|
87
72
|
originImageHeight: h
|
|
88
73
|
});
|
|
89
|
-
|
|
90
74
|
this.setState({
|
|
91
75
|
loading: false
|
|
92
76
|
});
|
|
93
77
|
this.handleResizeImage();
|
|
94
78
|
}
|
|
95
|
-
|
|
96
79
|
const {
|
|
97
80
|
src,
|
|
98
81
|
onLoad
|
|
99
82
|
} = this.getProps();
|
|
100
83
|
onLoad && onLoad(src);
|
|
101
84
|
};
|
|
102
|
-
|
|
103
85
|
this.handleError = e => {
|
|
104
86
|
const {
|
|
105
87
|
onError,
|
|
@@ -110,43 +92,33 @@ export default class PreviewImageFoundation extends BaseFoundation {
|
|
|
110
92
|
});
|
|
111
93
|
onError && onError(src);
|
|
112
94
|
};
|
|
113
|
-
|
|
114
95
|
this.handleResizeImage = () => {
|
|
115
96
|
const horizontal = !this._isImageVertical();
|
|
116
|
-
|
|
117
97
|
const {
|
|
118
98
|
originImageWidth,
|
|
119
99
|
originImageHeight
|
|
120
100
|
} = this._adapter.getOriginImageSize();
|
|
121
|
-
|
|
122
101
|
const imgWidth = horizontal ? originImageWidth : originImageHeight;
|
|
123
102
|
const imgHeight = horizontal ? originImageHeight : originImageWidth;
|
|
124
103
|
const {
|
|
125
104
|
onZoom
|
|
126
105
|
} = this.getProps();
|
|
127
|
-
|
|
128
106
|
const containerDOM = this._adapter.getContainer();
|
|
129
|
-
|
|
130
107
|
if (containerDOM) {
|
|
131
108
|
const {
|
|
132
109
|
width: containerWidth,
|
|
133
110
|
height: containerHeight
|
|
134
111
|
} = this._getContainerBounds();
|
|
135
|
-
|
|
136
112
|
const reservedWidth = containerWidth - 80;
|
|
137
113
|
const reservedHeight = containerHeight - 80;
|
|
138
|
-
|
|
139
114
|
const _zoom = Number(Math.min(reservedWidth / imgWidth, reservedHeight / imgHeight).toFixed(2));
|
|
140
|
-
|
|
141
115
|
onZoom(_zoom);
|
|
142
116
|
}
|
|
143
117
|
};
|
|
144
|
-
|
|
145
118
|
this.handleRightClickImage = e => {
|
|
146
119
|
const {
|
|
147
120
|
disableDownload
|
|
148
121
|
} = this.getProps();
|
|
149
|
-
|
|
150
122
|
if (disableDownload) {
|
|
151
123
|
e.preventDefault();
|
|
152
124
|
e.stopPropagation();
|
|
@@ -154,15 +126,13 @@ export default class PreviewImageFoundation extends BaseFoundation {
|
|
|
154
126
|
} else {
|
|
155
127
|
return true;
|
|
156
128
|
}
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
|
|
129
|
+
};
|
|
130
|
+
// e: WheelEvent<HTMLImageElement>
|
|
160
131
|
this.handleWheel = e => {
|
|
161
132
|
this.onWheel(e);
|
|
162
133
|
handlePrevent(e);
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
|
|
134
|
+
};
|
|
135
|
+
// e: WheelEvent<HTMLImageElement>
|
|
166
136
|
this.onWheel = _throttle(e => {
|
|
167
137
|
const {
|
|
168
138
|
onZoom,
|
|
@@ -173,9 +143,7 @@ export default class PreviewImageFoundation extends BaseFoundation {
|
|
|
173
143
|
const {
|
|
174
144
|
currZoom
|
|
175
145
|
} = this.getStates();
|
|
176
|
-
|
|
177
146
|
let _zoom;
|
|
178
|
-
|
|
179
147
|
if (e.deltaY < 0) {
|
|
180
148
|
/* zoom in */
|
|
181
149
|
if (currZoom + zoomStep <= maxZoom) {
|
|
@@ -187,12 +155,10 @@ export default class PreviewImageFoundation extends BaseFoundation {
|
|
|
187
155
|
_zoom = Number((currZoom - zoomStep).toFixed(2));
|
|
188
156
|
}
|
|
189
157
|
}
|
|
190
|
-
|
|
191
158
|
if (!_isUndefined(_zoom)) {
|
|
192
159
|
onZoom(_zoom);
|
|
193
160
|
}
|
|
194
161
|
}, 50);
|
|
195
|
-
|
|
196
162
|
this.calcCanDragDirection = () => {
|
|
197
163
|
const {
|
|
198
164
|
width,
|
|
@@ -201,54 +167,43 @@ export default class PreviewImageFoundation extends BaseFoundation {
|
|
|
201
167
|
const {
|
|
202
168
|
rotation
|
|
203
169
|
} = this.getProps();
|
|
204
|
-
|
|
205
170
|
const {
|
|
206
171
|
width: containerWidth,
|
|
207
172
|
height: containerHeight
|
|
208
173
|
} = this._getContainerBounds();
|
|
209
|
-
|
|
210
174
|
let canDragHorizontal = width > containerWidth;
|
|
211
175
|
let canDragVertical = height > containerHeight;
|
|
212
|
-
|
|
213
176
|
if (this._isImageVertical()) {
|
|
214
177
|
canDragHorizontal = height > containerWidth;
|
|
215
178
|
canDragVertical = width > containerHeight;
|
|
216
179
|
}
|
|
217
|
-
|
|
218
180
|
return {
|
|
219
181
|
canDragVertical,
|
|
220
182
|
canDragHorizontal
|
|
221
183
|
};
|
|
222
184
|
};
|
|
223
|
-
|
|
224
185
|
this.handleZoomChange = (newZoom, e) => {
|
|
225
186
|
const imageDOM = this._adapter.getImage();
|
|
226
|
-
|
|
227
187
|
const {
|
|
228
188
|
originImageWidth,
|
|
229
189
|
originImageHeight
|
|
230
190
|
} = this._adapter.getOriginImageSize();
|
|
231
|
-
|
|
232
191
|
const {
|
|
233
192
|
canDragVertical,
|
|
234
193
|
canDragHorizontal
|
|
235
194
|
} = this.calcCanDragDirection();
|
|
236
195
|
const canDrag = canDragVertical || canDragHorizontal;
|
|
237
|
-
|
|
238
196
|
const {
|
|
239
197
|
width: containerWidth,
|
|
240
198
|
height: containerHeight
|
|
241
199
|
} = this._getContainerBounds();
|
|
242
|
-
|
|
243
200
|
const newWidth = Math.floor(originImageWidth * newZoom);
|
|
244
|
-
const newHeight = Math.floor(originImageHeight * newZoom);
|
|
245
|
-
|
|
201
|
+
const newHeight = Math.floor(originImageHeight * newZoom);
|
|
202
|
+
// debugger;
|
|
246
203
|
let _offset;
|
|
247
|
-
|
|
248
204
|
const horizontal = !this._isImageVertical();
|
|
249
205
|
let newTop = 0;
|
|
250
206
|
let newLeft = 0;
|
|
251
|
-
|
|
252
207
|
if (horizontal) {
|
|
253
208
|
_offset = {
|
|
254
209
|
x: 0.5 * (containerWidth - newWidth),
|
|
@@ -264,7 +219,6 @@ export default class PreviewImageFoundation extends BaseFoundation {
|
|
|
264
219
|
newLeft = _offset.x - (newWidth - newHeight) / 2;
|
|
265
220
|
newTop = _offset.y + (newWidth - newHeight) / 2;
|
|
266
221
|
}
|
|
267
|
-
|
|
268
222
|
this.setState({
|
|
269
223
|
width: newWidth,
|
|
270
224
|
height: newHeight,
|
|
@@ -273,79 +227,63 @@ export default class PreviewImageFoundation extends BaseFoundation {
|
|
|
273
227
|
top: newTop,
|
|
274
228
|
currZoom: newZoom
|
|
275
229
|
});
|
|
276
|
-
|
|
277
230
|
if (imageDOM) {
|
|
278
231
|
this._adapter.setImageCursor(canDrag);
|
|
279
232
|
}
|
|
280
233
|
};
|
|
281
|
-
|
|
282
234
|
this.calcExtremeBounds = () => {
|
|
283
235
|
const {
|
|
284
236
|
width,
|
|
285
237
|
height
|
|
286
238
|
} = this.getStates();
|
|
287
|
-
|
|
288
239
|
const {
|
|
289
240
|
width: containerWidth,
|
|
290
241
|
height: containerHeight
|
|
291
242
|
} = this._getContainerBounds();
|
|
292
|
-
|
|
293
243
|
let extremeLeft = containerWidth - width;
|
|
294
244
|
let extremeTop = containerHeight - height;
|
|
295
|
-
|
|
296
245
|
if (this._isImageVertical()) {
|
|
297
246
|
extremeLeft = containerWidth - height;
|
|
298
247
|
extremeTop = containerHeight - width;
|
|
299
248
|
}
|
|
300
|
-
|
|
301
249
|
return {
|
|
302
250
|
left: extremeLeft,
|
|
303
251
|
top: extremeTop
|
|
304
252
|
};
|
|
305
253
|
};
|
|
306
|
-
|
|
307
254
|
this.handleMoveImage = e => {
|
|
308
255
|
const {
|
|
309
256
|
offset,
|
|
310
257
|
width,
|
|
311
258
|
height
|
|
312
259
|
} = this.getStates();
|
|
313
|
-
|
|
314
260
|
const startMouseMove = this._adapter.getMouseMove();
|
|
315
|
-
|
|
316
261
|
const startMouseOffset = this._adapter.getMouseOffset();
|
|
317
|
-
|
|
318
262
|
const {
|
|
319
263
|
canDragVertical,
|
|
320
264
|
canDragHorizontal
|
|
321
265
|
} = this.calcCanDragDirection();
|
|
322
|
-
|
|
323
266
|
if (startMouseMove && (canDragVertical || canDragHorizontal)) {
|
|
324
267
|
const {
|
|
325
268
|
clientX,
|
|
326
269
|
clientY
|
|
327
270
|
} = e;
|
|
328
|
-
|
|
329
271
|
const {
|
|
330
272
|
left: containerLeft,
|
|
331
273
|
top: containerTop
|
|
332
274
|
} = this._getContainerBounds();
|
|
333
|
-
|
|
334
275
|
const {
|
|
335
276
|
left: extremeLeft,
|
|
336
277
|
top: extremeTop
|
|
337
278
|
} = this.calcExtremeBounds();
|
|
338
279
|
let newX = canDragHorizontal ? clientX - containerLeft - startMouseOffset.x : offset.x;
|
|
339
280
|
let newY = canDragVertical ? clientY - containerTop - startMouseOffset.y : offset.y;
|
|
340
|
-
|
|
341
281
|
if (canDragHorizontal) {
|
|
342
282
|
newX = newX > 0 ? 0 : newX < extremeLeft ? extremeLeft : newX;
|
|
343
283
|
}
|
|
344
|
-
|
|
345
284
|
if (canDragVertical) {
|
|
346
285
|
newY = newY > 0 ? 0 : newY < extremeTop ? extremeTop : newY;
|
|
347
286
|
}
|
|
348
|
-
|
|
349
287
|
const _offset = {
|
|
350
288
|
x: newX,
|
|
351
289
|
y: newY
|
|
@@ -357,16 +295,12 @@ export default class PreviewImageFoundation extends BaseFoundation {
|
|
|
357
295
|
});
|
|
358
296
|
}
|
|
359
297
|
};
|
|
360
|
-
|
|
361
298
|
this.handleImageMouseDown = e => {
|
|
362
299
|
this._adapter.setStartMouseOffset(this._getOffset(e));
|
|
363
|
-
|
|
364
300
|
this._adapter.setStartMouseMove(true);
|
|
365
301
|
};
|
|
366
|
-
|
|
367
302
|
this.handleImageMouseUp = () => {
|
|
368
303
|
this._adapter.setStartMouseMove(false);
|
|
369
304
|
};
|
|
370
305
|
}
|
|
371
|
-
|
|
372
306
|
}
|
|
@@ -6,46 +6,36 @@ const STOP_CLOSE_TARGET = ["icon", "footer", "header"];
|
|
|
6
6
|
export default class PreviewInnerFoundation extends BaseFoundation {
|
|
7
7
|
constructor(adapter) {
|
|
8
8
|
super(Object.assign({}, adapter));
|
|
9
|
-
|
|
10
9
|
this.handleViewVisibleChange = () => {
|
|
11
10
|
const nowTime = new Date().getTime();
|
|
12
|
-
|
|
13
11
|
const mouseActiveTime = this._adapter.getMouseActiveTime();
|
|
14
|
-
|
|
15
12
|
const stopTiming = this._adapter.getStopTiming();
|
|
16
|
-
|
|
17
13
|
const {
|
|
18
14
|
viewerVisibleDelay
|
|
19
15
|
} = this.getProps();
|
|
20
16
|
const {
|
|
21
17
|
viewerVisible
|
|
22
18
|
} = this.getStates();
|
|
23
|
-
|
|
24
19
|
if (nowTime - mouseActiveTime > viewerVisibleDelay && !stopTiming) {
|
|
25
20
|
viewerVisible && this.setState({
|
|
26
21
|
viewerVisible: false
|
|
27
22
|
});
|
|
28
23
|
}
|
|
29
24
|
};
|
|
30
|
-
|
|
31
25
|
this.handleMouseMoveEvent = (e, event) => {
|
|
32
26
|
const isTarget = isTargetEmit(e, STOP_CLOSE_TARGET);
|
|
33
|
-
|
|
34
27
|
if (isTarget && event === "over") {
|
|
35
28
|
this._adapter.setStopTiming(true);
|
|
36
29
|
} else if (isTarget && event === "out") {
|
|
37
30
|
this._adapter.setStopTiming(false);
|
|
38
31
|
}
|
|
39
32
|
};
|
|
40
|
-
|
|
41
33
|
this.handleMouseMove = e => {
|
|
42
34
|
this._adapter.setMouseActiveTime(new Date().getTime());
|
|
43
|
-
|
|
44
35
|
this.setState({
|
|
45
36
|
viewerVisible: true
|
|
46
37
|
});
|
|
47
38
|
};
|
|
48
|
-
|
|
49
39
|
this.handleMouseUp = e => {
|
|
50
40
|
const {
|
|
51
41
|
maskClosable
|
|
@@ -55,50 +45,39 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
55
45
|
clientX,
|
|
56
46
|
clientY
|
|
57
47
|
} = e;
|
|
58
|
-
|
|
59
48
|
const {
|
|
60
49
|
x,
|
|
61
50
|
y
|
|
62
|
-
} = this._adapter.getStartMouseDown();
|
|
51
|
+
} = this._adapter.getStartMouseDown();
|
|
52
|
+
// 对鼠标移动做容错处理,当 x 和 y 方向在 mouseUp 的时候移动距离都小于等于 5px 时候就可以关闭预览
|
|
63
53
|
// Error-tolerant processing of mouse movement, when the movement distance in the x and y directions is less than or equal to 5px in mouseUp, the preview can be closed
|
|
64
54
|
// 不做容错处理的话,直接用 clientX !== x || y !== clientY 做判断,鼠标在用户点击时候无意识的轻微移动无法关闭预览,不符合用户预期
|
|
65
55
|
// If you do not do fault-tolerant processing, but directly use clientX !== x || y !== clientY to make judgments, the slight movement of the mouse when the user clicks will not be able to close the preview, which does not meet the user's expectations.
|
|
66
|
-
|
|
67
|
-
|
|
68
56
|
if (Math.abs(clientX - x) > 5 || Math.abs(y - clientY) > 5) {
|
|
69
57
|
couldClose = false;
|
|
70
58
|
}
|
|
71
|
-
|
|
72
59
|
if (couldClose && maskClosable) {
|
|
73
60
|
this.handlePreviewClose();
|
|
74
61
|
}
|
|
75
62
|
};
|
|
76
|
-
|
|
77
63
|
this.handleMouseDown = e => {
|
|
78
64
|
const {
|
|
79
65
|
clientX,
|
|
80
66
|
clientY
|
|
81
67
|
} = e;
|
|
82
|
-
|
|
83
68
|
this._adapter.setStartMouseDown(clientX, clientY);
|
|
84
69
|
};
|
|
85
|
-
|
|
86
70
|
this.handleKeyDown = e => {
|
|
87
71
|
const {
|
|
88
72
|
closeOnEsc
|
|
89
73
|
} = this.getProps();
|
|
90
|
-
|
|
91
74
|
if (closeOnEsc && e.keyCode === KeyCode.ESC) {
|
|
92
75
|
e.stopPropagation();
|
|
93
|
-
|
|
94
76
|
this._adapter.notifyVisibleChange(false);
|
|
95
|
-
|
|
96
77
|
this._adapter.notifyClose();
|
|
97
|
-
|
|
98
78
|
return;
|
|
99
79
|
}
|
|
100
80
|
};
|
|
101
|
-
|
|
102
81
|
this.handleSwitchImage = direction => {
|
|
103
82
|
const step = direction === "prev" ? -1 : 1;
|
|
104
83
|
const {
|
|
@@ -107,11 +86,9 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
107
86
|
} = this.getStates();
|
|
108
87
|
const srcLength = imgSrc.length;
|
|
109
88
|
const newIndex = (currentIndexInState + step + srcLength) % srcLength;
|
|
110
|
-
|
|
111
89
|
if ("currentIndex" in this.getProps()) {
|
|
112
90
|
if (this._adapter.getIsInGroup()) {
|
|
113
91
|
const setCurrentIndex = this._adapter.getContext("setCurrentIndex");
|
|
114
|
-
|
|
115
92
|
setCurrentIndex(newIndex);
|
|
116
93
|
}
|
|
117
94
|
} else {
|
|
@@ -119,17 +96,13 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
119
96
|
currentIndex: newIndex
|
|
120
97
|
});
|
|
121
98
|
}
|
|
122
|
-
|
|
123
99
|
this._adapter.notifyChange(newIndex, direction);
|
|
124
|
-
|
|
125
100
|
this.setState({
|
|
126
101
|
direction,
|
|
127
102
|
rotation: 0
|
|
128
103
|
});
|
|
129
|
-
|
|
130
104
|
this._adapter.notifyRotateChange(0);
|
|
131
105
|
};
|
|
132
|
-
|
|
133
106
|
this.handleDownload = () => {
|
|
134
107
|
const {
|
|
135
108
|
currentIndex,
|
|
@@ -138,24 +111,18 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
138
111
|
const downloadSrc = imgSrc[currentIndex];
|
|
139
112
|
const downloadName = downloadSrc.slice(downloadSrc.lastIndexOf("/") + 1);
|
|
140
113
|
downloadImage(downloadSrc, downloadName);
|
|
141
|
-
|
|
142
114
|
this._adapter.notifyDownload(downloadSrc, currentIndex);
|
|
143
115
|
};
|
|
144
|
-
|
|
145
116
|
this.handlePreviewClose = () => {
|
|
146
117
|
this._adapter.notifyVisibleChange(false);
|
|
147
|
-
|
|
148
118
|
this._adapter.notifyClose();
|
|
149
119
|
};
|
|
150
|
-
|
|
151
120
|
this.handleAdjustRatio = type => {
|
|
152
121
|
this.setState({
|
|
153
122
|
ratio: type
|
|
154
123
|
});
|
|
155
|
-
|
|
156
124
|
this._adapter.notifyRatioChange(type);
|
|
157
125
|
};
|
|
158
|
-
|
|
159
126
|
this.handleRotateImage = direction => {
|
|
160
127
|
const {
|
|
161
128
|
rotation
|
|
@@ -164,21 +131,18 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
164
131
|
this.setState({
|
|
165
132
|
rotation: newRotation
|
|
166
133
|
});
|
|
167
|
-
|
|
168
134
|
this._adapter.notifyRotateChange(newRotation);
|
|
169
135
|
};
|
|
170
|
-
|
|
171
136
|
this.handleZoomImage = newZoom => {
|
|
172
137
|
const {
|
|
173
138
|
zoom
|
|
174
139
|
} = this.getStates();
|
|
175
|
-
|
|
176
140
|
this._adapter.notifyZoom(newZoom, newZoom > zoom);
|
|
177
|
-
|
|
178
141
|
this.setState({
|
|
179
142
|
zoom: newZoom
|
|
180
143
|
});
|
|
181
|
-
};
|
|
144
|
+
};
|
|
145
|
+
// 当 visible 改变之后,预览组件完成首张图片加载后,启动预加载
|
|
182
146
|
// 如: 1,2,3,4,5,6,7,8张图片, 点击第 4 张图片,preLoadGap 为 2
|
|
183
147
|
// 当 visible 从 false 变为 true ,首先加载第 4 张图片,当第 4 张图片加载完成后,
|
|
184
148
|
// 再按照 5,3,6,2的顺序预先加载这几张图片
|
|
@@ -186,8 +150,6 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
186
150
|
// Such as: 1, 2, 3, 4, 5, 6, 7, 8 pictures, click the 4th picture, preLoadGap is 2
|
|
187
151
|
// When visible changes from false to true , load the 4th image first, when the 4th image is loaded,
|
|
188
152
|
// Preload these pictures in the order of 5, 3, 6, 2
|
|
189
|
-
|
|
190
|
-
|
|
191
153
|
this.preloadGapImage = () => {
|
|
192
154
|
const {
|
|
193
155
|
preLoad,
|
|
@@ -198,31 +160,26 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
198
160
|
const {
|
|
199
161
|
imgSrc
|
|
200
162
|
} = this.getStates();
|
|
201
|
-
|
|
202
163
|
if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1) {
|
|
203
164
|
return;
|
|
204
165
|
}
|
|
205
|
-
|
|
206
166
|
const preloadImages = getPreloadImagArr(imgSrc, currentIndex, preLoadGap, infinite);
|
|
207
167
|
const Img = new Image();
|
|
208
168
|
let index = 0;
|
|
209
|
-
|
|
210
169
|
function callback(e) {
|
|
211
170
|
index++;
|
|
212
|
-
|
|
213
171
|
if (index < preloadImages.length) {
|
|
214
172
|
Img.src = preloadImages[index];
|
|
215
173
|
}
|
|
216
174
|
}
|
|
217
|
-
|
|
218
175
|
Img.onload = e => {
|
|
219
176
|
this.setLoadSuccessStatus(Img.src);
|
|
220
177
|
callback(e);
|
|
221
178
|
};
|
|
222
|
-
|
|
223
179
|
Img.onerror = callback;
|
|
224
180
|
Img.src = preloadImages[0];
|
|
225
|
-
};
|
|
181
|
+
};
|
|
182
|
+
// 在切换左右图片时,当被切换图片完成加载后,根据方向决定下一个预加载的图片
|
|
226
183
|
// 如: 1,2,3,4,5,6,7,8张图片
|
|
227
184
|
// 当 preLoadGap 为 2, 从第 5 张图片进行切换
|
|
228
185
|
// - 如果向 右 切换到第 6 张,则第 6 张图片加载动作结束后(无论加载成功 or 失败),会预先加载第 8 张;
|
|
@@ -232,8 +189,6 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
232
189
|
// When preLoadGap is 2, switch from the 5th picture
|
|
233
190
|
// - If you switch to the 6th image(direction is next), the 8th image will be preloaded after the 6th image is loaded (whether it succeeds or fails to load);
|
|
234
191
|
// - If you switch to the 4th image(direction is prev), the second image will be preloaded after the 4th image is loaded (whether it succeeds or fails to load);
|
|
235
|
-
|
|
236
|
-
|
|
237
192
|
this.preloadSingleImage = () => {
|
|
238
193
|
const {
|
|
239
194
|
preLoad,
|
|
@@ -246,36 +201,29 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
246
201
|
direction,
|
|
247
202
|
imgLoadStatus
|
|
248
203
|
} = this.getStates();
|
|
249
|
-
|
|
250
204
|
if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1) {
|
|
251
205
|
return;
|
|
252
|
-
}
|
|
206
|
+
}
|
|
207
|
+
// 根据方向决定preload那个index
|
|
253
208
|
// Determine the index of preload according to the direction
|
|
254
|
-
|
|
255
|
-
|
|
256
209
|
let preloadIndex = currentIndex + (direction === "prev" ? -1 : 1) * preLoadGap;
|
|
257
|
-
|
|
258
210
|
if (preloadIndex < 0 || preloadIndex >= imgSrc.length) {
|
|
259
211
|
if (infinite) {
|
|
260
212
|
preloadIndex = (preloadIndex + imgSrc.length) % imgSrc.length;
|
|
261
213
|
} else {
|
|
262
214
|
return;
|
|
263
215
|
}
|
|
264
|
-
}
|
|
216
|
+
}
|
|
217
|
+
// 如果图片没有加载成功过,则进行预加载
|
|
265
218
|
// If the image has not been loaded successfully, preload it
|
|
266
|
-
|
|
267
|
-
|
|
268
219
|
if (!imgLoadStatus[preloadIndex]) {
|
|
269
220
|
const Img = new Image();
|
|
270
|
-
|
|
271
221
|
Img.onload = e => {
|
|
272
222
|
this.setLoadSuccessStatus(imgSrc[preloadIndex]);
|
|
273
223
|
};
|
|
274
|
-
|
|
275
224
|
Img.src = imgSrc[preloadIndex];
|
|
276
225
|
}
|
|
277
226
|
};
|
|
278
|
-
|
|
279
227
|
this.setLoadSuccessStatus = src => {
|
|
280
228
|
const {
|
|
281
229
|
imgLoadStatus
|
|
@@ -286,18 +234,17 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
286
234
|
imgLoadStatus: status
|
|
287
235
|
});
|
|
288
236
|
};
|
|
289
|
-
|
|
290
237
|
this.onImageLoad = src => {
|
|
291
238
|
const {
|
|
292
239
|
preloadAfterVisibleChange
|
|
293
240
|
} = this.getStates();
|
|
294
|
-
this.setLoadSuccessStatus(src);
|
|
241
|
+
this.setLoadSuccessStatus(src);
|
|
242
|
+
// 当 preview 中当前加载的图片加载完成后,
|
|
295
243
|
// 如果是在visible change之后的第一次加载,则启动加载该currentIndex左右preloadGap范围的图片
|
|
296
244
|
// 如果是非第一次加载,是在左右切换图片,则根据方向预先加载单张图片
|
|
297
245
|
// When the currently loaded image in Preview is loaded,
|
|
298
246
|
// - It is the first load after visible change, start loading the images in the preloadGap range around the currentIndex
|
|
299
247
|
// - It is not the first load, the image is switched left and right, and a single image is preloaded according to the direction
|
|
300
|
-
|
|
301
248
|
if (preloadAfterVisibleChange) {
|
|
302
249
|
this.preloadGapImage();
|
|
303
250
|
this.setState({
|
|
@@ -308,17 +255,12 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
308
255
|
}
|
|
309
256
|
};
|
|
310
257
|
}
|
|
311
|
-
|
|
312
258
|
beforeShow() {
|
|
313
259
|
this._adapter.registerKeyDownListener();
|
|
314
|
-
|
|
315
260
|
this._adapter.disabledBodyScroll();
|
|
316
261
|
}
|
|
317
|
-
|
|
318
262
|
afterHide() {
|
|
319
263
|
this._adapter.unregisterKeyDownListener();
|
|
320
|
-
|
|
321
264
|
this._adapter.enabledBodyScroll();
|
|
322
265
|
}
|
|
323
|
-
|
|
324
266
|
}
|
package/lib/es/image/utils.js
CHANGED
|
@@ -7,7 +7,6 @@ export const isTargetEmit = (event, targetClasses) => {
|
|
|
7
7
|
if (node.className && typeof node.className === "string") {
|
|
8
8
|
return targetClasses.some(c => node.className.includes(c));
|
|
9
9
|
}
|
|
10
|
-
|
|
11
10
|
return false;
|
|
12
11
|
});
|
|
13
12
|
return isTarget;
|
|
@@ -16,7 +15,6 @@ export const downloadImage = (src, filename) => {
|
|
|
16
15
|
const image = new Image();
|
|
17
16
|
image.src = src;
|
|
18
17
|
image.crossOrigin = "anonymous";
|
|
19
|
-
|
|
20
18
|
image.onload = e => {
|
|
21
19
|
const eleLink = document.createElement("a");
|
|
22
20
|
eleLink.download = filename;
|
|
@@ -45,13 +43,11 @@ export const crossMerge = function () {
|
|
|
45
43
|
newArr.push(rightArr[index]);
|
|
46
44
|
newArr.push(leftArr[index]);
|
|
47
45
|
});
|
|
48
|
-
|
|
49
46
|
if (leftLen > rightLen) {
|
|
50
47
|
newArr = newArr.concat(leftArr.slice(rightLen, leftLen));
|
|
51
48
|
} else if (leftLen < rightLen) {
|
|
52
49
|
newArr = newArr.concat(rightArr.slice(leftLen, rightLen));
|
|
53
50
|
}
|
|
54
|
-
|
|
55
51
|
return newArr;
|
|
56
52
|
};
|
|
57
53
|
export const getPreloadImagArr = (imgSrc, currentIndex, preLoadGap, infinite) => {
|
|
@@ -60,7 +56,6 @@ export const getPreloadImagArr = (imgSrc, currentIndex, preLoadGap, infinite) =>
|
|
|
60
56
|
const srcLength = imgSrc.length;
|
|
61
57
|
let leftArr = [];
|
|
62
58
|
let rightArr = [];
|
|
63
|
-
|
|
64
59
|
if (preLoadGap >= Math.floor(srcLength / 2)) {
|
|
65
60
|
if (infinite) {
|
|
66
61
|
leftArr = imgSrc.concat(imgSrc).slice(beginIndex + srcLength < 0 ? 0 : beginIndex + srcLength, currentIndex + srcLength);
|
|
@@ -86,7 +81,6 @@ export const getPreloadImagArr = (imgSrc, currentIndex, preLoadGap, infinite) =>
|
|
|
86
81
|
}
|
|
87
82
|
}
|
|
88
83
|
}
|
|
89
|
-
|
|
90
84
|
const result = crossMerge(leftArr.reverse(), rightArr);
|
|
91
85
|
const duplicateResult = Array.from(new Set(result));
|
|
92
86
|
return duplicateResult;
|