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