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