@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
|
@@ -12,36 +12,30 @@ import BaseFoundation from '../base/foundation';
|
|
|
12
12
|
import { filter, findAncestorKeys, calcCheckedKeysForUnchecked, calcCheckedKeysForChecked, calcCheckedKeys, findDescendantKeys, normalizeKeyList } from '../tree/treeUtil';
|
|
13
13
|
import { convertDataToEntities, findKeysForValues, normalizedArr, isValid, calcMergeType } from './util';
|
|
14
14
|
import { strings } from './constants';
|
|
15
|
-
import isEnterPress from '../utils/isEnterPress';
|
|
16
|
-
|
|
15
|
+
import isEnterPress from '../utils/isEnterPress';
|
|
16
|
+
// eslint-disable-next-line max-len
|
|
17
17
|
export default class CascaderFoundation extends BaseFoundation {
|
|
18
18
|
constructor(adapter) {
|
|
19
19
|
super(Object.assign({}, adapter));
|
|
20
|
-
|
|
21
20
|
this.updateSearching = isSearching => {
|
|
22
21
|
this._adapter.updateStates({
|
|
23
22
|
isSearching: false
|
|
24
23
|
});
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
init() {
|
|
29
27
|
const isOpen = this.getProp('open') || this.getProp('defaultOpen');
|
|
30
28
|
this.collectOptions(true);
|
|
31
|
-
|
|
32
29
|
if (isOpen && !this._isDisabled()) {
|
|
33
30
|
this.open();
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
|
-
|
|
37
33
|
destroy() {
|
|
38
34
|
this._adapter.unregisterClickOutsideHandler();
|
|
39
35
|
}
|
|
40
|
-
|
|
41
36
|
_isDisabled() {
|
|
42
37
|
return this.getProp('disabled');
|
|
43
38
|
}
|
|
44
|
-
|
|
45
39
|
_isFilterable() {
|
|
46
40
|
return Boolean(this.getProp('filterTreeNode')); // filter can be boolean or function
|
|
47
41
|
}
|
|
@@ -52,78 +46,65 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
52
46
|
multiple
|
|
53
47
|
} = this.getProps();
|
|
54
48
|
const valueProp = onChangeWithObject ? [] : 'value';
|
|
55
|
-
|
|
56
49
|
if (multiple) {
|
|
57
|
-
const valuePath = [];
|
|
50
|
+
const valuePath = [];
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
58
52
|
// @ts-ignore
|
|
59
|
-
|
|
60
53
|
item.forEach(checkedKey => {
|
|
61
54
|
const valuePathItem = this.getItemPropPath(checkedKey, valueProp);
|
|
62
55
|
valuePath.push(valuePathItem);
|
|
63
56
|
});
|
|
64
|
-
|
|
65
57
|
this._adapter.notifyChange(valuePath);
|
|
66
58
|
} else {
|
|
67
59
|
const valuePath = _isUndefined(item) || !('key' in item) ? [] : this.getItemPropPath(item.key, valueProp);
|
|
68
|
-
|
|
69
60
|
this._adapter.notifyChange(valuePath);
|
|
70
61
|
}
|
|
71
62
|
}
|
|
72
|
-
|
|
73
63
|
_isLeaf(item) {
|
|
74
64
|
if (this.getProp('loadData')) {
|
|
75
65
|
return Boolean(item.isLeaf);
|
|
76
66
|
}
|
|
77
|
-
|
|
78
67
|
return !item.children || !item.children.length;
|
|
79
68
|
}
|
|
80
|
-
|
|
81
69
|
_clearInput() {
|
|
82
70
|
this._adapter.updateInputValue('');
|
|
83
|
-
}
|
|
71
|
+
}
|
|
72
|
+
// Scenes that may trigger blur:
|
|
84
73
|
// 1、clickOutSide
|
|
85
|
-
|
|
86
|
-
|
|
87
74
|
_notifyBlur(e) {
|
|
88
75
|
this._adapter.notifyBlur(e);
|
|
89
|
-
}
|
|
76
|
+
}
|
|
77
|
+
// Scenes that may trigger focus:
|
|
90
78
|
// 1、click selection
|
|
91
|
-
|
|
92
|
-
|
|
93
79
|
_notifyFocus(e) {
|
|
94
80
|
this._adapter.notifyFocus(e);
|
|
95
81
|
}
|
|
96
|
-
|
|
97
82
|
_isOptionDisabled(key, keyEntities) {
|
|
98
83
|
const isDisabled = findAncestorKeys([key], keyEntities, true).some(item => keyEntities[item].data.disabled);
|
|
99
84
|
return isDisabled;
|
|
100
85
|
}
|
|
101
|
-
|
|
102
86
|
getCopyFromState(items) {
|
|
103
87
|
const res = {};
|
|
104
88
|
normalizedArr(items).forEach(key => {
|
|
105
89
|
res[key] = _cloneDeep(this.getState(key));
|
|
106
90
|
});
|
|
107
91
|
return res;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
92
|
+
}
|
|
93
|
+
// prop: is array, return all data
|
|
111
94
|
getItemPropPath(selectedKey, prop, keyEntities) {
|
|
112
95
|
const searchMap = keyEntities || this.getState('keyEntities');
|
|
113
96
|
const selectedItem = searchMap[selectedKey];
|
|
114
97
|
let path = [];
|
|
115
|
-
|
|
116
|
-
|
|
98
|
+
if (!selectedItem) {
|
|
99
|
+
// do nothing
|
|
117
100
|
} else if (selectedItem._notExist) {
|
|
118
101
|
path = selectedItem.path;
|
|
119
102
|
} else {
|
|
120
103
|
const keyPath = selectedItem.path;
|
|
121
104
|
path = Array.isArray(prop) ? keyPath.map(key => searchMap[key].data) : keyPath.map(key => searchMap[key].data[prop]);
|
|
122
105
|
}
|
|
123
|
-
|
|
124
106
|
return path;
|
|
125
107
|
}
|
|
126
|
-
|
|
127
108
|
_getCacheValue(keyEntities) {
|
|
128
109
|
const {
|
|
129
110
|
selectedKeys
|
|
@@ -131,13 +112,12 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
131
112
|
const selectedKey = Array.from(selectedKeys)[0];
|
|
132
113
|
let cacheValue;
|
|
133
114
|
/* selectedKeys does not match keyEntities */
|
|
134
|
-
|
|
135
115
|
if (_isEmpty(keyEntities[selectedKey])) {
|
|
136
116
|
if (_includes(selectedKey, 'not-exist-')) {
|
|
137
117
|
/* Get the value behind not-exist- */
|
|
138
118
|
// eslint-disable-next-line prefer-destructuring
|
|
139
|
-
const targetValue = selectedKey.match(/not-exist-(\S*)/)[1];
|
|
140
|
-
|
|
119
|
+
const targetValue = selectedKey.match(/not-exist-(\S*)/)[1];
|
|
120
|
+
// eslint-disable-next-line max-depth
|
|
141
121
|
if (_isEmpty(keyEntities[targetValue])) {
|
|
142
122
|
cacheValue = targetValue;
|
|
143
123
|
} else {
|
|
@@ -149,7 +129,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
149
129
|
* 中存在,则 selectedKeys=Set('0-0'),此时输入框显示 0-0 的 label。 这个地
|
|
150
130
|
* 方做的操作就是,为了例子中第二次更新后 0-0 label 能够正常显示。
|
|
151
131
|
*/
|
|
152
|
-
|
|
153
132
|
/**
|
|
154
133
|
* The typical scenario is: suppose we select the 0-0 node, at this time
|
|
155
134
|
* selectedKeys=Set('0-0'), the input box will display a 0-0 label. When
|
|
@@ -167,15 +146,12 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
167
146
|
cacheValue = selectedKey;
|
|
168
147
|
}
|
|
169
148
|
/* selectedKeys match keyEntities */
|
|
170
|
-
|
|
171
149
|
} else {
|
|
172
150
|
/* selectedKeys match keyEntities */
|
|
173
151
|
cacheValue = keyEntities[selectedKey].valuePath;
|
|
174
152
|
}
|
|
175
|
-
|
|
176
153
|
return cacheValue;
|
|
177
154
|
}
|
|
178
|
-
|
|
179
155
|
collectOptions() {
|
|
180
156
|
let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
181
157
|
const {
|
|
@@ -184,20 +160,15 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
184
160
|
defaultValue
|
|
185
161
|
} = this.getProps();
|
|
186
162
|
const keyEntities = convertDataToEntities(treeData);
|
|
187
|
-
|
|
188
163
|
this._adapter.rePositionDropdown();
|
|
189
|
-
|
|
190
164
|
let cacheValue;
|
|
191
165
|
/* when mount */
|
|
192
|
-
|
|
193
166
|
if (init) {
|
|
194
167
|
cacheValue = defaultValue;
|
|
195
168
|
} else if (!_isEmpty(keyEntities)) {
|
|
196
169
|
cacheValue = this._getCacheValue(keyEntities);
|
|
197
170
|
}
|
|
198
|
-
|
|
199
171
|
const selectedValue = !this._isControlledComponent() ? cacheValue : value;
|
|
200
|
-
|
|
201
172
|
if (isValid(selectedValue)) {
|
|
202
173
|
this.updateSelectedKey(selectedValue, keyEntities);
|
|
203
174
|
} else {
|
|
@@ -205,9 +176,8 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
205
176
|
keyEntities
|
|
206
177
|
});
|
|
207
178
|
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
179
|
+
}
|
|
180
|
+
// call when props.value change
|
|
211
181
|
handleValueChange(value) {
|
|
212
182
|
const {
|
|
213
183
|
keyEntities
|
|
@@ -221,8 +191,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
221
191
|
* When single selection, the clear objects of
|
|
222
192
|
* selectedKeys, activeKeys, filteredKeys, input, etc.
|
|
223
193
|
*/
|
|
224
|
-
|
|
225
|
-
|
|
226
194
|
_getClearSelectedKey(filterable) {
|
|
227
195
|
const updateStates = {};
|
|
228
196
|
const {
|
|
@@ -233,15 +201,12 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
233
201
|
updateStates.selectedKeys = new Set([]);
|
|
234
202
|
updateStates.activeKeys = new Set([]);
|
|
235
203
|
updateStates.filteredKeys = new Set([]);
|
|
236
|
-
|
|
237
204
|
if (filterable && !multiple) {
|
|
238
205
|
updateStates.inputPlaceHolder = searchPlaceholder || placeholder || '';
|
|
239
206
|
updateStates.inputValue = '';
|
|
240
207
|
}
|
|
241
|
-
|
|
242
208
|
return updateStates;
|
|
243
209
|
}
|
|
244
|
-
|
|
245
210
|
updateSelectedKey(value, keyEntities) {
|
|
246
211
|
const {
|
|
247
212
|
changeOnSelect,
|
|
@@ -255,14 +220,11 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
255
220
|
keyEntities: keyEntityState,
|
|
256
221
|
selectedKeys: selectedKeysState
|
|
257
222
|
} = this.getStates();
|
|
258
|
-
|
|
259
223
|
const filterable = this._isFilterable();
|
|
260
|
-
|
|
261
224
|
const loadingActive = [...activeKeys].filter(i => loadingKeys.has(i));
|
|
262
225
|
const valuePath = onChangeWithObject ? normalizedArr(value).map(i => i.value) : normalizedArr(value);
|
|
263
226
|
const selectedKeys = findKeysForValues(valuePath, keyEntities);
|
|
264
227
|
let updateStates = {};
|
|
265
|
-
|
|
266
228
|
if (selectedKeys.length) {
|
|
267
229
|
const selectedKey = selectedKeys[0];
|
|
268
230
|
const selectedItem = keyEntities[selectedKey];
|
|
@@ -270,14 +232,11 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
270
232
|
* When changeOnSelect is turned on, or the target option is a leaf option,
|
|
271
233
|
* the option is considered to be selected, even if the option is disabled
|
|
272
234
|
*/
|
|
273
|
-
|
|
274
235
|
if (changeOnSelect || this._isLeaf(selectedItem.data)) {
|
|
275
236
|
updateStates.selectedKeys = new Set([selectedKey]);
|
|
276
|
-
|
|
277
237
|
if (!loadingActive.length) {
|
|
278
238
|
updateStates.activeKeys = new Set(selectedItem.path);
|
|
279
239
|
}
|
|
280
|
-
|
|
281
240
|
if (filterable && !multiple) {
|
|
282
241
|
const displayText = this.renderDisplayText(selectedKey, keyEntities);
|
|
283
242
|
updateStates.inputPlaceHolder = displayText;
|
|
@@ -297,7 +256,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
297
256
|
* is a non-leaf node. At this point, selectedKeys should
|
|
298
257
|
* be cleared.
|
|
299
258
|
*/
|
|
300
|
-
|
|
301
259
|
} else if (_isEqual(selectedKeys, Array.from(selectedKeysState))) {
|
|
302
260
|
updateStates = this._getClearSelectedKey(filterable);
|
|
303
261
|
}
|
|
@@ -314,10 +272,8 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
314
272
|
_notExist: true
|
|
315
273
|
};
|
|
316
274
|
updateStates.selectedKeys = new Set([key]);
|
|
317
|
-
|
|
318
275
|
if (filterable && !multiple) {
|
|
319
276
|
const displayText = this._defaultRenderText(valuePath);
|
|
320
|
-
|
|
321
277
|
updateStates.inputPlaceHolder = displayText;
|
|
322
278
|
/*
|
|
323
279
|
* displayText should not be assign to inputValue,
|
|
@@ -326,48 +282,36 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
326
282
|
// updateStates.inputValue = displayText;
|
|
327
283
|
}
|
|
328
284
|
|
|
329
|
-
keyEntities[key] = optionNotExist;
|
|
285
|
+
keyEntities[key] = optionNotExist;
|
|
286
|
+
// Fix: 1155, if the data is loaded asynchronously to update treeData, the emptying operation should not be done when entering the updateSelectedKey method
|
|
330
287
|
} else if (loading) {
|
|
331
288
|
// Use assign to avoid overwriting the'not-exist- * 'property of keyEntities after asynchronous loading
|
|
332
289
|
// Overwriting'not-exist- * 'will cause selectionContent to be emptied unexpectedly when clicking on a dropDown item
|
|
333
290
|
updateStates.keyEntities = _assign(keyEntityState, keyEntities);
|
|
334
|
-
|
|
335
291
|
this._adapter.updateStates(updateStates);
|
|
336
|
-
|
|
337
292
|
return;
|
|
338
293
|
} else {
|
|
339
294
|
updateStates = this._getClearSelectedKey(filterable);
|
|
340
295
|
}
|
|
341
|
-
|
|
342
296
|
updateStates.keyEntities = keyEntities;
|
|
343
|
-
|
|
344
297
|
this._adapter.updateStates(updateStates);
|
|
345
298
|
}
|
|
346
|
-
|
|
347
299
|
open() {
|
|
348
300
|
const filterable = this._isFilterable();
|
|
349
|
-
|
|
350
301
|
const {
|
|
351
302
|
multiple
|
|
352
303
|
} = this.getProps();
|
|
353
|
-
|
|
354
304
|
this._adapter.openMenu();
|
|
355
|
-
|
|
356
305
|
if (filterable) {
|
|
357
306
|
this._clearInput();
|
|
358
|
-
|
|
359
307
|
!multiple && this.toggle2SearchInput(true);
|
|
360
308
|
}
|
|
361
|
-
|
|
362
309
|
if (this._isControlledComponent()) {
|
|
363
310
|
this.reCalcActiveKeys();
|
|
364
311
|
}
|
|
365
|
-
|
|
366
312
|
this._adapter.notifyDropdownVisibleChange(true);
|
|
367
|
-
|
|
368
313
|
this._adapter.registerClickOutsideHandler(e => this.close(e));
|
|
369
314
|
}
|
|
370
|
-
|
|
371
315
|
reCalcActiveKeys() {
|
|
372
316
|
const {
|
|
373
317
|
selectedKeys,
|
|
@@ -376,79 +320,60 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
376
320
|
} = this.getStates();
|
|
377
321
|
const selectedKey = [...selectedKeys][0];
|
|
378
322
|
const selectedItem = keyEntities[selectedKey];
|
|
379
|
-
|
|
380
323
|
if (!selectedItem) {
|
|
381
324
|
return;
|
|
382
325
|
}
|
|
383
|
-
|
|
384
326
|
const newActiveKeys = new Set(selectedItem.path);
|
|
385
|
-
|
|
386
327
|
if (!_isEqual(newActiveKeys, activeKeys)) {
|
|
387
328
|
this._adapter.updateStates({
|
|
388
329
|
activeKeys: newActiveKeys
|
|
389
330
|
});
|
|
390
331
|
}
|
|
391
332
|
}
|
|
392
|
-
|
|
393
333
|
close(e, key) {
|
|
394
334
|
const {
|
|
395
335
|
multiple
|
|
396
336
|
} = this.getProps();
|
|
397
|
-
|
|
398
337
|
this._adapter.closeMenu();
|
|
399
|
-
|
|
400
338
|
this._adapter.notifyDropdownVisibleChange(false);
|
|
401
|
-
|
|
402
339
|
this._adapter.unregisterClickOutsideHandler();
|
|
403
|
-
|
|
404
340
|
if (this._isFilterable()) {
|
|
405
341
|
const {
|
|
406
342
|
selectedKeys,
|
|
407
343
|
isSearching
|
|
408
344
|
} = this.getStates();
|
|
409
345
|
let inputValue = '';
|
|
410
|
-
|
|
411
346
|
if (key && !multiple) {
|
|
412
347
|
inputValue = this.renderDisplayText(key);
|
|
413
348
|
} else if (selectedKeys.size && !multiple) {
|
|
414
349
|
inputValue = this.renderDisplayText([...selectedKeys][0]);
|
|
415
350
|
}
|
|
416
|
-
|
|
417
351
|
this._adapter.updateStates({
|
|
418
352
|
inputValue
|
|
419
353
|
});
|
|
420
|
-
|
|
421
354
|
!multiple && this.toggle2SearchInput(false);
|
|
422
355
|
!multiple && this._adapter.updateFocusState(false);
|
|
423
356
|
}
|
|
424
|
-
|
|
425
357
|
this._notifyBlur(e);
|
|
426
358
|
}
|
|
427
|
-
|
|
428
359
|
focus() {
|
|
429
360
|
const {
|
|
430
361
|
filterTreeNode
|
|
431
362
|
} = this.getProps();
|
|
432
|
-
|
|
433
363
|
if (filterTreeNode) {
|
|
434
364
|
this._adapter.focusInput();
|
|
435
365
|
}
|
|
436
|
-
|
|
437
366
|
this._adapter.updateFocusState(true);
|
|
438
367
|
}
|
|
439
|
-
|
|
440
368
|
blur() {
|
|
441
369
|
const {
|
|
442
370
|
filterTreeNode
|
|
443
371
|
} = this.getProps();
|
|
444
|
-
|
|
445
372
|
if (filterTreeNode) {
|
|
446
373
|
this._adapter.blurInput();
|
|
447
374
|
}
|
|
448
|
-
|
|
449
375
|
this._adapter.updateFocusState(false);
|
|
450
376
|
}
|
|
451
|
-
|
|
452
377
|
toggle2SearchInput(isShow) {
|
|
453
378
|
if (isShow) {
|
|
454
379
|
this._adapter.toggleInputShow(isShow, () => this.focus());
|
|
@@ -456,29 +381,21 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
456
381
|
this._adapter.toggleInputShow(isShow, () => undefined);
|
|
457
382
|
}
|
|
458
383
|
}
|
|
459
|
-
|
|
460
384
|
handleItemClick(e, item) {
|
|
461
385
|
const isDisabled = this._isDisabled();
|
|
462
|
-
|
|
463
386
|
if (isDisabled) {
|
|
464
387
|
return;
|
|
465
388
|
}
|
|
466
|
-
|
|
467
389
|
this.handleSingleSelect(e, item);
|
|
468
|
-
|
|
469
390
|
this._adapter.rePositionDropdown();
|
|
470
391
|
}
|
|
471
|
-
|
|
472
392
|
handleItemHover(e, item) {
|
|
473
393
|
const isDisabled = this._isDisabled();
|
|
474
|
-
|
|
475
394
|
if (isDisabled) {
|
|
476
395
|
return;
|
|
477
396
|
}
|
|
478
|
-
|
|
479
397
|
this.handleShowNextByHover(item);
|
|
480
398
|
}
|
|
481
|
-
|
|
482
399
|
handleShowNextByHover(item) {
|
|
483
400
|
const {
|
|
484
401
|
keyEntities
|
|
@@ -487,46 +404,33 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
487
404
|
data,
|
|
488
405
|
key
|
|
489
406
|
} = item;
|
|
490
|
-
|
|
491
407
|
const isLeaf = this._isLeaf(data);
|
|
492
|
-
|
|
493
408
|
const activeKeys = keyEntities[key].path;
|
|
494
|
-
|
|
495
409
|
this._adapter.updateStates({
|
|
496
410
|
activeKeys: new Set(activeKeys)
|
|
497
411
|
});
|
|
498
|
-
|
|
499
412
|
if (!isLeaf) {
|
|
500
413
|
this.notifyIfLoadData(item);
|
|
501
414
|
}
|
|
502
415
|
}
|
|
503
|
-
|
|
504
416
|
onItemCheckboxClick(item) {
|
|
505
417
|
const isDisabled = this._isDisabled();
|
|
506
|
-
|
|
507
418
|
if (isDisabled) {
|
|
508
419
|
return;
|
|
509
420
|
}
|
|
510
|
-
|
|
511
421
|
this._handleMultipleSelect(item);
|
|
512
|
-
|
|
513
422
|
this._adapter.rePositionDropdown();
|
|
514
423
|
}
|
|
515
|
-
|
|
516
424
|
handleClick(e) {
|
|
517
425
|
const isDisabled = this._isDisabled();
|
|
518
|
-
|
|
519
426
|
const isFilterable = this._isFilterable();
|
|
520
|
-
|
|
521
427
|
const {
|
|
522
428
|
isOpen
|
|
523
429
|
} = this.getStates();
|
|
524
|
-
|
|
525
430
|
if (isDisabled) {
|
|
526
431
|
return;
|
|
527
432
|
} else if (!isOpen) {
|
|
528
433
|
this.open();
|
|
529
|
-
|
|
530
434
|
this._notifyFocus(e);
|
|
531
435
|
} else if (isOpen && !isFilterable) {
|
|
532
436
|
this.close(e);
|
|
@@ -535,37 +439,29 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
535
439
|
/**
|
|
536
440
|
* A11y: simulate selection click
|
|
537
441
|
*/
|
|
538
|
-
|
|
539
442
|
/* istanbul ignore next */
|
|
540
|
-
|
|
541
|
-
|
|
542
443
|
handleSelectionEnterPress(keyboardEvent) {
|
|
543
444
|
if (isEnterPress(keyboardEvent)) {
|
|
544
445
|
this.handleClick(keyboardEvent);
|
|
545
446
|
}
|
|
546
447
|
}
|
|
547
|
-
|
|
548
448
|
toggleHoverState(bool) {
|
|
549
449
|
this._adapter.toggleHovering(bool);
|
|
550
450
|
}
|
|
551
|
-
|
|
552
451
|
_defaultRenderText(path, displayRender) {
|
|
553
452
|
const separator = this.getProp('separator');
|
|
554
|
-
|
|
555
453
|
if (displayRender && typeof displayRender === 'function') {
|
|
556
454
|
return displayRender(path);
|
|
557
455
|
} else {
|
|
558
456
|
return path.join(separator);
|
|
559
457
|
}
|
|
560
458
|
}
|
|
561
|
-
|
|
562
459
|
renderDisplayText(targetKey, keyEntities) {
|
|
563
460
|
const renderFunc = this.getProp('displayRender');
|
|
564
461
|
const displayProp = this.getProp('displayProp');
|
|
565
462
|
const displayPath = this.getItemPropPath(targetKey, displayProp, keyEntities);
|
|
566
463
|
return this._defaultRenderText(displayPath, renderFunc);
|
|
567
464
|
}
|
|
568
|
-
|
|
569
465
|
handleNodeLoad(item) {
|
|
570
466
|
const {
|
|
571
467
|
data,
|
|
@@ -577,52 +473,42 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
577
473
|
} = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
|
|
578
474
|
const newLoadedKeys = prevLoadedKeys.add(key);
|
|
579
475
|
const newLoadingKeys = new Set([...prevLoadingKeys]);
|
|
580
|
-
newLoadingKeys.delete(key);
|
|
581
|
-
|
|
476
|
+
newLoadingKeys.delete(key);
|
|
477
|
+
// onLoad should trigger before internal setState to avoid `loadData` trigger twice.
|
|
582
478
|
this._adapter.notifyOnLoad(newLoadedKeys, data);
|
|
583
|
-
|
|
584
479
|
this._adapter.updateStates({
|
|
585
480
|
loadingKeys: newLoadingKeys
|
|
586
481
|
});
|
|
587
482
|
}
|
|
588
|
-
|
|
589
483
|
notifyIfLoadData(item) {
|
|
590
484
|
const {
|
|
591
485
|
data,
|
|
592
486
|
key
|
|
593
487
|
} = item;
|
|
594
|
-
|
|
595
488
|
this._adapter.updateStates({
|
|
596
489
|
loading: false
|
|
597
490
|
});
|
|
598
|
-
|
|
599
491
|
if (!data.isLeaf && !data.children && this.getProp('loadData')) {
|
|
600
492
|
const {
|
|
601
493
|
loadedKeys,
|
|
602
494
|
loadingKeys
|
|
603
495
|
} = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
|
|
604
|
-
|
|
605
496
|
if (loadedKeys.has(key) || loadingKeys.has(key)) {
|
|
606
497
|
return;
|
|
607
498
|
}
|
|
608
|
-
|
|
609
499
|
this._adapter.updateStates({
|
|
610
500
|
loading: true
|
|
611
501
|
});
|
|
612
|
-
|
|
613
502
|
const {
|
|
614
503
|
keyEntities
|
|
615
504
|
} = this.getStates();
|
|
616
505
|
const optionPath = this.getItemPropPath(key, [], keyEntities);
|
|
617
|
-
|
|
618
506
|
this._adapter.updateStates({
|
|
619
507
|
loadingKeys: loadingKeys.add(key)
|
|
620
508
|
});
|
|
621
|
-
|
|
622
509
|
this._adapter.notifyLoadData(optionPath, this.handleNodeLoad.bind(this, item));
|
|
623
510
|
}
|
|
624
511
|
}
|
|
625
|
-
|
|
626
512
|
handleSingleSelect(e, item) {
|
|
627
513
|
const {
|
|
628
514
|
changeOnSelect: allowChange,
|
|
@@ -635,68 +521,51 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
635
521
|
selectedKeys,
|
|
636
522
|
isSearching
|
|
637
523
|
} = this.getStates();
|
|
638
|
-
|
|
639
524
|
const filterable = this._isFilterable();
|
|
640
|
-
|
|
641
525
|
const {
|
|
642
526
|
data,
|
|
643
527
|
key
|
|
644
528
|
} = item;
|
|
645
|
-
|
|
646
529
|
const isLeaf = this._isLeaf(data);
|
|
647
|
-
|
|
648
530
|
const activeKeys = keyEntities[key].path;
|
|
649
531
|
const selectedKey = [key];
|
|
650
532
|
const hasChanged = key !== [...selectedKeys][0];
|
|
651
|
-
|
|
652
533
|
if (!isLeaf && !allowChange && !isSearching) {
|
|
653
534
|
this._adapter.updateStates({
|
|
654
535
|
activeKeys: new Set(activeKeys)
|
|
655
536
|
});
|
|
656
|
-
|
|
657
537
|
this.notifyIfLoadData(item);
|
|
658
538
|
return;
|
|
659
539
|
}
|
|
660
|
-
|
|
661
540
|
if (multiple) {
|
|
662
541
|
this._adapter.updateStates({
|
|
663
542
|
activeKeys: new Set(activeKeys)
|
|
664
543
|
});
|
|
665
|
-
|
|
666
544
|
if (isLeaf && enableLeafClick) {
|
|
667
545
|
this.onItemCheckboxClick(item);
|
|
668
546
|
}
|
|
669
547
|
} else {
|
|
670
548
|
this._adapter.notifySelect(data.value);
|
|
671
|
-
|
|
672
549
|
if (hasChanged) {
|
|
673
550
|
this._notifyChange(item);
|
|
674
|
-
|
|
675
551
|
this.notifyIfLoadData(item);
|
|
676
|
-
|
|
677
552
|
if (this._isControlledComponent()) {
|
|
678
553
|
this._adapter.updateStates({
|
|
679
554
|
activeKeys: new Set(activeKeys)
|
|
680
555
|
});
|
|
681
|
-
|
|
682
556
|
if (isLeaf) {
|
|
683
557
|
this.close(e);
|
|
684
558
|
}
|
|
685
|
-
|
|
686
559
|
return;
|
|
687
560
|
}
|
|
688
|
-
|
|
689
561
|
this._adapter.updateStates({
|
|
690
562
|
activeKeys: new Set(activeKeys),
|
|
691
563
|
selectedKeys: new Set(selectedKey)
|
|
692
564
|
});
|
|
693
|
-
|
|
694
565
|
const displayText = this.renderDisplayText(key);
|
|
695
|
-
|
|
696
566
|
if (filterable) {
|
|
697
567
|
this._adapter.updateInputPlaceHolder(displayText);
|
|
698
568
|
}
|
|
699
|
-
|
|
700
569
|
if (isLeaf) {
|
|
701
570
|
this.close(e, key);
|
|
702
571
|
} else if (!filterLeafOnly && isSearching) {
|
|
@@ -707,7 +576,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
707
576
|
}
|
|
708
577
|
}
|
|
709
578
|
}
|
|
710
|
-
|
|
711
579
|
_handleMultipleSelect(item) {
|
|
712
580
|
const {
|
|
713
581
|
key
|
|
@@ -722,12 +590,12 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
722
590
|
max,
|
|
723
591
|
disableStrictly,
|
|
724
592
|
leafOnly
|
|
725
|
-
} = this.getProps();
|
|
726
|
-
|
|
727
|
-
const prevCheckedStatus = checkedKeys.has(key);
|
|
728
|
-
|
|
729
|
-
const curCheckedStatus = disableStrictly ? this.calcCheckedStatus(!prevCheckedStatus, key) : !prevCheckedStatus;
|
|
730
|
-
|
|
593
|
+
} = this.getProps();
|
|
594
|
+
// prev checked status
|
|
595
|
+
const prevCheckedStatus = checkedKeys.has(key);
|
|
596
|
+
// next checked status
|
|
597
|
+
const curCheckedStatus = disableStrictly ? this.calcCheckedStatus(!prevCheckedStatus, key) : !prevCheckedStatus;
|
|
598
|
+
// calculate all key of nodes that are checked or half checked
|
|
731
599
|
const {
|
|
732
600
|
checkedKeys: curCheckedKeys,
|
|
733
601
|
halfCheckedKeys: curHalfCheckedKeys
|
|
@@ -737,7 +605,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
737
605
|
const isNoneMerge = mergeType === strings.NONE_MERGE_TYPE;
|
|
738
606
|
const curResolvedCheckedKeys = new Set(normalizeKeyList(curCheckedKeys, keyEntities, isLeafOnlyMerge));
|
|
739
607
|
const curRealCheckedKeys = isNoneMerge ? curCheckedKeys : curResolvedCheckedKeys;
|
|
740
|
-
|
|
741
608
|
if (_isNumber(max)) {
|
|
742
609
|
if (!isNoneMerge) {
|
|
743
610
|
// When it exceeds max, the quantity is allowed to be reduced, and no further increase is allowed
|
|
@@ -746,9 +613,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
746
613
|
curResolvedCheckedKeys.forEach(itemKey => {
|
|
747
614
|
checkedEntities.push(keyEntities[itemKey]);
|
|
748
615
|
});
|
|
749
|
-
|
|
750
616
|
this._adapter.notifyOnExceed(checkedEntities);
|
|
751
|
-
|
|
752
617
|
return;
|
|
753
618
|
}
|
|
754
619
|
} else {
|
|
@@ -758,35 +623,28 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
758
623
|
curCheckedKeys.forEach(itemKey => {
|
|
759
624
|
checkedEntities.push(keyEntities[itemKey]);
|
|
760
625
|
});
|
|
761
|
-
|
|
762
626
|
this._adapter.notifyOnExceed(checkedEntities);
|
|
763
|
-
|
|
764
627
|
return;
|
|
765
628
|
}
|
|
766
629
|
}
|
|
767
630
|
}
|
|
768
|
-
|
|
769
631
|
if (!this._isControlledComponent()) {
|
|
770
632
|
this._adapter.updateStates({
|
|
771
633
|
checkedKeys: curCheckedKeys,
|
|
772
634
|
halfCheckedKeys: curHalfCheckedKeys,
|
|
773
635
|
resolvedCheckedKeys: curResolvedCheckedKeys
|
|
774
636
|
});
|
|
775
|
-
}
|
|
637
|
+
}
|
|
638
|
+
// The click event during multiple selection will definitely cause the checked state of node to change,
|
|
776
639
|
// so there is no need to judge the value to change.
|
|
777
|
-
|
|
778
|
-
|
|
779
640
|
this._notifyChange(curRealCheckedKeys);
|
|
780
|
-
|
|
781
641
|
if (curCheckedStatus) {
|
|
782
642
|
this._notifySelect(curRealCheckedKeys);
|
|
783
643
|
}
|
|
784
|
-
|
|
785
644
|
this._adapter.updateStates({
|
|
786
645
|
inputValue: ''
|
|
787
646
|
});
|
|
788
647
|
}
|
|
789
|
-
|
|
790
648
|
calcNonDisabledCheckedKeys(eventKey, targetStatus) {
|
|
791
649
|
const {
|
|
792
650
|
keyEntities,
|
|
@@ -797,21 +655,17 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
797
655
|
} = this.getCopyFromState(['checkedKeys']);
|
|
798
656
|
const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
|
|
799
657
|
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
800
|
-
|
|
801
658
|
if (!hasDisabled) {
|
|
802
659
|
return this.calcCheckedKeys(eventKey, targetStatus);
|
|
803
660
|
}
|
|
804
|
-
|
|
805
661
|
const nonDisabled = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
806
662
|
const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : _difference(normalizeKeyList([...checkedKeys], keyEntities, true), nonDisabled);
|
|
807
663
|
return calcCheckedKeys(newCheckedKeys, keyEntities);
|
|
808
664
|
}
|
|
809
|
-
|
|
810
665
|
calcCheckedStatus(targetStatus, eventKey) {
|
|
811
666
|
if (!targetStatus) {
|
|
812
667
|
return targetStatus;
|
|
813
668
|
}
|
|
814
|
-
|
|
815
669
|
const {
|
|
816
670
|
checkedKeys,
|
|
817
671
|
keyEntities,
|
|
@@ -819,16 +673,13 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
819
673
|
} = this.getStates();
|
|
820
674
|
const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
|
|
821
675
|
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
822
|
-
|
|
823
676
|
if (!hasDisabled) {
|
|
824
677
|
return targetStatus;
|
|
825
678
|
}
|
|
826
|
-
|
|
827
679
|
const nonDisabledKeys = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
828
680
|
const allChecked = nonDisabledKeys.every(key => checkedKeys.has(key));
|
|
829
681
|
return !allChecked;
|
|
830
682
|
}
|
|
831
|
-
|
|
832
683
|
_notifySelect(keys) {
|
|
833
684
|
const {
|
|
834
685
|
keyEntities
|
|
@@ -841,7 +692,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
841
692
|
}
|
|
842
693
|
});
|
|
843
694
|
const formatValue = values.length === 1 ? values[0] : values;
|
|
844
|
-
|
|
845
695
|
this._adapter.notifySelect(formatValue);
|
|
846
696
|
}
|
|
847
697
|
/**
|
|
@@ -849,8 +699,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
849
699
|
* @param {string} key key of node
|
|
850
700
|
* @param {boolean} curCheckedStatus checked status of node
|
|
851
701
|
*/
|
|
852
|
-
|
|
853
|
-
|
|
854
702
|
calcCheckedKeys(key, curCheckedStatus) {
|
|
855
703
|
const {
|
|
856
704
|
keyEntities
|
|
@@ -861,10 +709,8 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
861
709
|
} = this.getCopyFromState(['checkedKeys', 'halfCheckedKeys']);
|
|
862
710
|
return curCheckedStatus ? calcCheckedKeysForChecked(key, keyEntities, checkedKeys, halfCheckedKeys) : calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfCheckedKeys);
|
|
863
711
|
}
|
|
864
|
-
|
|
865
712
|
handleInputChange(sugInput) {
|
|
866
713
|
this._adapter.updateInputValue(sugInput);
|
|
867
|
-
|
|
868
714
|
const {
|
|
869
715
|
keyEntities
|
|
870
716
|
} = this.getStates();
|
|
@@ -874,7 +720,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
874
720
|
filterLeafOnly
|
|
875
721
|
} = this.getProps();
|
|
876
722
|
let filteredKeys = [];
|
|
877
|
-
|
|
878
723
|
if (sugInput) {
|
|
879
724
|
filteredKeys = Object.values(keyEntities).filter(item => {
|
|
880
725
|
const {
|
|
@@ -882,24 +727,19 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
882
727
|
_notExist,
|
|
883
728
|
data
|
|
884
729
|
} = item;
|
|
885
|
-
|
|
886
730
|
if (_notExist) {
|
|
887
731
|
return false;
|
|
888
732
|
}
|
|
889
|
-
|
|
890
733
|
const filteredPath = this.getItemPropPath(key, treeNodeFilterProp).join();
|
|
891
734
|
return filter(sugInput, data, filterTreeNode, false, filteredPath);
|
|
892
735
|
}).filter(item => filterTreeNode && !filterLeafOnly || this._isLeaf(item)).map(item => item.key);
|
|
893
736
|
}
|
|
894
|
-
|
|
895
737
|
this._adapter.updateStates({
|
|
896
738
|
isSearching: Boolean(sugInput),
|
|
897
739
|
filteredKeys: new Set(filteredKeys)
|
|
898
740
|
});
|
|
899
|
-
|
|
900
741
|
this._adapter.notifyOnSearch(sugInput);
|
|
901
742
|
}
|
|
902
|
-
|
|
903
743
|
handleClear() {
|
|
904
744
|
const {
|
|
905
745
|
isSearching
|
|
@@ -909,90 +749,66 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
909
749
|
placeholder,
|
|
910
750
|
multiple
|
|
911
751
|
} = this.getProps();
|
|
912
|
-
|
|
913
752
|
const isFilterable = this._isFilterable();
|
|
914
|
-
|
|
915
753
|
const isControlled = this._isControlledComponent();
|
|
916
|
-
|
|
917
754
|
const newState = {};
|
|
918
|
-
|
|
919
755
|
if (multiple) {
|
|
920
756
|
this._adapter.updateInputValue('');
|
|
921
|
-
|
|
922
757
|
this._adapter.notifyOnSearch('');
|
|
923
|
-
|
|
924
758
|
newState.checkedKeys = new Set([]);
|
|
925
759
|
newState.halfCheckedKeys = new Set([]);
|
|
926
760
|
newState.selectedKeys = new Set([]);
|
|
927
761
|
newState.activeKeys = new Set([]);
|
|
928
762
|
newState.resolvedCheckedKeys = new Set([]);
|
|
929
|
-
|
|
930
763
|
this._adapter.notifyChange([]);
|
|
931
764
|
} else {
|
|
932
765
|
// if click clearBtn when not searching, clear selected and active values as well
|
|
933
766
|
if (isFilterable && isSearching) {
|
|
934
767
|
newState.isSearching = false;
|
|
935
|
-
|
|
936
768
|
this._adapter.updateInputValue('');
|
|
937
|
-
|
|
938
769
|
this._adapter.notifyOnSearch('');
|
|
939
770
|
} else {
|
|
940
771
|
if (isFilterable) {
|
|
941
772
|
newState.inputValue = '';
|
|
942
773
|
newState.inputPlaceHolder = searchPlaceholder || placeholder || '';
|
|
943
|
-
|
|
944
774
|
this._adapter.updateInputValue('');
|
|
945
|
-
|
|
946
775
|
this._adapter.notifyOnSearch('');
|
|
947
776
|
}
|
|
948
|
-
|
|
949
777
|
if (!isControlled) {
|
|
950
778
|
newState.selectedKeys = new Set([]);
|
|
951
779
|
}
|
|
952
|
-
|
|
953
780
|
newState.activeKeys = new Set([]);
|
|
954
781
|
newState.filteredKeys = new Set([]);
|
|
955
|
-
|
|
956
782
|
this._adapter.notifyChange([]);
|
|
957
783
|
}
|
|
958
784
|
}
|
|
959
|
-
|
|
960
785
|
this._adapter.updateStates(newState);
|
|
961
|
-
|
|
962
786
|
this._adapter.notifyClear();
|
|
963
|
-
|
|
964
787
|
this._adapter.rePositionDropdown();
|
|
965
788
|
}
|
|
966
789
|
/**
|
|
967
790
|
* A11y: simulate clear button click
|
|
968
791
|
*/
|
|
969
|
-
|
|
970
792
|
/* istanbul ignore next */
|
|
971
|
-
|
|
972
|
-
|
|
973
793
|
handleClearEnterPress(keyboardEvent) {
|
|
974
794
|
if (isEnterPress(keyboardEvent)) {
|
|
975
795
|
this.handleClear();
|
|
976
796
|
}
|
|
977
797
|
}
|
|
978
|
-
|
|
979
798
|
getRenderData() {
|
|
980
799
|
const {
|
|
981
800
|
keyEntities,
|
|
982
801
|
isSearching
|
|
983
802
|
} = this.getStates();
|
|
984
|
-
|
|
985
803
|
const isFilterable = this._isFilterable();
|
|
986
|
-
|
|
987
804
|
if (isSearching && isFilterable) {
|
|
988
805
|
return this.getFilteredData();
|
|
989
806
|
}
|
|
990
|
-
|
|
991
|
-
|
|
807
|
+
return Object.values(keyEntities).filter(item => item.parentKey === null && !item._notExist)
|
|
808
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
992
809
|
// @ts-ignore
|
|
993
810
|
.sort((a, b) => parseInt(a.ind, 10) - parseInt(b.ind, 10));
|
|
994
811
|
}
|
|
995
|
-
|
|
996
812
|
getFilteredData() {
|
|
997
813
|
const {
|
|
998
814
|
treeNodeFilterProp,
|
|
@@ -1007,16 +823,12 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
1007
823
|
const filteredKeyArr = [...filteredKeys];
|
|
1008
824
|
filteredKeyArr.forEach(key => {
|
|
1009
825
|
const item = keyEntities[key];
|
|
1010
|
-
|
|
1011
826
|
if (!item) {
|
|
1012
827
|
return;
|
|
1013
828
|
}
|
|
1014
|
-
|
|
1015
829
|
const pathData = this.getItemPropPath(key, []);
|
|
1016
830
|
const itemSearchPath = pathData.map(item => item[treeNodeFilterProp]);
|
|
1017
|
-
|
|
1018
831
|
const isDisabled = this._isOptionDisabled(key, keyEntities);
|
|
1019
|
-
|
|
1020
832
|
filteredList.push({
|
|
1021
833
|
data: item.data,
|
|
1022
834
|
pathData,
|
|
@@ -1025,16 +837,13 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
1025
837
|
searchText: itemSearchPath
|
|
1026
838
|
});
|
|
1027
839
|
});
|
|
1028
|
-
|
|
1029
840
|
if (_isFunction(filterSorter)) {
|
|
1030
841
|
filteredList.sort((a, b) => {
|
|
1031
842
|
return filterSorter(a.pathData, b.pathData, inputValue);
|
|
1032
843
|
});
|
|
1033
844
|
}
|
|
1034
|
-
|
|
1035
845
|
return filteredList;
|
|
1036
846
|
}
|
|
1037
|
-
|
|
1038
847
|
handleListScroll(e, ind) {
|
|
1039
848
|
const {
|
|
1040
849
|
activeKeys,
|
|
@@ -1042,13 +851,11 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
1042
851
|
} = this.getStates();
|
|
1043
852
|
const lastActiveKey = [...activeKeys][activeKeys.size - 1];
|
|
1044
853
|
const data = lastActiveKey ? _get(keyEntities, [lastActiveKey, 'data'], null) : null;
|
|
1045
|
-
|
|
1046
854
|
this._adapter.notifyListScroll(e, {
|
|
1047
855
|
panelIndex: ind,
|
|
1048
856
|
activeNode: data
|
|
1049
857
|
});
|
|
1050
858
|
}
|
|
1051
|
-
|
|
1052
859
|
handleTagRemove(e, tagValuePath) {
|
|
1053
860
|
const {
|
|
1054
861
|
keyEntities
|
|
@@ -1056,14 +863,11 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
1056
863
|
const {
|
|
1057
864
|
disabled
|
|
1058
865
|
} = this.getProps();
|
|
1059
|
-
|
|
1060
866
|
if (disabled) {
|
|
1061
867
|
/* istanbul ignore next */
|
|
1062
868
|
return;
|
|
1063
869
|
}
|
|
1064
|
-
|
|
1065
870
|
const removedItem = Object.values(keyEntities).filter(item => _isEqual(item.valuePath, tagValuePath))[0];
|
|
1066
871
|
!_isEmpty(removedItem) && !removedItem.data.disabled && this._handleMultipleSelect(removedItem);
|
|
1067
872
|
}
|
|
1068
|
-
|
|
1069
873
|
}
|