@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
|
@@ -9,12 +9,11 @@ import _isNumber from "lodash/isNumber";
|
|
|
9
9
|
import { strings } from '../treeSelect/constants';
|
|
10
10
|
import BaseFoundation from '../base/foundation';
|
|
11
11
|
import { flattenTreeData, findDescendantKeys, findAncestorKeys, filter, normalizedArr, normalizeKeyList, getMotionKeys, calcCheckedKeysForChecked, calcCheckedKeys, calcCheckedKeysForUnchecked, getValueOrKey } from '../tree/treeUtil';
|
|
12
|
-
import isEnterPress from '../utils/isEnterPress';
|
|
13
|
-
|
|
12
|
+
import isEnterPress from '../utils/isEnterPress';
|
|
13
|
+
// eslint-disable-next-line max-len
|
|
14
14
|
export default class TreeSelectFoundation extends BaseFoundation {
|
|
15
15
|
constructor(adapter) {
|
|
16
16
|
super(Object.assign({}, adapter));
|
|
17
|
-
|
|
18
17
|
this._registerClickOutsideHandler = e => {
|
|
19
18
|
this._adapter.registerClickOutsideHandler(e => {
|
|
20
19
|
this.handlerTriggerBlur(e);
|
|
@@ -22,7 +21,6 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
22
21
|
});
|
|
23
22
|
};
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
init() {
|
|
27
25
|
const {
|
|
28
26
|
searchAutoFocus,
|
|
@@ -31,32 +29,25 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
31
29
|
} = this.getProps();
|
|
32
30
|
const triggerSearch = searchPosition === strings.SEARCH_POSITION_TRIGGER && filterTreeNode;
|
|
33
31
|
const triggerSearchAutoFocus = searchAutoFocus && triggerSearch;
|
|
34
|
-
|
|
35
32
|
this._setDropdownWidth();
|
|
36
|
-
|
|
37
33
|
const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && !this._isDisabled();
|
|
38
|
-
|
|
39
34
|
if (isOpen) {
|
|
40
35
|
this.open();
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
if (triggerSearchAutoFocus) {
|
|
44
38
|
this.handleTriggerFocus(null);
|
|
45
39
|
}
|
|
46
40
|
}
|
|
47
|
-
|
|
48
41
|
destroy() {
|
|
49
42
|
// Ensure that event monitoring will be uninstalled, and the user may not trigger closePanel
|
|
50
43
|
this._adapter.unregisterClickOutsideHandler();
|
|
51
44
|
}
|
|
52
|
-
|
|
53
45
|
_setDropdownWidth() {
|
|
54
46
|
const {
|
|
55
47
|
style,
|
|
56
48
|
dropdownMatchSelectWidth
|
|
57
49
|
} = this.getProps();
|
|
58
50
|
let width;
|
|
59
|
-
|
|
60
51
|
if (dropdownMatchSelectWidth) {
|
|
61
52
|
if (style && _isNumber(style.width)) {
|
|
62
53
|
width = style.width;
|
|
@@ -65,36 +56,28 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
65
56
|
} else {
|
|
66
57
|
width = this._adapter.getTriggerWidth();
|
|
67
58
|
}
|
|
68
|
-
|
|
69
59
|
this._adapter.setOptionWrapperWidth(width);
|
|
70
60
|
}
|
|
71
61
|
}
|
|
72
|
-
|
|
73
62
|
_isMultiple() {
|
|
74
63
|
return this.getProp('multiple');
|
|
75
64
|
}
|
|
76
|
-
|
|
77
65
|
_isAnimated() {
|
|
78
66
|
return this.getProp('motionExpand');
|
|
79
67
|
}
|
|
80
|
-
|
|
81
68
|
_isDisabled() {
|
|
82
69
|
let treeNode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
83
70
|
return this.getProp('disabled') || treeNode.disabled;
|
|
84
71
|
}
|
|
85
|
-
|
|
86
72
|
_isExpandControlled() {
|
|
87
73
|
return this.getProp('expandedKeys');
|
|
88
74
|
}
|
|
89
|
-
|
|
90
75
|
_isSelectToClose() {
|
|
91
76
|
return !this.getProp('expandAction');
|
|
92
77
|
}
|
|
93
|
-
|
|
94
78
|
_isLoadControlled() {
|
|
95
79
|
return this.getProp('loadedKeys');
|
|
96
80
|
}
|
|
97
|
-
|
|
98
81
|
_showFilteredOnly() {
|
|
99
82
|
const {
|
|
100
83
|
inputValue
|
|
@@ -104,25 +87,21 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
104
87
|
} = this.getProps();
|
|
105
88
|
return Boolean(inputValue) && showFilteredOnly;
|
|
106
89
|
}
|
|
107
|
-
|
|
108
90
|
findDataForValue(findValue) {
|
|
109
91
|
const {
|
|
110
92
|
value,
|
|
111
93
|
defaultValue
|
|
112
94
|
} = this.getProps();
|
|
113
95
|
let valueArr = [];
|
|
114
|
-
|
|
115
96
|
if (value) {
|
|
116
97
|
valueArr = Array.isArray(value) ? value : [value];
|
|
117
98
|
} else if (defaultValue) {
|
|
118
99
|
valueArr = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
119
100
|
}
|
|
120
|
-
|
|
121
101
|
return valueArr.find(item => {
|
|
122
102
|
return item.value === findValue || item.key === findValue;
|
|
123
103
|
});
|
|
124
104
|
}
|
|
125
|
-
|
|
126
105
|
constructDataForValue(value) {
|
|
127
106
|
const {
|
|
128
107
|
treeNodeLabelProp
|
|
@@ -132,19 +111,16 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
132
111
|
[treeNodeLabelProp]: value
|
|
133
112
|
};
|
|
134
113
|
}
|
|
135
|
-
|
|
136
114
|
getDataForKeyNotInKeyEntities(value) {
|
|
137
115
|
const {
|
|
138
116
|
onChangeWithObject
|
|
139
117
|
} = this.getProps();
|
|
140
|
-
|
|
141
118
|
if (onChangeWithObject) {
|
|
142
119
|
return this.findDataForValue(value);
|
|
143
120
|
} else {
|
|
144
121
|
return this.constructDataForValue(value);
|
|
145
122
|
}
|
|
146
123
|
}
|
|
147
|
-
|
|
148
124
|
getCopyFromState(items) {
|
|
149
125
|
const res = {};
|
|
150
126
|
normalizedArr(items).forEach(key => {
|
|
@@ -152,7 +128,6 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
152
128
|
});
|
|
153
129
|
return res;
|
|
154
130
|
}
|
|
155
|
-
|
|
156
131
|
getTreeNodeProps(key) {
|
|
157
132
|
const {
|
|
158
133
|
expandedKeys = new Set([]),
|
|
@@ -174,15 +149,12 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
174
149
|
} = this.getProps();
|
|
175
150
|
const entity = keyEntities[key];
|
|
176
151
|
const notExist = !entity;
|
|
177
|
-
|
|
178
152
|
if (notExist) {
|
|
179
153
|
return null;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
154
|
+
}
|
|
155
|
+
// if checkRelation is invalid, the checked status of node will be false
|
|
183
156
|
let realChecked = false;
|
|
184
157
|
let realHalfChecked = false;
|
|
185
|
-
|
|
186
158
|
if (checkRelation === 'related') {
|
|
187
159
|
realChecked = checkedKeys.has(key);
|
|
188
160
|
realHalfChecked = halfCheckedKeys.has(key);
|
|
@@ -190,7 +162,6 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
190
162
|
realChecked = realCheckedKeys.has(key);
|
|
191
163
|
realHalfChecked = false;
|
|
192
164
|
}
|
|
193
|
-
|
|
194
165
|
const isSearching = Boolean(inputValue);
|
|
195
166
|
const treeNodeProps = {
|
|
196
167
|
eventKey: key,
|
|
@@ -206,14 +177,11 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
206
177
|
loading: loadingKeys.has(key) && !loadedKeys.has(key),
|
|
207
178
|
loaded: loadedKeys.has(key)
|
|
208
179
|
};
|
|
209
|
-
|
|
210
180
|
if (this.getProp('disableStrictly') && disabledKeys.has(key)) {
|
|
211
181
|
treeNodeProps.disabled = true;
|
|
212
182
|
}
|
|
213
|
-
|
|
214
183
|
return treeNodeProps;
|
|
215
184
|
}
|
|
216
|
-
|
|
217
185
|
handleNodeLoad(loadedKeys, loadingKeys, data, resolve) {
|
|
218
186
|
const {
|
|
219
187
|
loadData
|
|
@@ -221,11 +189,9 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
221
189
|
const {
|
|
222
190
|
key
|
|
223
191
|
} = data;
|
|
224
|
-
|
|
225
192
|
if (!loadData || loadedKeys.has(key) || loadingKeys.has(key)) {
|
|
226
193
|
return {};
|
|
227
194
|
}
|
|
228
|
-
|
|
229
195
|
loadData(data).then(() => {
|
|
230
196
|
const {
|
|
231
197
|
loadedKeys: prevLoadedKeys,
|
|
@@ -234,19 +200,15 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
234
200
|
const newLoadedKeys = prevLoadedKeys.add(key);
|
|
235
201
|
const newLoadingKeys = new Set([...prevLoadingKeys]);
|
|
236
202
|
newLoadingKeys.delete(key);
|
|
237
|
-
|
|
238
203
|
this._adapter.notifyLoad(newLoadedKeys, data);
|
|
239
|
-
|
|
240
204
|
if (!this._isLoadControlled()) {
|
|
241
205
|
this._adapter.updateState({
|
|
242
206
|
loadedKeys: newLoadedKeys
|
|
243
207
|
});
|
|
244
208
|
}
|
|
245
|
-
|
|
246
209
|
this._adapter.setState({
|
|
247
210
|
loadingKeys: newLoadingKeys
|
|
248
211
|
});
|
|
249
|
-
|
|
250
212
|
resolve();
|
|
251
213
|
});
|
|
252
214
|
return {
|
|
@@ -254,12 +216,9 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
254
216
|
};
|
|
255
217
|
}
|
|
256
218
|
/* istanbul ignore next */
|
|
257
|
-
|
|
258
|
-
|
|
259
219
|
focusInput(bool) {
|
|
260
220
|
this._adapter.updateInputFocus(bool);
|
|
261
221
|
}
|
|
262
|
-
|
|
263
222
|
_notifyMultipleChange(key, e) {
|
|
264
223
|
const {
|
|
265
224
|
keyEntities
|
|
@@ -269,96 +228,74 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
269
228
|
checkRelation
|
|
270
229
|
} = this.getProps();
|
|
271
230
|
let keyList = [];
|
|
272
|
-
|
|
273
231
|
if (checkRelation === 'related') {
|
|
274
232
|
keyList = normalizeKeyList(key, keyEntities, leafOnly, true);
|
|
275
233
|
} else if (checkRelation === 'unRelated') {
|
|
276
234
|
keyList = key;
|
|
277
235
|
}
|
|
278
|
-
|
|
279
236
|
const nodes = keyList.map(key => keyEntities[key] && keyEntities[key].data.key === key ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key));
|
|
280
|
-
|
|
281
237
|
if (this.getProp('onChangeWithObject')) {
|
|
282
238
|
this._adapter.notifyChangeWithObject(nodes, e);
|
|
283
239
|
} else {
|
|
284
240
|
const value = getValueOrKey(nodes);
|
|
285
|
-
|
|
286
241
|
this._adapter.notifyChange(value, nodes, e);
|
|
287
242
|
}
|
|
288
243
|
}
|
|
289
|
-
|
|
290
244
|
_notifyChange(key, e) {
|
|
291
245
|
const {
|
|
292
246
|
keyEntities
|
|
293
247
|
} = this.getStates();
|
|
294
|
-
|
|
295
248
|
if (this._isMultiple() && Array.isArray(key)) {
|
|
296
249
|
this._notifyMultipleChange(key, e);
|
|
297
250
|
} else {
|
|
298
251
|
const nodes = _isUndefined(key) ? key : keyEntities[key].data;
|
|
299
252
|
const value = _isUndefined(key) ? key : getValueOrKey(nodes);
|
|
300
|
-
|
|
301
253
|
if (this.getProp('onChangeWithObject')) {
|
|
302
254
|
this._adapter.notifyChangeWithObject(nodes, e);
|
|
303
255
|
} else {
|
|
304
256
|
this._adapter.notifyChange(value, nodes, e);
|
|
305
257
|
}
|
|
306
258
|
}
|
|
307
|
-
}
|
|
259
|
+
}
|
|
260
|
+
// Scenes that may trigger focus:
|
|
308
261
|
// 1、click selection
|
|
309
|
-
|
|
310
|
-
|
|
311
262
|
_notifyFocus(e) {
|
|
312
263
|
this._adapter.notifyFocus(e);
|
|
313
264
|
}
|
|
314
|
-
|
|
315
265
|
handleTriggerFocus(e) {
|
|
316
266
|
this._adapter.updateIsFocus(true);
|
|
317
|
-
|
|
318
267
|
this._notifyFocus(e);
|
|
319
|
-
|
|
320
268
|
this._registerClickOutsideHandler(e);
|
|
321
|
-
}
|
|
269
|
+
}
|
|
270
|
+
// Scenes that may trigger blur
|
|
322
271
|
// 1、clickOutSide
|
|
323
272
|
// 2、click option / press enter, and then select complete(when multiple is false
|
|
324
273
|
// 3、press esc when dropdown list open
|
|
325
|
-
|
|
326
|
-
|
|
327
274
|
_notifyBlur(e) {
|
|
328
275
|
this._adapter.notifyBlur(e);
|
|
329
276
|
}
|
|
330
|
-
|
|
331
277
|
handlerTriggerBlur(e) {
|
|
332
278
|
this._adapter.updateIsFocus(false);
|
|
333
|
-
|
|
334
279
|
this._notifyBlur(e);
|
|
335
|
-
|
|
336
280
|
this._adapter.unregisterClickOutsideHandler();
|
|
337
281
|
}
|
|
338
|
-
|
|
339
282
|
toggleHoverState(bool) {
|
|
340
283
|
this._adapter.toggleHovering(bool);
|
|
341
284
|
}
|
|
342
|
-
|
|
343
285
|
open() {
|
|
344
286
|
this._adapter.openMenu();
|
|
345
|
-
|
|
346
287
|
this._setDropdownWidth();
|
|
347
288
|
}
|
|
348
|
-
|
|
349
289
|
close(e) {
|
|
350
290
|
this._adapter.closeMenu();
|
|
351
|
-
|
|
352
291
|
if (this.getProp('motionExpand')) {
|
|
353
292
|
this._adapter.updateState({
|
|
354
293
|
motionKeys: new Set([])
|
|
355
294
|
});
|
|
356
295
|
}
|
|
357
296
|
}
|
|
358
|
-
|
|
359
297
|
handleClick(e) {
|
|
360
298
|
const isDisabled = this._isDisabled();
|
|
361
|
-
|
|
362
299
|
const {
|
|
363
300
|
isOpen,
|
|
364
301
|
inputValue,
|
|
@@ -368,19 +305,16 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
368
305
|
searchPosition,
|
|
369
306
|
clickTriggerToHide
|
|
370
307
|
} = this.getProps();
|
|
371
|
-
|
|
372
308
|
if (isDisabled) {
|
|
373
309
|
return;
|
|
374
310
|
} else {
|
|
375
311
|
if (!isFocus) {
|
|
376
312
|
this.handleTriggerFocus(e);
|
|
377
313
|
}
|
|
378
|
-
|
|
379
314
|
if (isOpen) {
|
|
380
315
|
if (searchPosition === 'trigger' && inputValue) {
|
|
381
316
|
return;
|
|
382
317
|
}
|
|
383
|
-
|
|
384
318
|
clickTriggerToHide && this.close(e);
|
|
385
319
|
} else {
|
|
386
320
|
this.open();
|
|
@@ -390,16 +324,12 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
390
324
|
/**
|
|
391
325
|
* A11y: simulate selection click
|
|
392
326
|
*/
|
|
393
|
-
|
|
394
327
|
/* istanbul ignore next */
|
|
395
|
-
|
|
396
|
-
|
|
397
328
|
handleSelectionEnterPress(e) {
|
|
398
329
|
if (isEnterPress(e)) {
|
|
399
330
|
this.handleClick(e);
|
|
400
331
|
}
|
|
401
332
|
}
|
|
402
|
-
|
|
403
333
|
handleClear(e) {
|
|
404
334
|
const {
|
|
405
335
|
searchPosition,
|
|
@@ -409,28 +339,21 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
409
339
|
inputValue,
|
|
410
340
|
selectedKeys
|
|
411
341
|
} = this.getStates();
|
|
412
|
-
|
|
413
342
|
const isMultiple = this._isMultiple();
|
|
414
|
-
|
|
415
343
|
const isControlled = this._isControlledComponent();
|
|
416
|
-
|
|
417
344
|
const value = isMultiple ? [] : undefined;
|
|
418
|
-
|
|
419
345
|
this._notifyChange(value, e);
|
|
420
|
-
|
|
421
346
|
if (!isControlled) {
|
|
422
347
|
// reposition dropdown when selected values change
|
|
423
348
|
this._adapter.rePositionDropdown();
|
|
424
|
-
|
|
425
349
|
this._adapter.updateState({
|
|
426
350
|
selectedKeys: [],
|
|
427
351
|
checkedKeys: new Set(),
|
|
428
352
|
halfCheckedKeys: new Set(),
|
|
429
353
|
realCheckedKeys: new Set([])
|
|
430
354
|
});
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
|
|
355
|
+
}
|
|
356
|
+
// When triggerSearch, clicking the clear button will trigger to clear Input
|
|
434
357
|
if (filterTreeNode && searchPosition === strings.SEARCH_POSITION_TRIGGER) {
|
|
435
358
|
if (inputValue !== '') {
|
|
436
359
|
if (_isEmpty(selectedKeys)) {
|
|
@@ -444,16 +367,12 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
444
367
|
/**
|
|
445
368
|
* A11y: simulate clear button click
|
|
446
369
|
*/
|
|
447
|
-
|
|
448
370
|
/* istanbul ignore next */
|
|
449
|
-
|
|
450
|
-
|
|
451
371
|
handleClearEnterPress(e) {
|
|
452
372
|
if (isEnterPress(e)) {
|
|
453
373
|
this.handleClear(e);
|
|
454
374
|
}
|
|
455
375
|
}
|
|
456
|
-
|
|
457
376
|
removeTag(eventKey) {
|
|
458
377
|
const {
|
|
459
378
|
disableStrictly,
|
|
@@ -465,22 +384,17 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
465
384
|
realCheckedKeys
|
|
466
385
|
} = this.getStates();
|
|
467
386
|
const item = keyEntities[eventKey] && keyEntities[eventKey].data.key === eventKey ? keyEntities[eventKey].data : this.getDataForKeyNotInKeyEntities(eventKey);
|
|
468
|
-
|
|
469
387
|
if (item.disabled || disableStrictly && disabledKeys.has(eventKey)) {
|
|
470
388
|
return;
|
|
471
389
|
}
|
|
472
|
-
|
|
473
390
|
if (checkRelation === 'unRelated') {
|
|
474
391
|
const newRealCheckedKeys = new Set(realCheckedKeys);
|
|
475
392
|
newRealCheckedKeys.delete(eventKey);
|
|
476
|
-
|
|
477
393
|
this._notifyChange([...newRealCheckedKeys], null);
|
|
478
|
-
|
|
479
394
|
if (!this._isControlledComponent()) {
|
|
480
395
|
this._adapter.updateState({
|
|
481
396
|
realCheckedKeys: newRealCheckedKeys
|
|
482
397
|
});
|
|
483
|
-
|
|
484
398
|
this._adapter.rePositionDropdown();
|
|
485
399
|
}
|
|
486
400
|
} else if (checkRelation === 'related') {
|
|
@@ -488,25 +402,19 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
488
402
|
checkedKeys,
|
|
489
403
|
halfCheckedKeys
|
|
490
404
|
} = this.calcCheckedKeys(eventKey, false);
|
|
491
|
-
|
|
492
405
|
this._notifyChange([...checkedKeys], null);
|
|
493
|
-
|
|
494
406
|
if (!this._isControlledComponent()) {
|
|
495
407
|
this._adapter.updateState({
|
|
496
408
|
checkedKeys,
|
|
497
409
|
halfCheckedKeys
|
|
498
410
|
});
|
|
499
|
-
|
|
500
411
|
this._adapter.rePositionDropdown();
|
|
501
412
|
}
|
|
502
413
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
414
|
+
this._adapter.notifySelect(eventKey, false, item);
|
|
415
|
+
// reposition dropdown when selected values change
|
|
507
416
|
this._adapter.rePositionDropdown();
|
|
508
417
|
}
|
|
509
|
-
|
|
510
418
|
clearInput() {
|
|
511
419
|
const {
|
|
512
420
|
flattenNodes,
|
|
@@ -516,13 +424,10 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
516
424
|
treeData
|
|
517
425
|
} = this.getStates();
|
|
518
426
|
const newExpandedKeys = new Set(expandedKeys);
|
|
519
|
-
|
|
520
427
|
const isExpandControlled = this._isExpandControlled();
|
|
521
|
-
|
|
522
428
|
const expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
|
|
523
429
|
expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
|
|
524
430
|
const newFlattenNodes = flattenTreeData(treeData, newExpandedKeys);
|
|
525
|
-
|
|
526
431
|
this._adapter.updateState({
|
|
527
432
|
expandedKeys: isExpandControlled ? expandedKeys : newExpandedKeys,
|
|
528
433
|
flattenNodes: isExpandControlled ? flattenNodes : newFlattenNodes,
|
|
@@ -533,11 +438,9 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
533
438
|
filteredShownKeys: new Set([])
|
|
534
439
|
});
|
|
535
440
|
}
|
|
536
|
-
|
|
537
441
|
handleInputChange(sugInput) {
|
|
538
442
|
// Input is used as controlled component
|
|
539
443
|
this._adapter.updateInputValue(sugInput);
|
|
540
|
-
|
|
541
444
|
const {
|
|
542
445
|
flattenNodes,
|
|
543
446
|
expandedKeys,
|
|
@@ -555,7 +458,6 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
555
458
|
let expandedOptsKeys = [];
|
|
556
459
|
let newFlattenNodes = [];
|
|
557
460
|
let filteredShownKeys = new Set([]);
|
|
558
|
-
|
|
559
461
|
if (!sugInput) {
|
|
560
462
|
expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
|
|
561
463
|
expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
|
|
@@ -572,11 +474,8 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
572
474
|
filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
|
|
573
475
|
newFlattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), showFilteredOnly && filteredShownKeys);
|
|
574
476
|
}
|
|
575
|
-
|
|
576
477
|
const newFilteredExpandedKeys = new Set(expandedOptsKeys);
|
|
577
|
-
|
|
578
478
|
this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
|
|
579
|
-
|
|
580
479
|
this._adapter.updateState({
|
|
581
480
|
expandedKeys: this._isExpandControlled() ? expandedKeys : newExpandedKeys,
|
|
582
481
|
flattenNodes: this._isExpandControlled() ? flattenNodes : newFlattenNodes,
|
|
@@ -586,21 +485,17 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
586
485
|
filteredShownKeys
|
|
587
486
|
});
|
|
588
487
|
}
|
|
589
|
-
|
|
590
488
|
handleNodeSelect(e, treeNode) {
|
|
591
489
|
const isDisabled = this._isDisabled(treeNode);
|
|
592
|
-
|
|
593
490
|
if (isDisabled) {
|
|
594
491
|
return;
|
|
595
492
|
}
|
|
596
|
-
|
|
597
493
|
if (!this._isMultiple()) {
|
|
598
494
|
this.handleSingleSelect(e, treeNode);
|
|
599
495
|
} else {
|
|
600
496
|
this.handleMultipleSelect(e, treeNode);
|
|
601
497
|
}
|
|
602
498
|
}
|
|
603
|
-
|
|
604
499
|
handleSingleSelect(e, treeNode) {
|
|
605
500
|
let {
|
|
606
501
|
selectedKeys
|
|
@@ -613,27 +508,21 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
613
508
|
eventKey,
|
|
614
509
|
data
|
|
615
510
|
} = treeNode;
|
|
616
|
-
|
|
617
511
|
this._adapter.notifySelect(eventKey, true, data);
|
|
618
|
-
|
|
619
512
|
if (!selectedKeys.includes(eventKey) && !selected) {
|
|
620
513
|
selectedKeys = [eventKey];
|
|
621
|
-
|
|
622
514
|
this._notifyChange(eventKey, e);
|
|
623
|
-
|
|
624
515
|
if (!this._isControlledComponent()) {
|
|
625
516
|
this._adapter.updateState({
|
|
626
517
|
selectedKeys
|
|
627
518
|
});
|
|
628
519
|
}
|
|
629
520
|
}
|
|
630
|
-
|
|
631
521
|
if (clickToHide && (this._isSelectToClose() || !data.children)) {
|
|
632
522
|
this.close(e);
|
|
633
523
|
this.handlerTriggerBlur(e);
|
|
634
524
|
}
|
|
635
525
|
}
|
|
636
|
-
|
|
637
526
|
calcCheckedKeys(eventKey, targetStatus) {
|
|
638
527
|
const {
|
|
639
528
|
keyEntities
|
|
@@ -642,14 +531,12 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
642
531
|
checkedKeys,
|
|
643
532
|
halfCheckedKeys
|
|
644
533
|
} = this.getCopyFromState(['checkedKeys', 'halfCheckedKeys']);
|
|
645
|
-
|
|
646
534
|
if (targetStatus) {
|
|
647
535
|
return calcCheckedKeysForChecked(eventKey, keyEntities, checkedKeys, halfCheckedKeys);
|
|
648
536
|
} else {
|
|
649
537
|
return calcCheckedKeysForUnchecked(eventKey, keyEntities, checkedKeys, halfCheckedKeys);
|
|
650
538
|
}
|
|
651
539
|
}
|
|
652
|
-
|
|
653
540
|
handleMultipleSelect(e, treeNode) {
|
|
654
541
|
const {
|
|
655
542
|
searchPosition,
|
|
@@ -665,30 +552,24 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
665
552
|
eventKey,
|
|
666
553
|
data
|
|
667
554
|
} = treeNode;
|
|
668
|
-
|
|
669
555
|
if (checkRelation === 'related') {
|
|
670
556
|
const targetStatus = disableStrictly ? this.calcCheckedStatus(!checked, eventKey) : !checked;
|
|
671
557
|
const {
|
|
672
558
|
checkedKeys,
|
|
673
559
|
halfCheckedKeys
|
|
674
560
|
} = disableStrictly ? this.calcNonDisabledCheckedKeys(eventKey, targetStatus) : this.calcCheckedKeys(eventKey, targetStatus);
|
|
675
|
-
|
|
676
561
|
this._adapter.notifySelect(eventKey, targetStatus, data);
|
|
677
|
-
|
|
678
562
|
this._notifyChange([...checkedKeys], e);
|
|
679
|
-
|
|
680
563
|
if (!this._isControlledComponent()) {
|
|
681
564
|
this._adapter.updateState({
|
|
682
565
|
checkedKeys,
|
|
683
566
|
halfCheckedKeys
|
|
684
567
|
});
|
|
685
|
-
|
|
686
568
|
this._adapter.rePositionDropdown();
|
|
687
569
|
}
|
|
688
570
|
} else if (checkRelation === 'unRelated') {
|
|
689
571
|
const newRealCheckedKeys = new Set(realCheckedKeys);
|
|
690
572
|
let targetStatus;
|
|
691
|
-
|
|
692
573
|
if (realCheckedKeys.has(eventKey)) {
|
|
693
574
|
newRealCheckedKeys.delete(eventKey);
|
|
694
575
|
targetStatus = false;
|
|
@@ -696,27 +577,21 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
696
577
|
newRealCheckedKeys.add(eventKey);
|
|
697
578
|
targetStatus = true;
|
|
698
579
|
}
|
|
699
|
-
|
|
700
580
|
this._adapter.notifySelect(eventKey, targetStatus, data);
|
|
701
|
-
|
|
702
581
|
this._notifyChange([...newRealCheckedKeys], e);
|
|
703
|
-
|
|
704
582
|
if (!this._isControlledComponent()) {
|
|
705
583
|
this._adapter.updateState({
|
|
706
584
|
realCheckedKeys: newRealCheckedKeys
|
|
707
585
|
});
|
|
708
|
-
|
|
709
586
|
this._adapter.rePositionDropdown();
|
|
710
587
|
}
|
|
711
588
|
}
|
|
712
|
-
|
|
713
589
|
if (searchPosition === strings.SEARCH_POSITION_TRIGGER && inputValue !== '') {
|
|
714
590
|
this._adapter.updateState({
|
|
715
591
|
inputValue: ''
|
|
716
592
|
});
|
|
717
593
|
}
|
|
718
594
|
}
|
|
719
|
-
|
|
720
595
|
calcNonDisabledCheckedKeys(eventKey, targetStatus) {
|
|
721
596
|
const {
|
|
722
597
|
keyEntities,
|
|
@@ -727,21 +602,17 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
727
602
|
} = this.getCopyFromState(['checkedKeys']);
|
|
728
603
|
const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
|
|
729
604
|
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
730
|
-
|
|
731
605
|
if (!hasDisabled) {
|
|
732
606
|
return this.calcCheckedKeys(eventKey, targetStatus);
|
|
733
607
|
}
|
|
734
|
-
|
|
735
608
|
const nonDisabled = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
736
609
|
const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : _difference(normalizeKeyList([...checkedKeys], keyEntities, true), nonDisabled);
|
|
737
610
|
return calcCheckedKeys(newCheckedKeys, keyEntities);
|
|
738
611
|
}
|
|
739
|
-
|
|
740
612
|
calcCheckedStatus(targetStatus, eventKey) {
|
|
741
613
|
if (!targetStatus) {
|
|
742
614
|
return targetStatus;
|
|
743
615
|
}
|
|
744
|
-
|
|
745
616
|
const {
|
|
746
617
|
checkedKeys,
|
|
747
618
|
keyEntities,
|
|
@@ -749,26 +620,21 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
749
620
|
} = this.getStates();
|
|
750
621
|
const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
|
|
751
622
|
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
752
|
-
|
|
753
623
|
if (!hasDisabled) {
|
|
754
624
|
return targetStatus;
|
|
755
625
|
}
|
|
756
|
-
|
|
757
626
|
const nonDisabledKeys = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
758
627
|
const allChecked = nonDisabledKeys.every(key => checkedKeys.has(key));
|
|
759
628
|
return !allChecked;
|
|
760
629
|
}
|
|
761
|
-
|
|
762
630
|
handleNodeExpandInSearch(e, treeNode) {
|
|
763
631
|
const {
|
|
764
632
|
treeData,
|
|
765
633
|
filteredShownKeys,
|
|
766
634
|
keyEntities
|
|
767
635
|
} = this.getStates();
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
636
|
+
const showFilteredOnly = this._showFilteredOnly();
|
|
637
|
+
// clone otherwise will be modified unexpectedly
|
|
772
638
|
const {
|
|
773
639
|
filteredExpandedKeys
|
|
774
640
|
} = this.getCopyFromState('filteredExpandedKeys');
|
|
@@ -777,18 +643,16 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
777
643
|
eventKey,
|
|
778
644
|
expanded,
|
|
779
645
|
data
|
|
780
|
-
} = treeNode;
|
|
781
|
-
|
|
646
|
+
} = treeNode;
|
|
647
|
+
// debugger;
|
|
782
648
|
if (!expanded) {
|
|
783
649
|
filteredExpandedKeys.add(eventKey);
|
|
784
650
|
} else if (filteredExpandedKeys.has(eventKey)) {
|
|
785
651
|
filteredExpandedKeys.delete(eventKey);
|
|
786
652
|
motionType = 'hide';
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
|
|
653
|
+
}
|
|
654
|
+
// cache prev flattenNodes, otherwise the calculation will remove hidden items
|
|
790
655
|
this._adapter.cacheFlattenNodes(motionType === 'hide' && this._isAnimated());
|
|
791
|
-
|
|
792
656
|
if (!this._isExpandControlled()) {
|
|
793
657
|
// debugger;
|
|
794
658
|
const flattenNodes = flattenTreeData(treeData, filteredExpandedKeys, showFilteredOnly && filteredShownKeys);
|
|
@@ -799,16 +663,13 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
799
663
|
motionKeys: new Set(motionKeys),
|
|
800
664
|
motionType
|
|
801
665
|
};
|
|
802
|
-
|
|
803
666
|
this._adapter.updateState(newState);
|
|
804
667
|
}
|
|
805
|
-
|
|
806
668
|
this._adapter.notifyExpand(filteredExpandedKeys, {
|
|
807
669
|
expanded: !expanded,
|
|
808
670
|
node: data
|
|
809
671
|
});
|
|
810
672
|
}
|
|
811
|
-
|
|
812
673
|
handleNodeExpand(e, treeNode) {
|
|
813
674
|
// debugger;
|
|
814
675
|
const {
|
|
@@ -819,22 +680,18 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
819
680
|
keyEntities
|
|
820
681
|
} = this.getStates();
|
|
821
682
|
const isSearching = Boolean(inputValue);
|
|
822
|
-
|
|
823
683
|
if (!loadData && (!treeNode.children || !treeNode.children.length)) {
|
|
824
684
|
return;
|
|
825
685
|
}
|
|
826
|
-
|
|
827
686
|
const isExpandControlled = this._isExpandControlled();
|
|
828
|
-
|
|
829
687
|
if (isSearching && !isExpandControlled) {
|
|
830
688
|
this.handleNodeExpandInSearch(e, treeNode);
|
|
831
689
|
return;
|
|
832
690
|
}
|
|
833
|
-
|
|
834
691
|
const {
|
|
835
692
|
treeData
|
|
836
|
-
} = this.getStates();
|
|
837
|
-
|
|
693
|
+
} = this.getStates();
|
|
694
|
+
// clone otherwise will be modified unexpectedly
|
|
838
695
|
const {
|
|
839
696
|
expandedKeys
|
|
840
697
|
} = this.getCopyFromState('expandedKeys');
|
|
@@ -844,16 +701,13 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
844
701
|
expanded,
|
|
845
702
|
data
|
|
846
703
|
} = treeNode;
|
|
847
|
-
|
|
848
704
|
if (!expanded) {
|
|
849
705
|
expandedKeys.add(eventKey);
|
|
850
706
|
} else if (expandedKeys.has(eventKey)) {
|
|
851
707
|
expandedKeys.delete(eventKey);
|
|
852
708
|
motionType = 'hide';
|
|
853
709
|
}
|
|
854
|
-
|
|
855
710
|
this._adapter.cacheFlattenNodes(motionType === 'hide' && this._isAnimated());
|
|
856
|
-
|
|
857
711
|
if (!isExpandControlled) {
|
|
858
712
|
// debugger;
|
|
859
713
|
const flattenNodes = flattenTreeData(treeData, expandedKeys);
|
|
@@ -864,10 +718,8 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
864
718
|
motionKeys: new Set(motionKeys),
|
|
865
719
|
motionType
|
|
866
720
|
};
|
|
867
|
-
|
|
868
721
|
this._adapter.updateState(newState);
|
|
869
722
|
}
|
|
870
|
-
|
|
871
723
|
this._adapter.notifyExpand(expandedKeys, {
|
|
872
724
|
expanded: !expanded,
|
|
873
725
|
node: data
|
|
@@ -876,8 +728,6 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
876
728
|
/**
|
|
877
729
|
* The selected items that need to be displayed in the search box when obtaining a single selection
|
|
878
730
|
*/
|
|
879
|
-
|
|
880
|
-
|
|
881
731
|
getRenderTextInSingle() {
|
|
882
732
|
const {
|
|
883
733
|
renderSelectedItem: propRenderSelectedItem,
|
|
@@ -889,20 +739,16 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
889
739
|
} = this.getStates();
|
|
890
740
|
const renderSelectedItem = _isFunction(propRenderSelectedItem) ? propRenderSelectedItem : item => _get(item, treeNodeLabelProp, null);
|
|
891
741
|
let item;
|
|
892
|
-
|
|
893
742
|
if (selectedKeys.length) {
|
|
894
743
|
const key = selectedKeys[0];
|
|
895
744
|
item = keyEntities[key] && keyEntities[key].data.key === key ? keyEntities[key].data : this.getDataForKeyNotInKeyEntities(key);
|
|
896
745
|
}
|
|
897
|
-
|
|
898
746
|
const renderText = item && treeNodeLabelProp in item ? renderSelectedItem(item) : null;
|
|
899
747
|
return renderText;
|
|
900
748
|
}
|
|
901
749
|
/**
|
|
902
750
|
* When the search box is on the trigger, the blur event handling method
|
|
903
751
|
*/
|
|
904
|
-
|
|
905
|
-
|
|
906
752
|
handleInputTriggerBlur() {
|
|
907
753
|
this._adapter.updateState({
|
|
908
754
|
inputTriggerFocus: false
|
|
@@ -911,18 +757,13 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
911
757
|
/**
|
|
912
758
|
* When the search box is on the trigger, the focus event processing method
|
|
913
759
|
*/
|
|
914
|
-
|
|
915
|
-
|
|
916
760
|
handleInputTriggerFocus() {
|
|
917
761
|
this.clearInput();
|
|
918
|
-
|
|
919
762
|
this._adapter.updateState({
|
|
920
763
|
inputTriggerFocus: true
|
|
921
764
|
});
|
|
922
765
|
}
|
|
923
|
-
|
|
924
766
|
setLoadKeys(data, resolve) {
|
|
925
767
|
this._adapter.updateLoadKeys(data, resolve);
|
|
926
768
|
}
|
|
927
|
-
|
|
928
769
|
}
|