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