@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
|
@@ -3,12 +3,10 @@ import KeyCode from '../utils/keyCode';
|
|
|
3
3
|
export default class ModalContentFoundation extends BaseFoundation {
|
|
4
4
|
constructor(adapter) {
|
|
5
5
|
super(Object.assign(Object.assign({}, ModalContentFoundation.defaultAdapter), adapter));
|
|
6
|
-
|
|
7
6
|
this.handleKeyDown = e => {
|
|
8
7
|
const {
|
|
9
8
|
closeOnEsc
|
|
10
9
|
} = this.getProps();
|
|
11
|
-
|
|
12
10
|
if (closeOnEsc && e.keyCode === KeyCode.ESC) {
|
|
13
11
|
e.stopPropagation();
|
|
14
12
|
this.close(e);
|
|
@@ -16,57 +14,44 @@ export default class ModalContentFoundation extends BaseFoundation {
|
|
|
16
14
|
}
|
|
17
15
|
};
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
destroy() {
|
|
21
18
|
this.handleKeyDownEventListenerUnmount();
|
|
22
19
|
this.modalDialogBlur();
|
|
23
20
|
this.prevFocusElementReFocus();
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
handleDialogMouseDown() {
|
|
27
23
|
this._adapter.notifyDialogMouseDown();
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
handleMaskMouseUp() {
|
|
31
26
|
this._adapter.notifyDialogMouseUp();
|
|
32
27
|
}
|
|
33
|
-
|
|
34
28
|
handleKeyDownEventListenerMount() {
|
|
35
29
|
this._adapter.addKeyDownEventListener();
|
|
36
30
|
}
|
|
37
|
-
|
|
38
31
|
handleKeyDownEventListenerUnmount() {
|
|
39
32
|
this._adapter.removeKeyDownEventListener();
|
|
40
33
|
}
|
|
41
|
-
|
|
42
34
|
getMouseState() {
|
|
43
35
|
this._adapter.getMouseState();
|
|
44
36
|
}
|
|
45
|
-
|
|
46
37
|
handleMaskClick(e) {
|
|
47
38
|
const {
|
|
48
39
|
dialogMouseDown
|
|
49
40
|
} = this.getStates();
|
|
50
|
-
|
|
51
41
|
if (e.target === e.currentTarget && !dialogMouseDown) {
|
|
52
42
|
this.close(e);
|
|
53
43
|
}
|
|
54
44
|
}
|
|
55
|
-
|
|
56
45
|
close(e) {
|
|
57
46
|
this._adapter.notifyClose(e);
|
|
58
47
|
}
|
|
59
|
-
|
|
60
48
|
modalDialogFocus() {
|
|
61
49
|
this._adapter.modalDialogFocus();
|
|
62
50
|
}
|
|
63
|
-
|
|
64
51
|
modalDialogBlur() {
|
|
65
52
|
this._adapter.modalDialogBlur();
|
|
66
53
|
}
|
|
67
|
-
|
|
68
54
|
prevFocusElementReFocus() {
|
|
69
55
|
this._adapter.prevFocusElementReFocus();
|
|
70
56
|
}
|
|
71
|
-
|
|
72
57
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type OKType = 'primary' | 'secondary' | 'tertiary' | 'warning' | 'danger';
|
|
3
|
+
export type Size = 'small' | 'medium' | 'large' | 'full-width';
|
|
4
4
|
export interface ModalAdapter extends DefaultAdapter<ModalProps, ModalState> {
|
|
5
5
|
disabledBodyScroll: () => void;
|
|
6
6
|
enabledBodyScroll: () => void;
|
|
@@ -2,29 +2,24 @@ import BaseFoundation from '../base/foundation';
|
|
|
2
2
|
import isPromise from "../utils/isPromise";
|
|
3
3
|
export default class ModalFoundation extends BaseFoundation {
|
|
4
4
|
constructor(adapter) {
|
|
5
|
-
super(Object.assign({}, adapter));
|
|
5
|
+
super(Object.assign({}, adapter));
|
|
6
|
+
// afterClose() {
|
|
6
7
|
// this._adapter.notifyClose();
|
|
7
8
|
// }
|
|
8
|
-
|
|
9
9
|
this.toggleDisplayNone = (displayNone, callback) => {
|
|
10
10
|
this._adapter.toggleDisplayNone(displayNone, callback);
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
|
|
14
13
|
destroy() {
|
|
15
14
|
this.afterHide();
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
handleCancel(e) {
|
|
19
17
|
var _a;
|
|
20
|
-
|
|
21
18
|
const result = this._adapter.notifyCancel(e);
|
|
22
|
-
|
|
23
19
|
if (isPromise(result)) {
|
|
24
20
|
this._adapter.setState({
|
|
25
21
|
onCancelReturnPromiseStatus: "pending"
|
|
26
22
|
});
|
|
27
|
-
|
|
28
23
|
(_a = result === null || result === void 0 ? void 0 : result.then(() => {
|
|
29
24
|
this._adapter.setState({
|
|
30
25
|
onCancelReturnPromiseStatus: "fulfilled"
|
|
@@ -33,22 +28,17 @@ export default class ModalFoundation extends BaseFoundation {
|
|
|
33
28
|
this._adapter.setState({
|
|
34
29
|
onCancelReturnPromiseStatus: "rejected"
|
|
35
30
|
});
|
|
36
|
-
|
|
37
31
|
throw e;
|
|
38
32
|
});
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
|
-
|
|
42
35
|
handleOk(e) {
|
|
43
36
|
var _a;
|
|
44
|
-
|
|
45
37
|
const result = this._adapter.notifyOk(e);
|
|
46
|
-
|
|
47
38
|
if (isPromise(result)) {
|
|
48
39
|
this._adapter.setState({
|
|
49
40
|
onOKReturnPromiseStatus: "pending"
|
|
50
41
|
});
|
|
51
|
-
|
|
52
42
|
(_a = result === null || result === void 0 ? void 0 : result.then(() => {
|
|
53
43
|
this._adapter.setState({
|
|
54
44
|
onOKReturnPromiseStatus: "fulfilled"
|
|
@@ -57,20 +47,15 @@ export default class ModalFoundation extends BaseFoundation {
|
|
|
57
47
|
this._adapter.setState({
|
|
58
48
|
onOKReturnPromiseStatus: "rejected"
|
|
59
49
|
});
|
|
60
|
-
|
|
61
50
|
throw e;
|
|
62
51
|
});
|
|
63
52
|
}
|
|
64
53
|
}
|
|
65
|
-
|
|
66
54
|
beforeShow() {
|
|
67
55
|
this._adapter.disabledBodyScroll();
|
|
68
56
|
}
|
|
69
|
-
|
|
70
57
|
afterHide() {
|
|
71
58
|
this._adapter.enabledBodyScroll();
|
|
72
|
-
|
|
73
59
|
this._adapter.notifyClose();
|
|
74
60
|
}
|
|
75
|
-
|
|
76
61
|
}
|
|
@@ -6,7 +6,6 @@ export const DEFAULT_TOGGLE_ICON = {
|
|
|
6
6
|
export default class NavItem {
|
|
7
7
|
constructor() {
|
|
8
8
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9
|
-
|
|
10
9
|
// eslint-disable-next-line eqeqeq
|
|
11
10
|
if (options == null || typeof options !== 'object') {
|
|
12
11
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -22,14 +21,11 @@ export default class NavItem {
|
|
|
22
21
|
indent: false
|
|
23
22
|
};
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
for (const key of Object.keys(options)) {
|
|
27
25
|
this[key] = options[key];
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
if (options.items && Array.isArray(options.items) && options.items.length) {
|
|
31
28
|
this.items = options.items.map(item => new NavItem(item));
|
|
32
|
-
|
|
33
29
|
if ('toggleIcon' in options) {
|
|
34
30
|
this.toggleIcon = NavItem.isValidToggleIcon(options.toggleIcon) ? Object.assign({}, options.toggleIcon) : Object.assign({}, DEFAULT_TOGGLE_ICON);
|
|
35
31
|
} else {
|
|
@@ -39,9 +35,7 @@ export default class NavItem {
|
|
|
39
35
|
this.items = null;
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
|
-
|
|
43
38
|
static isValidToggleIcon(toggleIcon) {
|
|
44
39
|
return Boolean(toggleIcon && typeof toggleIcon === 'object' && typeof toggleIcon.open === 'string' && toggleIcon.open.length && typeof toggleIcon.closed === 'string' && toggleIcon.closed.length);
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _get from "lodash/get";
|
|
2
|
-
|
|
3
2
|
/* eslint-disable max-depth */
|
|
4
|
-
|
|
5
3
|
/* eslint-disable max-len */
|
|
6
4
|
import BaseFoundation from '../base/foundation';
|
|
7
5
|
import NavItem from './NavItem';
|
|
@@ -12,51 +10,40 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
12
10
|
super(Object.assign({}, adapter));
|
|
13
11
|
}
|
|
14
12
|
/* istanbul ignore next */
|
|
15
|
-
|
|
16
|
-
|
|
17
13
|
static getZeroParentKeys() {
|
|
18
14
|
let itemKeysMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
19
15
|
const willAddKeys = [];
|
|
20
|
-
|
|
21
16
|
for (var _len = arguments.length, itemKeys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
22
17
|
itemKeys[_key - 1] = arguments[_key];
|
|
23
18
|
}
|
|
24
|
-
|
|
25
19
|
if (itemKeys.length) {
|
|
26
20
|
for (const itemKey of itemKeys) {
|
|
27
21
|
if (Array.isArray(itemKeysMap[itemKey]) && itemKeysMap[itemKey].length) {
|
|
28
22
|
const levelZeroParentKey = itemKeysMap[itemKey][0];
|
|
29
|
-
|
|
30
23
|
if (!isNullOrUndefined(levelZeroParentKey)) {
|
|
31
24
|
willAddKeys.push(levelZeroParentKey);
|
|
32
25
|
}
|
|
33
26
|
}
|
|
34
27
|
}
|
|
35
28
|
}
|
|
36
|
-
|
|
37
29
|
return willAddKeys;
|
|
38
30
|
}
|
|
39
|
-
|
|
40
31
|
static buildItemKeysMap() {
|
|
41
32
|
let items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
42
33
|
let keysMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
43
34
|
let parentKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
44
35
|
let keyPropName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'itemKey';
|
|
45
|
-
|
|
46
36
|
if (Array.isArray(items) && items.length) {
|
|
47
37
|
for (const item of items) {
|
|
48
38
|
if (Array.isArray(item)) {
|
|
49
39
|
NavigationFoundation.buildItemKeysMap(item, keysMap, [...parentKeys], keyPropName);
|
|
50
40
|
} else {
|
|
51
41
|
let itemKey;
|
|
52
|
-
|
|
53
42
|
if (item && typeof item === 'object') {
|
|
54
43
|
itemKey = item[keyPropName] || item.props && item.props[keyPropName];
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
if (itemKey) {
|
|
58
46
|
keysMap[itemKey] = [...parentKeys];
|
|
59
|
-
|
|
60
47
|
if (Array.isArray(item.items) && item.items.length) {
|
|
61
48
|
NavigationFoundation.buildItemKeysMap(item.items, keysMap, [...parentKeys, itemKey], keyPropName);
|
|
62
49
|
} else if (item.props && item.props.children) {
|
|
@@ -67,7 +54,6 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
67
54
|
}
|
|
68
55
|
}
|
|
69
56
|
}
|
|
70
|
-
|
|
71
57
|
return keysMap;
|
|
72
58
|
}
|
|
73
59
|
/**
|
|
@@ -77,8 +63,6 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
77
63
|
* @param {*} lifecycle
|
|
78
64
|
* @returns
|
|
79
65
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
66
|
init(lifecycle) {
|
|
83
67
|
const {
|
|
84
68
|
defaultSelectedKeys,
|
|
@@ -92,7 +76,6 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
92
76
|
} = this.getCalcState();
|
|
93
77
|
const parentSelectKeys = this.selectLevelZeroParentKeys(itemKeysMap, willSelectedKeys);
|
|
94
78
|
willSelectedKeys = willSelectedKeys.concat(parentSelectKeys);
|
|
95
|
-
|
|
96
79
|
if (lifecycle === 'constructor') {
|
|
97
80
|
return {
|
|
98
81
|
selectedKeys: willSelectedKeys,
|
|
@@ -102,23 +85,16 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
102
85
|
};
|
|
103
86
|
} else {
|
|
104
87
|
this._adapter.updateSelectedKeys(willSelectedKeys);
|
|
105
|
-
|
|
106
88
|
this._adapter.setItemKeysMap(itemKeysMap);
|
|
107
|
-
|
|
108
89
|
this._adapter.updateOpenKeys(willOpenKeys);
|
|
109
|
-
|
|
110
90
|
this._adapter.updateItems(formattedItems);
|
|
111
|
-
|
|
112
91
|
this._adapter.setItemsChanged(true);
|
|
113
92
|
}
|
|
114
|
-
|
|
115
93
|
return undefined;
|
|
116
94
|
}
|
|
117
95
|
/**
|
|
118
96
|
* Get the state to be calculated
|
|
119
97
|
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
98
|
getCalcState() {
|
|
123
99
|
const {
|
|
124
100
|
itemKeysMap,
|
|
@@ -134,8 +110,6 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
134
110
|
/**
|
|
135
111
|
* Calculate formatted items and itemsKeyMap
|
|
136
112
|
*/
|
|
137
|
-
|
|
138
|
-
|
|
139
113
|
getFormattedItems() {
|
|
140
114
|
const {
|
|
141
115
|
items,
|
|
@@ -153,8 +127,6 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
153
127
|
* Calculate the keys that will need to be opened soon
|
|
154
128
|
* @param {*} itemKeysMap
|
|
155
129
|
*/
|
|
156
|
-
|
|
157
|
-
|
|
158
130
|
getWillOpenKeys(itemKeysMap) {
|
|
159
131
|
const {
|
|
160
132
|
defaultOpenKeys,
|
|
@@ -164,114 +136,84 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
164
136
|
mode
|
|
165
137
|
} = this.getProps();
|
|
166
138
|
let willOpenKeys = openKeys || defaultOpenKeys || [];
|
|
167
|
-
|
|
168
139
|
if (!(Array.isArray(defaultOpenKeys) || Array.isArray(openKeys)) && mode === strings.MODE_VERTICAL && (Array.isArray(defaultSelectedKeys) || Array.isArray(selectedKeys))) {
|
|
169
140
|
const currentSelectedKeys = Array.isArray(selectedKeys) ? selectedKeys : defaultSelectedKeys;
|
|
170
141
|
willOpenKeys = this.getShouldOpenKeys(itemKeysMap, currentSelectedKeys);
|
|
171
142
|
}
|
|
172
|
-
|
|
173
143
|
return [...willOpenKeys];
|
|
174
144
|
}
|
|
175
|
-
|
|
176
145
|
getShouldOpenKeys() {
|
|
177
146
|
let itemKeysMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
178
147
|
let selectedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
179
148
|
const willOpenKeySet = new Set();
|
|
180
|
-
|
|
181
149
|
if (Array.isArray(selectedKeys) && selectedKeys.length) {
|
|
182
150
|
selectedKeys.forEach(item => {
|
|
183
151
|
if (item) {
|
|
184
152
|
const parentKeys = _get(itemKeysMap, item);
|
|
185
|
-
|
|
186
153
|
if (Array.isArray(parentKeys)) {
|
|
187
154
|
parentKeys.forEach(k => willOpenKeySet.add(k));
|
|
188
155
|
}
|
|
189
156
|
}
|
|
190
157
|
});
|
|
191
158
|
}
|
|
192
|
-
|
|
193
159
|
return [...willOpenKeySet];
|
|
194
160
|
}
|
|
195
|
-
|
|
196
161
|
destroy() {} // eslint-disable-line
|
|
197
|
-
|
|
198
|
-
|
|
199
162
|
selectLevelZeroParentKeys(itemKeysMap) {
|
|
200
|
-
const _itemKeysMap = isNullOrUndefined(itemKeysMap) ? this.getState('itemKeysMap') : itemKeysMap;
|
|
201
|
-
|
|
202
|
-
|
|
163
|
+
const _itemKeysMap = isNullOrUndefined(itemKeysMap) ? this.getState('itemKeysMap') : itemKeysMap;
|
|
164
|
+
// console.log(itemKeysMap);
|
|
203
165
|
const willAddKeys = [];
|
|
204
|
-
|
|
205
166
|
for (var _len2 = arguments.length, itemKeys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
206
167
|
itemKeys[_key2 - 1] = arguments[_key2];
|
|
207
168
|
}
|
|
208
|
-
|
|
209
169
|
if (itemKeys.length) {
|
|
210
170
|
for (const itemKey of itemKeys) {
|
|
211
171
|
if (Array.isArray(_itemKeysMap[itemKey]) && _itemKeysMap[itemKey].length) {
|
|
212
172
|
const levelZeroParentKey = _itemKeysMap[itemKey][0];
|
|
213
|
-
|
|
214
173
|
if (!isNullOrUndefined(levelZeroParentKey)) {
|
|
215
174
|
willAddKeys.push(levelZeroParentKey);
|
|
216
175
|
}
|
|
217
176
|
}
|
|
218
177
|
}
|
|
219
178
|
}
|
|
220
|
-
|
|
221
179
|
if (willAddKeys.length) {
|
|
222
180
|
return willAddKeys;
|
|
223
181
|
}
|
|
224
|
-
|
|
225
182
|
return [];
|
|
226
183
|
}
|
|
227
|
-
|
|
228
184
|
formatItems() {
|
|
229
185
|
let items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
230
186
|
const formattedItems = [];
|
|
231
|
-
|
|
232
187
|
for (const item of items) {
|
|
233
188
|
formattedItems.push(new NavItem(item));
|
|
234
189
|
}
|
|
235
|
-
|
|
236
190
|
return formattedItems;
|
|
237
191
|
}
|
|
238
|
-
|
|
239
192
|
handleSelect(data) {
|
|
240
193
|
this._adapter.notifySelect(data);
|
|
241
194
|
}
|
|
242
195
|
/* istanbul ignore next */
|
|
243
|
-
|
|
244
|
-
|
|
245
196
|
judgeIfOpen(openKeys, items) {
|
|
246
197
|
let shouldBeOpen = false;
|
|
247
|
-
|
|
248
198
|
const _openKeys = Array.isArray(openKeys) ? openKeys : openKeys && [openKeys];
|
|
249
|
-
|
|
250
199
|
if (_openKeys && Array.isArray(items) && items.length) {
|
|
251
200
|
for (const item of items) {
|
|
252
201
|
shouldBeOpen = _openKeys.includes(item.itemKey) || this.judgeIfOpen(_openKeys, item.items);
|
|
253
|
-
|
|
254
202
|
if (shouldBeOpen) {
|
|
255
203
|
break;
|
|
256
204
|
}
|
|
257
205
|
}
|
|
258
206
|
}
|
|
259
|
-
|
|
260
207
|
return shouldBeOpen;
|
|
261
208
|
}
|
|
262
|
-
|
|
263
209
|
handleCollapseChange() {
|
|
264
210
|
const isCollapsed = !this.getState('isCollapsed');
|
|
265
|
-
|
|
266
211
|
if (!this._isControlledComponent('isCollapsed')) {
|
|
267
212
|
this._adapter.setIsCollapsed(isCollapsed);
|
|
268
213
|
}
|
|
269
|
-
|
|
270
214
|
this._adapter.notifyCollapseChange(isCollapsed);
|
|
271
215
|
}
|
|
272
|
-
|
|
273
216
|
handleItemsChange(isChanged) {
|
|
274
217
|
this._adapter.setItemsChanged(isChanged);
|
|
275
218
|
}
|
|
276
|
-
|
|
277
219
|
}
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import _get from "lodash/get";
|
|
2
|
+
/* argus-disable unPkgSensitiveInfo */
|
|
2
3
|
import BaseFoundation from '../base/foundation';
|
|
3
4
|
import isEnterPress from '../utils/isEnterPress';
|
|
4
5
|
export default class ItemFoundation extends BaseFoundation {
|
|
5
6
|
constructor(adapter) {
|
|
6
7
|
super(Object.assign({}, adapter));
|
|
7
8
|
}
|
|
8
|
-
|
|
9
9
|
init() {
|
|
10
10
|
this._timer = null;
|
|
11
11
|
this._mounted = true;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
13
|
destroy() {
|
|
15
14
|
this._mounted = false;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
isValidKey(itemKey) {
|
|
19
17
|
// eslint-disable-next-line eqeqeq
|
|
20
18
|
return itemKey != null && (typeof itemKey === 'string' || typeof itemKey === 'number');
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
handleClick(e) {
|
|
24
21
|
const {
|
|
25
22
|
isSubNav,
|
|
@@ -27,22 +24,18 @@ export default class ItemFoundation extends BaseFoundation {
|
|
|
27
24
|
text,
|
|
28
25
|
disabled
|
|
29
26
|
} = this.getProps();
|
|
30
|
-
|
|
31
27
|
if (disabled) {
|
|
32
28
|
return;
|
|
33
29
|
}
|
|
34
|
-
|
|
35
30
|
if (!isSubNav && this.isValidKey(itemKey) && !this._adapter.getSelectedKeysIsControlled() && !this._adapter.getSelected()) {
|
|
36
31
|
this._adapter.updateSelected(true);
|
|
37
32
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
const selectedKeys = [itemKey];
|
|
34
|
+
// If the current item is subNav, there is no need to trigger the global onSelect/onClick event, instead, the SubNav component will trigger the click event
|
|
41
35
|
if (!isSubNav) {
|
|
42
36
|
if (!this._adapter.getSelected()) {
|
|
43
37
|
// internal-issues:51
|
|
44
38
|
const selectedItems = [this._adapter.cloneDeep(this.getProps())];
|
|
45
|
-
|
|
46
39
|
this._adapter.notifyGlobalOnSelect({
|
|
47
40
|
itemKey,
|
|
48
41
|
selectedKeys,
|
|
@@ -50,14 +43,12 @@ export default class ItemFoundation extends BaseFoundation {
|
|
|
50
43
|
domEvent: e
|
|
51
44
|
});
|
|
52
45
|
}
|
|
53
|
-
|
|
54
46
|
this._adapter.notifyGlobalOnClick({
|
|
55
47
|
itemKey,
|
|
56
48
|
text,
|
|
57
49
|
domEvent: e
|
|
58
50
|
});
|
|
59
51
|
}
|
|
60
|
-
|
|
61
52
|
this._adapter.notifyClick({
|
|
62
53
|
itemKey,
|
|
63
54
|
text,
|
|
@@ -67,23 +58,17 @@ export default class ItemFoundation extends BaseFoundation {
|
|
|
67
58
|
/**
|
|
68
59
|
* A11y: simulate item click
|
|
69
60
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
61
|
handleKeyPress(e) {
|
|
73
62
|
if (isEnterPress(e)) {
|
|
74
63
|
const {
|
|
75
64
|
link,
|
|
76
65
|
linkOptions
|
|
77
66
|
} = this.getProps();
|
|
78
|
-
|
|
79
67
|
const target = _get(linkOptions, 'target', '_self');
|
|
80
|
-
|
|
81
68
|
this.handleClick(e);
|
|
82
|
-
|
|
83
69
|
if (typeof link === 'string') {
|
|
84
70
|
target === '_blank' ? window.open(link) : window.location.href = link;
|
|
85
71
|
}
|
|
86
72
|
}
|
|
87
73
|
}
|
|
88
|
-
|
|
89
74
|
}
|
|
@@ -1,72 +1,54 @@
|
|
|
1
1
|
import BaseFoundation from '../base/foundation';
|
|
2
2
|
import isEnterPress from '../utils/isEnterPress';
|
|
3
|
-
|
|
4
3
|
const addKeys = function addKeys() {
|
|
5
4
|
let originKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6
5
|
const keySet = new Set(originKeys);
|
|
7
|
-
|
|
8
6
|
for (var _len = arguments.length, willAddKeys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
9
7
|
willAddKeys[_key - 1] = arguments[_key];
|
|
10
8
|
}
|
|
11
|
-
|
|
12
9
|
willAddKeys.forEach(key => key && keySet.add(key));
|
|
13
10
|
return Array.from(keySet);
|
|
14
11
|
};
|
|
15
|
-
|
|
16
12
|
const removeKeys = function removeKeys() {
|
|
17
13
|
let originKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
18
14
|
const keySet = new Set(originKeys);
|
|
19
|
-
|
|
20
15
|
for (var _len2 = arguments.length, willRemoveKeys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
21
16
|
willRemoveKeys[_key2 - 1] = arguments[_key2];
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
willRemoveKeys.forEach(key => key && keySet.delete(key));
|
|
25
19
|
return Array.from(keySet);
|
|
26
20
|
};
|
|
27
|
-
|
|
28
21
|
export default class SubNavFoundation extends BaseFoundation {
|
|
29
22
|
constructor(adapter) {
|
|
30
23
|
super(Object.assign({}, adapter));
|
|
31
24
|
}
|
|
32
|
-
|
|
33
25
|
init() {
|
|
34
26
|
// this.log('invoke SubNavFoundation init()');
|
|
35
27
|
this._timer = null;
|
|
36
28
|
}
|
|
37
|
-
|
|
38
29
|
destroy() {} // eslint-disable-line
|
|
39
|
-
|
|
40
|
-
|
|
41
30
|
clearDelayTimer() {
|
|
42
31
|
if (this._timer) {
|
|
43
32
|
clearTimeout(this._timer);
|
|
44
33
|
this._timer = null;
|
|
45
34
|
}
|
|
46
35
|
}
|
|
47
|
-
|
|
48
36
|
isValidKey(itemKey) {
|
|
49
37
|
// eslint-disable-next-line eqeqeq
|
|
50
38
|
return itemKey != null && (typeof itemKey === 'number' || typeof itemKey === 'string');
|
|
51
39
|
}
|
|
52
|
-
|
|
53
40
|
handleDropdownVisibleChange(visible) {
|
|
54
41
|
const itemKey = this.getProp('itemKey');
|
|
55
|
-
|
|
56
42
|
const openKeysIsControlled = this._adapter.getOpenKeysIsControlled();
|
|
57
|
-
|
|
58
43
|
const canUpdateOpenKeys = this._adapter.getCanUpdateOpenKeys();
|
|
59
|
-
|
|
60
44
|
const rawOpenKeys = this._adapter.getOpenKeys();
|
|
61
|
-
|
|
62
45
|
const openKeys = visible ? addKeys(rawOpenKeys, itemKey) : removeKeys(rawOpenKeys, itemKey);
|
|
63
46
|
this.clearDelayTimer();
|
|
64
|
-
|
|
65
47
|
if (!openKeysIsControlled) {
|
|
66
48
|
if (canUpdateOpenKeys) {
|
|
67
49
|
this._adapter.updateOpen(visible);
|
|
68
|
-
}
|
|
69
|
-
|
|
50
|
+
}
|
|
51
|
+
// this._adapter.updateIsHovered(visible);
|
|
70
52
|
}
|
|
71
53
|
|
|
72
54
|
this._adapter.notifyGlobalOpenChange({
|
|
@@ -80,28 +62,22 @@ export default class SubNavFoundation extends BaseFoundation {
|
|
|
80
62
|
* @param {Event} e
|
|
81
63
|
* @param {HTMLElement} titleRef
|
|
82
64
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
65
|
handleClick(e, titleRef) {
|
|
86
66
|
const {
|
|
87
67
|
itemKey,
|
|
88
68
|
disabled
|
|
89
69
|
} = this.getProps();
|
|
90
|
-
|
|
91
70
|
if (disabled) {
|
|
92
71
|
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
72
|
+
}
|
|
73
|
+
// this.log(e, titleRef, titleRef.contains(e.target));
|
|
96
74
|
const clickedDomIsTitle = titleRef && titleRef.contains(e.target);
|
|
97
75
|
let isOpen = Boolean(this._adapter.getIsOpen());
|
|
98
|
-
|
|
99
76
|
if (!clickedDomIsTitle) {
|
|
100
77
|
isOpen = false;
|
|
101
78
|
} else {
|
|
102
79
|
isOpen = !isOpen;
|
|
103
80
|
}
|
|
104
|
-
|
|
105
81
|
const openKeys = isOpen ? addKeys(this._adapter.getOpenKeys(), itemKey) : removeKeys(this._adapter.getOpenKeys(), itemKey);
|
|
106
82
|
const cbVal = {
|
|
107
83
|
itemKey,
|
|
@@ -109,17 +85,12 @@ export default class SubNavFoundation extends BaseFoundation {
|
|
|
109
85
|
isOpen,
|
|
110
86
|
domEvent: e
|
|
111
87
|
};
|
|
112
|
-
|
|
113
88
|
const openKeysIsControlled = this._adapter.getOpenKeysIsControlled();
|
|
114
|
-
|
|
115
89
|
const canUpdateOpenKeys = this._adapter.getCanUpdateOpenKeys();
|
|
116
|
-
|
|
117
90
|
if (!openKeysIsControlled && canUpdateOpenKeys) {
|
|
118
91
|
this._adapter.updateOpen(isOpen);
|
|
119
92
|
}
|
|
120
|
-
|
|
121
93
|
this._adapter.notifyGlobalOpenChange(cbVal);
|
|
122
|
-
|
|
123
94
|
this._adapter.notifyGlobalOnClick(cbVal);
|
|
124
95
|
}
|
|
125
96
|
/**
|
|
@@ -127,12 +98,9 @@ export default class SubNavFoundation extends BaseFoundation {
|
|
|
127
98
|
* @param e
|
|
128
99
|
* @param titleRef
|
|
129
100
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
101
|
handleKeyPress(e, titleRef) {
|
|
133
102
|
if (isEnterPress(e)) {
|
|
134
103
|
this.handleClick(e, titleRef);
|
|
135
104
|
}
|
|
136
105
|
}
|
|
137
|
-
|
|
138
106
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
2
|
import { strings } from '../notification/constants';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type NoticePosition = 'top' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
4
|
+
export type NoticeType = 'warning' | 'success' | 'info' | 'error' | 'default';
|
|
5
|
+
export type NoticeTheme = 'light' | 'normal';
|
|
6
6
|
export interface NoticeProps {
|
|
7
7
|
duration?: number;
|
|
8
8
|
id?: string | number;
|