@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
|
@@ -4,100 +4,74 @@ import { parseEvent, parseAllDayEvent, calcWeekData, getCurrDate, parseWeeklyAll
|
|
|
4
4
|
export default class CalendarFoundation extends BaseFoundation {
|
|
5
5
|
constructor(adapter) {
|
|
6
6
|
super(Object.assign({}, adapter));
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
}
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
10
9
|
init() {}
|
|
11
|
-
|
|
12
10
|
destroy() {
|
|
13
11
|
this.raf && cancelAnimationFrame(this.raf);
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
initCurrTime() {
|
|
17
14
|
const {
|
|
18
15
|
showCurrTime,
|
|
19
16
|
displayValue
|
|
20
17
|
} = this.getProps();
|
|
21
|
-
|
|
22
18
|
if (showCurrTime && isSameDay(displayValue, getCurrDate())) {
|
|
23
19
|
this._adapter.updateShowCurrTime();
|
|
24
|
-
|
|
25
20
|
this.getCurrLocation();
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
notifyScrollHeight(height) {
|
|
30
24
|
this._adapter.updateScrollHeight(height);
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
closeCard(e, key) {
|
|
34
27
|
this._adapter.unregisterClickOutsideHandler();
|
|
35
|
-
|
|
36
28
|
this._adapter.notifyClose(e, key);
|
|
37
29
|
}
|
|
38
|
-
|
|
39
30
|
_getDate() {
|
|
40
31
|
const {
|
|
41
32
|
displayValue
|
|
42
33
|
} = this.getProps();
|
|
43
34
|
return displayValue || getCurrDate();
|
|
44
35
|
}
|
|
45
|
-
|
|
46
36
|
showCard(e, key) {
|
|
47
37
|
this._adapter.unregisterClickOutsideHandler();
|
|
48
|
-
|
|
49
38
|
const bodyWidth = document.querySelector('body').clientWidth;
|
|
50
39
|
const popoverWidth = 110;
|
|
51
40
|
const spacing = bodyWidth - e.target.getBoundingClientRect().right - popoverWidth;
|
|
52
|
-
|
|
53
41
|
this._adapter.openCard(key, spacing > 0);
|
|
54
|
-
|
|
55
42
|
this._adapter.registerClickOutsideHandler(key, () => {
|
|
56
43
|
this.closeCard(null, key);
|
|
57
44
|
});
|
|
58
45
|
}
|
|
59
|
-
|
|
60
46
|
formatCbValue(val) {
|
|
61
47
|
const date = val.shift();
|
|
62
|
-
const dateArr = [date.getFullYear(), date.getMonth(), date.getDate(), ...val];
|
|
63
|
-
|
|
48
|
+
const dateArr = [date.getFullYear(), date.getMonth(), date.getDate(), ...val];
|
|
49
|
+
// @ts-ignore skip
|
|
64
50
|
return new Date(...dateArr);
|
|
65
51
|
}
|
|
66
52
|
/**
|
|
67
53
|
*
|
|
68
54
|
* find the location of showCurrTime red line
|
|
69
55
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
56
|
getCurrLocation() {
|
|
73
57
|
let startTime = null;
|
|
74
58
|
let pos = getPos(getCurrDate());
|
|
75
|
-
|
|
76
59
|
this._adapter.updateCurrPos(round(pos));
|
|
77
|
-
|
|
78
60
|
const frameFunc = () => {
|
|
79
61
|
const timestamp = Date.now();
|
|
80
|
-
|
|
81
62
|
if (!startTime) {
|
|
82
63
|
startTime = timestamp;
|
|
83
64
|
}
|
|
84
|
-
|
|
85
65
|
const time = timestamp - startTime;
|
|
86
|
-
|
|
87
66
|
if (time > 30000) {
|
|
88
67
|
pos = getPos(getCurrDate());
|
|
89
|
-
|
|
90
68
|
this._adapter.updateCurrPos(round(pos));
|
|
91
|
-
|
|
92
69
|
startTime = timestamp;
|
|
93
70
|
}
|
|
94
|
-
|
|
95
71
|
this.raf = requestAnimationFrame(frameFunc);
|
|
96
72
|
};
|
|
97
|
-
|
|
98
73
|
this.raf = requestAnimationFrame(frameFunc);
|
|
99
74
|
}
|
|
100
|
-
|
|
101
75
|
getWeeklyData(value, dateFnsLocale) {
|
|
102
76
|
const data = {};
|
|
103
77
|
const {
|
|
@@ -108,12 +82,9 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
108
82
|
weekStartsOn
|
|
109
83
|
});
|
|
110
84
|
data.week = calcWeekData(value, null, 'week', dateFnsLocale, weekStartsOn);
|
|
111
|
-
|
|
112
85
|
this._adapter.setWeeklyData(data);
|
|
113
|
-
|
|
114
86
|
return data;
|
|
115
87
|
}
|
|
116
|
-
|
|
117
88
|
getRangeData(value, dateFnsLocale) {
|
|
118
89
|
const data = {};
|
|
119
90
|
const {
|
|
@@ -125,13 +96,11 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
125
96
|
locale: dateFnsLocale,
|
|
126
97
|
weekStartsOn
|
|
127
98
|
});
|
|
128
|
-
|
|
129
|
-
|
|
99
|
+
const startDate = startOfDay(range[0]);
|
|
100
|
+
data.week = calcRangeData(value, startDate, len, 'week', dateFnsLocale, weekStartsOn);
|
|
130
101
|
this._adapter.setRangeData(data);
|
|
131
|
-
|
|
132
102
|
return data;
|
|
133
103
|
}
|
|
134
|
-
|
|
135
104
|
getMonthlyData(value, dateFnsLocale) {
|
|
136
105
|
const monthStart = startOfMonth(value);
|
|
137
106
|
const data = {};
|
|
@@ -144,13 +113,10 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
144
113
|
[...Array(numberOfWeek).keys()].map(ind => {
|
|
145
114
|
data[ind] = calcWeekData(addDays(monthStart, ind * 7), monthStart, 'month', dateFnsLocale, weekStartsOn);
|
|
146
115
|
});
|
|
147
|
-
|
|
148
116
|
this._adapter.setMonthlyData(data);
|
|
149
|
-
|
|
150
117
|
return data;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
118
|
+
}
|
|
119
|
+
// ================== Daily Event ==================
|
|
154
120
|
_parseEvents(events) {
|
|
155
121
|
const parsed = {
|
|
156
122
|
allDay: [],
|
|
@@ -163,46 +129,36 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
163
129
|
});
|
|
164
130
|
return parsed;
|
|
165
131
|
}
|
|
166
|
-
|
|
167
132
|
getParseDailyEvents(events, date) {
|
|
168
133
|
if (!date) {
|
|
169
134
|
date = this._getDate();
|
|
170
135
|
}
|
|
171
|
-
|
|
172
136
|
const parsed = this._parseEvents(events);
|
|
173
|
-
|
|
174
137
|
const {
|
|
175
138
|
displayValue
|
|
176
139
|
} = this.getProps();
|
|
177
140
|
const key = startOfDay(date).toString();
|
|
178
141
|
parsed.allDay = convertEventsArrToMap(parsed.allDay, 'date', startOfDay, displayValue).get(key);
|
|
179
142
|
parsed.day = convertEventsArrToMap(parsed.day, 'date', null, displayValue).get(key);
|
|
180
|
-
|
|
181
143
|
if (!parsed.allDay) {
|
|
182
144
|
parsed.allDay = [];
|
|
183
145
|
}
|
|
184
|
-
|
|
185
146
|
if (!parsed.day) {
|
|
186
147
|
parsed.day = [];
|
|
187
148
|
}
|
|
188
|
-
|
|
189
149
|
parsed.day = parsed.day.map(item => renderDailyEvent(item));
|
|
190
150
|
return parsed;
|
|
191
151
|
}
|
|
192
|
-
|
|
193
152
|
parseDailyEvents() {
|
|
194
153
|
const {
|
|
195
154
|
events,
|
|
196
155
|
displayValue
|
|
197
156
|
} = this.getProps();
|
|
198
157
|
const parsed = this.getParseDailyEvents(events, displayValue);
|
|
199
|
-
|
|
200
158
|
this._adapter.setParsedEvents(parsed);
|
|
201
|
-
|
|
202
159
|
this._adapter.cacheEventKeys(events.map(i => i.key));
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
160
|
+
}
|
|
161
|
+
// ================== Weekly Event ==================
|
|
206
162
|
_parseWeeklyEvents(events, weekStart) {
|
|
207
163
|
const {
|
|
208
164
|
weekStartsOn
|
|
@@ -216,7 +172,6 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
216
172
|
});
|
|
217
173
|
return parsed;
|
|
218
174
|
}
|
|
219
|
-
|
|
220
175
|
_renderWeeklyAllDayEvent(events) {
|
|
221
176
|
const res = [];
|
|
222
177
|
events.forEach(row => {
|
|
@@ -224,26 +179,19 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
224
179
|
res.push(...event);
|
|
225
180
|
});
|
|
226
181
|
return res;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
182
|
+
}
|
|
183
|
+
// return parsed weekly allday events
|
|
230
184
|
parseWeeklyAllDayEvents(events) {
|
|
231
185
|
const {
|
|
232
186
|
week
|
|
233
187
|
} = this._adapter.getWeeklyData();
|
|
234
|
-
|
|
235
188
|
const weekStart = week[0].date;
|
|
236
|
-
|
|
237
189
|
const parsed = this._parseWeeklyEvents(events, weekStart);
|
|
238
|
-
|
|
239
190
|
const res = this._renderWeeklyAllDayEvent(parsed);
|
|
240
|
-
|
|
241
191
|
return res;
|
|
242
192
|
}
|
|
243
|
-
|
|
244
193
|
getParsedWeeklyEvents(events) {
|
|
245
194
|
const parsed = this._parseEvents(events);
|
|
246
|
-
|
|
247
195
|
const {
|
|
248
196
|
displayValue
|
|
249
197
|
} = this.getProps();
|
|
@@ -251,21 +199,17 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
251
199
|
result.allDay = convertEventsArrToMap(parsed.allDay, 'start', startOfDay, displayValue);
|
|
252
200
|
result.day = convertEventsArrToMap(parsed.day, 'date', null, displayValue);
|
|
253
201
|
return result;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
|
|
202
|
+
}
|
|
203
|
+
// return parsed weekly allday events
|
|
257
204
|
parseWeeklyEvents() {
|
|
258
205
|
const {
|
|
259
206
|
events
|
|
260
207
|
} = this.getProps();
|
|
261
208
|
const parsed = this.getParsedWeeklyEvents(events);
|
|
262
|
-
|
|
263
209
|
this._adapter.setParsedEvents(parsed);
|
|
264
|
-
|
|
265
210
|
this._adapter.cacheEventKeys(events.map(i => i.key));
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
211
|
+
}
|
|
212
|
+
// ================== Monthly Event ==================
|
|
269
213
|
pushDayEventIntoWeekMap(item, index, map) {
|
|
270
214
|
if (index in map) {
|
|
271
215
|
map[index].push(item);
|
|
@@ -273,23 +217,17 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
273
217
|
map[index] = [item];
|
|
274
218
|
}
|
|
275
219
|
}
|
|
276
|
-
|
|
277
220
|
convertMapToArray(weekMap, weekStart) {
|
|
278
221
|
const eventArray = [];
|
|
279
|
-
|
|
280
222
|
for (const entry of weekMap.entries()) {
|
|
281
223
|
const [key, value] = entry;
|
|
282
224
|
const map = new Map();
|
|
283
225
|
map.set(key, value);
|
|
284
|
-
|
|
285
226
|
const weekEvents = this._parseWeeklyEvents(map, weekStart);
|
|
286
|
-
|
|
287
227
|
eventArray.push(...weekEvents);
|
|
288
228
|
}
|
|
289
|
-
|
|
290
229
|
return eventArray;
|
|
291
230
|
}
|
|
292
|
-
|
|
293
231
|
getParseMonthlyEvents(itemLimit) {
|
|
294
232
|
const parsed = {};
|
|
295
233
|
const {
|
|
@@ -297,9 +235,7 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
297
235
|
events,
|
|
298
236
|
weekStartsOn
|
|
299
237
|
} = this.getProps();
|
|
300
|
-
|
|
301
238
|
const currDate = this._getDate();
|
|
302
|
-
|
|
303
239
|
const firstDayOfMonth = startOfMonth(displayValue);
|
|
304
240
|
const lastDayOfMonth = endOfMonth(displayValue);
|
|
305
241
|
const res = [];
|
|
@@ -307,11 +243,9 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
307
243
|
if (isBefore(prev.start, next.start)) {
|
|
308
244
|
return -1;
|
|
309
245
|
}
|
|
310
|
-
|
|
311
246
|
if (isAfter(prev.start, next.start)) {
|
|
312
247
|
return 1;
|
|
313
248
|
}
|
|
314
|
-
|
|
315
249
|
return 0;
|
|
316
250
|
}).forEach(event => {
|
|
317
251
|
const parsedEvent = parseAllDayEvent(event, event.allDay, currDate);
|
|
@@ -327,20 +261,17 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
327
261
|
}) - 1;
|
|
328
262
|
this.pushDayEventIntoWeekMap(item, weekInd, parsed);
|
|
329
263
|
return;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
|
|
264
|
+
}
|
|
265
|
+
// When the date is within the previous month
|
|
333
266
|
if (isBefore(item.date, firstDayOfMonth)) {
|
|
334
267
|
if (isSameWeek(item.date, firstDayOfMonth, {
|
|
335
268
|
weekStartsOn
|
|
336
269
|
})) {
|
|
337
270
|
this.pushDayEventIntoWeekMap(item, 0, parsed);
|
|
338
271
|
}
|
|
339
|
-
|
|
340
272
|
return;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
|
|
273
|
+
}
|
|
274
|
+
// When the date is within the next month
|
|
344
275
|
if (isAfter(item.date, lastDayOfMonth)) {
|
|
345
276
|
if (isSameWeek(item.date, lastDayOfMonth, {
|
|
346
277
|
weekStartsOn
|
|
@@ -350,7 +281,6 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
350
281
|
}) - 1;
|
|
351
282
|
this.pushDayEventIntoWeekMap(item, weekInd, parsed);
|
|
352
283
|
}
|
|
353
|
-
|
|
354
284
|
return;
|
|
355
285
|
}
|
|
356
286
|
});
|
|
@@ -360,41 +290,33 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
360
290
|
const weekStart = startOfWeek(week[0].date, {
|
|
361
291
|
weekStartsOn
|
|
362
292
|
});
|
|
363
|
-
const weekMap = convertEventsArrToMap(week, 'start', startOfDay);
|
|
293
|
+
const weekMap = convertEventsArrToMap(week, 'start', startOfDay);
|
|
294
|
+
// When there are multiple events in a week, multiple events should be parsed
|
|
364
295
|
// const oldParsedWeeklyEvent = this._parseWeeklyEvents(weekMap, weekStart);
|
|
365
|
-
|
|
366
296
|
const parsedWeeklyEvent = this.convertMapToArray(weekMap, weekStart);
|
|
367
297
|
parsed[key].day = collectDailyEvents(parsedWeeklyEvent);
|
|
368
298
|
parsed[key].display = this._renderDisplayEvents(parsedWeeklyEvent);
|
|
369
299
|
});
|
|
370
300
|
return parsed;
|
|
371
301
|
}
|
|
372
|
-
|
|
373
302
|
parseMonthlyEvents(itemLimit) {
|
|
374
303
|
const {
|
|
375
304
|
events
|
|
376
305
|
} = this.getProps();
|
|
377
306
|
const parsed = this.getParseMonthlyEvents(itemLimit);
|
|
378
|
-
|
|
379
307
|
this._adapter.setParsedEvents(parsed);
|
|
380
|
-
|
|
381
308
|
this._adapter.setItemLimit(itemLimit);
|
|
382
|
-
|
|
383
309
|
this._adapter.cacheEventKeys(events.map(i => i.key));
|
|
384
310
|
}
|
|
385
|
-
|
|
386
311
|
_renderDisplayEvents(events) {
|
|
387
312
|
// Limits should not be added when calculating the relative position of each event, because there will be calculations that separate two events in the middle of the week
|
|
388
313
|
let displayEvents = events.slice();
|
|
389
|
-
|
|
390
314
|
if (displayEvents.length) {
|
|
391
315
|
displayEvents = this._renderWeeklyAllDayEvent(displayEvents);
|
|
392
316
|
}
|
|
393
|
-
|
|
394
317
|
return displayEvents;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
|
|
318
|
+
}
|
|
319
|
+
// ================== Range Event ==================
|
|
398
320
|
_parseRangeEvents(events) {
|
|
399
321
|
let parsed = [[]];
|
|
400
322
|
const [start, end] = this.getProp('range');
|
|
@@ -406,7 +328,6 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
406
328
|
});
|
|
407
329
|
return parsed;
|
|
408
330
|
}
|
|
409
|
-
|
|
410
331
|
_renderRangeAllDayEvent(events) {
|
|
411
332
|
let res = [];
|
|
412
333
|
events.forEach(row => {
|
|
@@ -414,40 +335,30 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
414
335
|
res = [...res, ...event];
|
|
415
336
|
});
|
|
416
337
|
return res;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
|
|
338
|
+
}
|
|
339
|
+
// return parsed weekly allday events
|
|
420
340
|
parseRangeAllDayEvents(events) {
|
|
421
341
|
const parsed = this._parseRangeEvents(events);
|
|
422
|
-
|
|
423
342
|
const res = this._renderRangeAllDayEvent(parsed);
|
|
424
|
-
|
|
425
343
|
return res;
|
|
426
344
|
}
|
|
427
|
-
|
|
428
345
|
getParsedRangeEvents(events) {
|
|
429
346
|
const parsed = this._parseEvents(events);
|
|
430
|
-
|
|
431
347
|
const [start] = this.getProp('range');
|
|
432
348
|
parsed.allDay = convertEventsArrToMap(parsed.allDay, 'start', startOfDay, start);
|
|
433
349
|
parsed.day = convertEventsArrToMap(parsed.day, 'date', null, start);
|
|
434
350
|
return parsed;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
|
|
351
|
+
}
|
|
352
|
+
// return parsed weekly allday events
|
|
438
353
|
parseRangeEvents() {
|
|
439
354
|
const {
|
|
440
355
|
events
|
|
441
356
|
} = this.getProps();
|
|
442
357
|
const parsed = this.getParsedRangeEvents(events);
|
|
443
|
-
|
|
444
358
|
this._adapter.setParsedEvents(parsed);
|
|
445
|
-
|
|
446
359
|
this._adapter.cacheEventKeys(events.map(i => i.key));
|
|
447
360
|
}
|
|
448
|
-
|
|
449
361
|
checkWeekend(val) {
|
|
450
362
|
return checkWeekend(val);
|
|
451
363
|
}
|
|
452
|
-
|
|
453
364
|
}
|
|
@@ -2,206 +2,161 @@ import _get from "lodash/get";
|
|
|
2
2
|
import _isObject from "lodash/isObject";
|
|
3
3
|
import BaseFoundation from '../base/foundation';
|
|
4
4
|
import { numbers } from './constants';
|
|
5
|
-
|
|
6
5
|
class CarouselFoundation extends BaseFoundation {
|
|
7
6
|
constructor(adapter) {
|
|
8
7
|
super(Object.assign({}, adapter));
|
|
9
8
|
this._interval = null;
|
|
10
9
|
this._forcePlay = false;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
setForcePlay(forcePlay) {
|
|
14
12
|
this._forcePlay = forcePlay;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
play(interval) {
|
|
18
15
|
if (this._interval) {
|
|
19
16
|
clearInterval(this._interval);
|
|
20
17
|
}
|
|
21
|
-
|
|
22
18
|
this._interval = setInterval(() => {
|
|
23
19
|
this.next();
|
|
24
20
|
}, interval);
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
stop() {
|
|
28
23
|
if (this._interval) {
|
|
29
24
|
clearInterval(this._interval);
|
|
30
25
|
}
|
|
31
26
|
}
|
|
32
|
-
|
|
33
27
|
goTo(activeIndex) {
|
|
34
28
|
const {
|
|
35
29
|
activeIndex: stateActiveIndex
|
|
36
30
|
} = this.getStates();
|
|
37
31
|
const targetIndex = this.getValidIndex(activeIndex);
|
|
38
|
-
|
|
39
32
|
this._adapter.setIsReverse(stateActiveIndex > targetIndex);
|
|
40
|
-
|
|
41
33
|
if (this.getIsControlledComponent()) {
|
|
42
34
|
this._notifyChange(targetIndex);
|
|
43
35
|
} else {
|
|
44
36
|
this._notifyChange(targetIndex);
|
|
45
|
-
|
|
46
37
|
this.handleNewActiveIndex(targetIndex);
|
|
47
38
|
}
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
next() {
|
|
51
41
|
this.stop();
|
|
52
42
|
const {
|
|
53
43
|
activeIndex: stateActiveIndex
|
|
54
44
|
} = this.getStates();
|
|
55
45
|
const targetIndex = this.getValidIndex(stateActiveIndex + 1);
|
|
56
|
-
|
|
57
46
|
this._adapter.setIsReverse(false);
|
|
58
|
-
|
|
59
47
|
if (this.getIsControlledComponent()) {
|
|
60
48
|
this._notifyChange(targetIndex);
|
|
61
49
|
} else {
|
|
62
50
|
this._notifyChange(targetIndex);
|
|
63
|
-
|
|
64
51
|
this.handleNewActiveIndex(targetIndex);
|
|
65
52
|
}
|
|
66
|
-
|
|
67
53
|
this.handleAutoPlay();
|
|
68
54
|
}
|
|
69
|
-
|
|
70
55
|
prev() {
|
|
71
56
|
this.stop();
|
|
72
57
|
const {
|
|
73
58
|
activeIndex: stateActiveIndex
|
|
74
59
|
} = this.getStates();
|
|
75
60
|
const targetIndex = this.getValidIndex(stateActiveIndex - 1);
|
|
76
|
-
|
|
77
61
|
this._adapter.setIsReverse(true);
|
|
78
|
-
|
|
79
62
|
if (this.getIsControlledComponent()) {
|
|
80
63
|
this._notifyChange(targetIndex);
|
|
81
64
|
} else {
|
|
82
65
|
this._notifyChange(targetIndex);
|
|
83
|
-
|
|
84
66
|
this.handleNewActiveIndex(targetIndex);
|
|
85
67
|
}
|
|
86
|
-
|
|
87
68
|
this.handleAutoPlay();
|
|
88
69
|
}
|
|
89
|
-
|
|
90
70
|
destroy() {
|
|
91
71
|
this._unregisterInterval();
|
|
92
72
|
}
|
|
93
|
-
|
|
94
73
|
_unregisterInterval() {
|
|
95
74
|
if (this._interval) {
|
|
96
75
|
clearInterval(this._interval);
|
|
97
76
|
this._interval = null;
|
|
98
77
|
}
|
|
99
78
|
}
|
|
100
|
-
|
|
101
79
|
_notifyChange(activeIndex) {
|
|
102
80
|
const {
|
|
103
81
|
activeIndex: stateActiveIndex,
|
|
104
82
|
isInit
|
|
105
83
|
} = this.getStates();
|
|
106
|
-
|
|
107
84
|
if (isInit) {
|
|
108
85
|
this._adapter.setIsInit(false);
|
|
109
86
|
}
|
|
110
|
-
|
|
111
87
|
if (stateActiveIndex !== activeIndex) {
|
|
112
88
|
this._adapter.setPreActiveIndex(stateActiveIndex);
|
|
113
|
-
|
|
114
89
|
this._adapter.notifyChange(activeIndex, stateActiveIndex);
|
|
115
90
|
}
|
|
116
91
|
}
|
|
117
|
-
|
|
118
92
|
getValidIndex(index) {
|
|
119
93
|
const {
|
|
120
94
|
children
|
|
121
95
|
} = this.getStates();
|
|
122
96
|
return (index + children.length) % children.length;
|
|
123
97
|
}
|
|
124
|
-
|
|
125
98
|
getSwitchingTime() {
|
|
126
99
|
const {
|
|
127
100
|
autoPlay,
|
|
128
101
|
speed
|
|
129
102
|
} = this.getProps();
|
|
130
103
|
const autoPlayType = typeof autoPlay;
|
|
131
|
-
|
|
132
104
|
if (autoPlayType === 'boolean') {
|
|
133
105
|
return numbers.DEFAULT_INTERVAL + speed;
|
|
134
106
|
}
|
|
135
|
-
|
|
136
107
|
if (_isObject(autoPlay)) {
|
|
137
108
|
return _get(autoPlay, 'interval', numbers.DEFAULT_INTERVAL) + speed;
|
|
138
109
|
}
|
|
139
|
-
|
|
140
110
|
return speed;
|
|
141
111
|
}
|
|
142
|
-
|
|
143
112
|
getIsControlledComponent() {
|
|
144
113
|
return this._isInProps('activeIndex');
|
|
145
114
|
}
|
|
146
|
-
|
|
147
115
|
handleAutoPlay() {
|
|
148
116
|
const {
|
|
149
117
|
autoPlay
|
|
150
118
|
} = this.getProps();
|
|
151
|
-
const autoPlayType = typeof autoPlay;
|
|
152
|
-
|
|
119
|
+
const autoPlayType = typeof autoPlay;
|
|
120
|
+
// when user manually call the play function, force play
|
|
153
121
|
if (autoPlayType === 'boolean' && autoPlay || _isObject(autoPlay) || this._forcePlay) {
|
|
154
122
|
this.play(this.getSwitchingTime());
|
|
155
123
|
}
|
|
156
124
|
}
|
|
157
|
-
|
|
158
125
|
handleKeyDown(event) {
|
|
159
126
|
if (event.key === 'ArrowLeft') {
|
|
160
127
|
this.prev();
|
|
161
128
|
}
|
|
162
|
-
|
|
163
129
|
if (event.key === 'ArrowRight') {
|
|
164
130
|
this.next();
|
|
165
131
|
}
|
|
166
132
|
}
|
|
167
|
-
|
|
168
133
|
onIndicatorChange(activeIndex) {
|
|
169
134
|
const {
|
|
170
135
|
activeIndex: stateActiveIndex
|
|
171
136
|
} = this.getStates();
|
|
172
|
-
|
|
173
137
|
this._adapter.setIsReverse(stateActiveIndex > activeIndex);
|
|
174
|
-
|
|
175
138
|
this._notifyChange(activeIndex);
|
|
176
|
-
|
|
177
139
|
if (!this.getIsControlledComponent()) {
|
|
178
140
|
this.handleNewActiveIndex(activeIndex);
|
|
179
141
|
}
|
|
180
142
|
}
|
|
181
|
-
|
|
182
143
|
handleNewActiveIndex(activeIndex) {
|
|
183
144
|
const {
|
|
184
145
|
activeIndex: stateActiveIndex
|
|
185
146
|
} = this.getStates();
|
|
186
|
-
|
|
187
147
|
if (stateActiveIndex !== activeIndex) {
|
|
188
148
|
this._adapter.setNewActiveIndex(activeIndex);
|
|
189
149
|
}
|
|
190
150
|
}
|
|
191
|
-
|
|
192
151
|
getDefaultActiveIndex() {
|
|
193
152
|
let activeIndex;
|
|
194
153
|
const props = this.getProps();
|
|
195
|
-
|
|
196
154
|
if ('activeIndex' in props) {
|
|
197
155
|
activeIndex = props.activeIndex;
|
|
198
156
|
} else if ('defaultActiveIndex' in props) {
|
|
199
157
|
activeIndex = props.defaultActiveIndex;
|
|
200
158
|
}
|
|
201
|
-
|
|
202
159
|
return activeIndex;
|
|
203
160
|
}
|
|
204
|
-
|
|
205
161
|
}
|
|
206
|
-
|
|
207
162
|
export default CarouselFoundation;
|
|
@@ -30,10 +30,10 @@ export interface BasicCascaderData {
|
|
|
30
30
|
loading?: boolean;
|
|
31
31
|
children?: BasicCascaderData[];
|
|
32
32
|
}
|
|
33
|
-
export
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export
|
|
33
|
+
export type CascaderType = 'large' | 'small' | 'default';
|
|
34
|
+
export type BasicSimpleValueType = string | number | BasicCascaderData;
|
|
35
|
+
export type BasicValue = BasicSimpleValueType | Array<BasicSimpleValueType> | Array<Array<BasicSimpleValueType>>;
|
|
36
|
+
export type ShowNextType = 'click' | 'hover';
|
|
37
37
|
export interface BasicTriggerRenderProps {
|
|
38
38
|
componentProps: BasicCascaderProps;
|
|
39
39
|
disabled: boolean;
|