@douyinfe/semi-foundation 2.36.0-alpha.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/calendar.scss +1 -1
- package/calendar/foundation.ts +2 -1
- package/datePicker/_utils/getYears.ts +8 -4
- package/datePicker/foundation.ts +1 -1
- package/datePicker/monthsGridFoundation.ts +2 -1
- package/datePicker/yearAndMonthFoundation.ts +3 -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/calendar.css +2 -2
- package/lib/cjs/calendar/calendar.scss +1 -1
- 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.d.ts +1 -1
- package/lib/cjs/datePicker/_utils/getYears.js +9 -7
- 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 +25 -25
- 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 +5 -4
- package/lib/cjs/datePicker/monthsGridFoundation.js +43 -238
- package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +3 -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.d.ts +0 -2
- package/lib/cjs/navigation/itemFoundation.js +3 -21
- package/lib/cjs/navigation/navigation.css +7 -77
- package/lib/cjs/navigation/navigation.scss +7 -119
- package/lib/cjs/navigation/subNavFoundation.d.ts +0 -2
- 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/bacisSteps.scss +238 -287
- package/lib/cjs/steps/constants.js +0 -2
- package/lib/cjs/steps/fillSteps.scss +142 -153
- package/lib/cjs/steps/navSteps.scss +40 -61
- package/lib/cjs/steps/steps.css +17 -381
- 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 +72 -302
- package/lib/cjs/table/table.css +6 -0
- package/lib/cjs/table/table.scss +12 -0
- 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/tabs/tabs.css +14 -14
- package/lib/cjs/tabs/tabs.scss +16 -14
- 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 +2 -2
- package/lib/cjs/timePicker/foundation.js +6 -102
- 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/timeline/timeline.css +0 -36
- package/lib/cjs/timeline/timeline.scss +46 -96
- 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.d.ts +1 -0
- package/lib/cjs/typography/constants.js +1 -2
- package/lib/cjs/typography/formatNumeral.d.ts +3 -3
- package/lib/cjs/typography/formatNumeral.js +16 -32
- package/lib/cjs/typography/typography.css +120 -0
- package/lib/cjs/typography/typography.scss +131 -6
- package/lib/cjs/typography/variables.scss +48 -0
- 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/calendar.css +2 -2
- package/lib/es/calendar/calendar.scss +1 -1
- 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.d.ts +1 -1
- package/lib/es/datePicker/_utils/getYears.js +9 -6
- 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 +25 -25
- 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 +5 -4
- package/lib/es/datePicker/monthsGridFoundation.js +42 -222
- package/lib/es/datePicker/yearAndMonthFoundation.d.ts +3 -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.d.ts +0 -2
- package/lib/es/navigation/itemFoundation.js +3 -18
- package/lib/es/navigation/navigation.css +7 -77
- package/lib/es/navigation/navigation.scss +7 -119
- package/lib/es/navigation/subNavFoundation.d.ts +0 -2
- 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/steps/bacisSteps.scss +238 -287
- package/lib/es/steps/fillSteps.scss +142 -153
- package/lib/es/steps/navSteps.scss +40 -61
- package/lib/es/steps/steps.css +17 -381
- 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 +72 -309
- package/lib/es/table/table.css +6 -0
- package/lib/es/table/table.scss +12 -0
- 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/tabs/tabs.css +14 -14
- package/lib/es/tabs/tabs.scss +16 -14
- 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 +2 -2
- package/lib/es/timePicker/foundation.js +7 -95
- 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/timeline/timeline.css +0 -36
- package/lib/es/timeline/timeline.scss +46 -96
- 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/constants.d.ts +1 -0
- package/lib/es/typography/constants.js +1 -0
- package/lib/es/typography/formatNumeral.d.ts +3 -3
- package/lib/es/typography/formatNumeral.js +16 -29
- package/lib/es/typography/typography.css +120 -0
- package/lib/es/typography/typography.scss +131 -6
- package/lib/es/typography/variables.scss +48 -0
- 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/navigation/itemFoundation.ts +1 -3
- package/navigation/navigation.scss +7 -119
- package/navigation/subNavFoundation.ts +1 -3
- package/overflowList/foundation.ts +4 -4
- package/package.json +2 -2
- package/steps/bacisSteps.scss +238 -287
- package/steps/fillSteps.scss +142 -153
- package/steps/navSteps.scss +40 -61
- package/table/foundation.ts +8 -10
- package/table/table.scss +12 -0
- package/tabs/tabs.scss +16 -14
- package/timePicker/foundation.ts +4 -6
- package/timeline/timeline.scss +46 -96
- package/typography/constants.ts +1 -0
- package/typography/typography.scss +131 -6
- package/typography/variables.scss +48 -0
- package/upload/foundation.ts +8 -8
|
@@ -4,27 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
9
|
-
|
|
10
8
|
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
11
|
-
|
|
12
9
|
var _pick2 = _interopRequireDefault(require("lodash/pick"));
|
|
13
|
-
|
|
14
10
|
var _difference2 = _interopRequireDefault(require("lodash/difference"));
|
|
15
|
-
|
|
16
11
|
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
|
17
|
-
|
|
18
12
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
19
|
-
|
|
20
13
|
var _treeUtil = require("./treeUtil");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
/**
|
|
16
|
+
* The drag and drop handler implementation is referenced from rc-tree
|
|
17
|
+
* https://github.com/react-component/tree
|
|
18
|
+
*/
|
|
23
19
|
|
|
24
20
|
class TreeFoundation extends _foundation.default {
|
|
25
21
|
constructor(adapter) {
|
|
26
22
|
super(Object.assign({}, adapter));
|
|
27
|
-
|
|
28
23
|
this.clearDragState = () => {
|
|
29
24
|
this._adapter.updateState({
|
|
30
25
|
dragOverNodeKey: '',
|
|
@@ -32,33 +27,26 @@ class TreeFoundation extends _foundation.default {
|
|
|
32
27
|
});
|
|
33
28
|
};
|
|
34
29
|
}
|
|
35
|
-
|
|
36
30
|
_isMultiple() {
|
|
37
31
|
return this.getProp('multiple');
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
_isAnimated() {
|
|
41
34
|
return this.getProp('motion');
|
|
42
35
|
}
|
|
43
|
-
|
|
44
36
|
_isDisabled() {
|
|
45
37
|
let treeNode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
46
38
|
return this.getProp('disabled') || treeNode.disabled;
|
|
47
39
|
}
|
|
48
|
-
|
|
49
40
|
_isExpandControlled() {
|
|
50
41
|
return !(0, _isUndefined2.default)(this.getProp('expandedKeys'));
|
|
51
42
|
}
|
|
52
|
-
|
|
53
43
|
_isLoadControlled() {
|
|
54
44
|
return !(0, _isUndefined2.default)(this.getProp('loadedKeys'));
|
|
55
45
|
}
|
|
56
|
-
|
|
57
46
|
_isFilterable() {
|
|
58
47
|
// filter can be boolean or function
|
|
59
48
|
return Boolean(this.getProp('filterTreeNode'));
|
|
60
49
|
}
|
|
61
|
-
|
|
62
50
|
_showFilteredOnly() {
|
|
63
51
|
const {
|
|
64
52
|
inputValue
|
|
@@ -68,7 +56,6 @@ class TreeFoundation extends _foundation.default {
|
|
|
68
56
|
} = this.getProps();
|
|
69
57
|
return Boolean(inputValue) && showFilteredOnly;
|
|
70
58
|
}
|
|
71
|
-
|
|
72
59
|
getCopyFromState(items) {
|
|
73
60
|
const res = {};
|
|
74
61
|
(0, _treeUtil.normalizedArr)(items).forEach(key => {
|
|
@@ -76,7 +63,6 @@ class TreeFoundation extends _foundation.default {
|
|
|
76
63
|
});
|
|
77
64
|
return res;
|
|
78
65
|
}
|
|
79
|
-
|
|
80
66
|
getTreeNodeProps(key) {
|
|
81
67
|
const {
|
|
82
68
|
expandedKeys = new Set([]),
|
|
@@ -98,15 +84,12 @@ class TreeFoundation extends _foundation.default {
|
|
|
98
84
|
} = this.getProps();
|
|
99
85
|
const entity = keyEntities[key];
|
|
100
86
|
const notExist = !entity;
|
|
101
|
-
|
|
102
87
|
if (notExist) {
|
|
103
88
|
return null;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
89
|
+
}
|
|
90
|
+
// if checkRelation is invalid, the checked status of node will be false
|
|
107
91
|
let realChecked = false;
|
|
108
92
|
let realHalfChecked = false;
|
|
109
|
-
|
|
110
93
|
if (checkRelation === 'related') {
|
|
111
94
|
realChecked = checkedKeys.has(key);
|
|
112
95
|
realHalfChecked = halfCheckedKeys.has(key);
|
|
@@ -114,7 +97,6 @@ class TreeFoundation extends _foundation.default {
|
|
|
114
97
|
realChecked = realCheckedKeys.has(key);
|
|
115
98
|
realHalfChecked = false;
|
|
116
99
|
}
|
|
117
|
-
|
|
118
100
|
const isSearching = Boolean(inputValue);
|
|
119
101
|
const treeNodeProps = {
|
|
120
102
|
eventKey: key,
|
|
@@ -130,22 +112,17 @@ class TreeFoundation extends _foundation.default {
|
|
|
130
112
|
keyword: inputValue,
|
|
131
113
|
treeNodeFilterProp
|
|
132
114
|
};
|
|
133
|
-
|
|
134
115
|
if (this.getProp('disableStrictly') && disabledKeys.has(key)) {
|
|
135
116
|
treeNodeProps.disabled = true;
|
|
136
117
|
}
|
|
137
|
-
|
|
138
118
|
return treeNodeProps;
|
|
139
119
|
}
|
|
140
|
-
|
|
141
120
|
notifyJsonChange(key, e) {
|
|
142
121
|
const data = this.getProp('treeDataSimpleJson');
|
|
143
122
|
const selectedPath = (0, _treeUtil.normalizedArr)(key).map(i => i.replace('-', '.'));
|
|
144
123
|
const value = (0, _pick2.default)(data, selectedPath);
|
|
145
|
-
|
|
146
124
|
this._adapter.notifyChange(value);
|
|
147
125
|
}
|
|
148
|
-
|
|
149
126
|
notifyMultipleChange(key, e) {
|
|
150
127
|
const {
|
|
151
128
|
keyEntities
|
|
@@ -156,36 +133,29 @@ class TreeFoundation extends _foundation.default {
|
|
|
156
133
|
} = this.getProps();
|
|
157
134
|
let value;
|
|
158
135
|
let keyList = [];
|
|
159
|
-
|
|
160
136
|
if (checkRelation === 'related') {
|
|
161
137
|
keyList = (0, _treeUtil.normalizeKeyList)(key, keyEntities, leafOnly);
|
|
162
138
|
} else if (checkRelation === 'unRelated') {
|
|
163
139
|
keyList = key;
|
|
164
140
|
}
|
|
165
|
-
|
|
166
141
|
if (this.getProp('onChangeWithObject')) {
|
|
167
142
|
value = keyList.map(itemKey => keyEntities[itemKey].data);
|
|
168
143
|
} else {
|
|
169
144
|
value = (0, _treeUtil.getValueOrKey)(keyList.map(itemKey => keyEntities[itemKey].data));
|
|
170
145
|
}
|
|
171
|
-
|
|
172
146
|
this._adapter.notifyChange(value);
|
|
173
147
|
}
|
|
174
|
-
|
|
175
148
|
notifyChange(key, e) {
|
|
176
149
|
const isMultiple = this._isMultiple();
|
|
177
|
-
|
|
178
150
|
const {
|
|
179
151
|
keyEntities
|
|
180
152
|
} = this.getStates();
|
|
181
|
-
|
|
182
153
|
if (this.getProp('treeDataSimpleJson')) {
|
|
183
154
|
this.notifyJsonChange(key, e);
|
|
184
155
|
} else if (isMultiple) {
|
|
185
156
|
this.notifyMultipleChange(key, e);
|
|
186
157
|
} else {
|
|
187
158
|
let value;
|
|
188
|
-
|
|
189
159
|
if (this.getProp('onChangeWithObject')) {
|
|
190
160
|
value = (0, _get2.default)(keyEntities, key).data;
|
|
191
161
|
} else {
|
|
@@ -194,15 +164,12 @@ class TreeFoundation extends _foundation.default {
|
|
|
194
164
|
} = (0, _get2.default)(keyEntities, key);
|
|
195
165
|
value = (0, _treeUtil.getValueOrKey)(data);
|
|
196
166
|
}
|
|
197
|
-
|
|
198
167
|
this._adapter.notifyChange(value);
|
|
199
168
|
}
|
|
200
169
|
}
|
|
201
|
-
|
|
202
170
|
handleInputChange(sugInput) {
|
|
203
171
|
// Input is a controlled component, so the value value needs to be updated
|
|
204
172
|
this._adapter.updateInputValue(sugInput);
|
|
205
|
-
|
|
206
173
|
const {
|
|
207
174
|
expandedKeys,
|
|
208
175
|
selectedKeys,
|
|
@@ -218,7 +185,6 @@ class TreeFoundation extends _foundation.default {
|
|
|
218
185
|
let expandedOptsKeys = [];
|
|
219
186
|
let flattenNodes = [];
|
|
220
187
|
let filteredShownKeys = new Set([]);
|
|
221
|
-
|
|
222
188
|
if (!sugInput) {
|
|
223
189
|
expandedOptsKeys = (0, _treeUtil.findAncestorKeys)(selectedKeys, keyEntities);
|
|
224
190
|
expandedOptsKeys.forEach(item => expandedKeys.add(item));
|
|
@@ -230,9 +196,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
230
196
|
filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
|
|
231
197
|
flattenNodes = (0, _treeUtil.flattenTreeData)(treeData, new Set(expandedOptsKeys), showFilteredOnly && filteredShownKeys);
|
|
232
198
|
}
|
|
233
|
-
|
|
234
199
|
this._adapter.notifySearch(sugInput);
|
|
235
|
-
|
|
236
200
|
this._adapter.updateState({
|
|
237
201
|
expandedKeys,
|
|
238
202
|
flattenNodes,
|
|
@@ -242,29 +206,23 @@ class TreeFoundation extends _foundation.default {
|
|
|
242
206
|
filteredShownKeys
|
|
243
207
|
});
|
|
244
208
|
}
|
|
245
|
-
|
|
246
209
|
handleNodeSelect(e, treeNode) {
|
|
247
210
|
const isDisabled = this._isDisabled(treeNode);
|
|
248
|
-
|
|
249
211
|
if (isDisabled) {
|
|
250
212
|
return;
|
|
251
213
|
}
|
|
252
|
-
|
|
253
214
|
if (!this._isMultiple()) {
|
|
254
215
|
this.handleSingleSelect(e, treeNode);
|
|
255
216
|
} else {
|
|
256
217
|
this.handleMultipleSelect(e, treeNode);
|
|
257
218
|
}
|
|
258
219
|
}
|
|
259
|
-
|
|
260
220
|
handleNodeRightClick(e, treeNode) {
|
|
261
221
|
this._adapter.notifyRightClick(e, treeNode.data);
|
|
262
222
|
}
|
|
263
|
-
|
|
264
223
|
handleNodeDoubleClick(e, treeNode) {
|
|
265
224
|
this._adapter.notifyDoubleClick(e, treeNode.data);
|
|
266
225
|
}
|
|
267
|
-
|
|
268
226
|
handleSingleSelect(e, treeNode) {
|
|
269
227
|
let {
|
|
270
228
|
selectedKeys
|
|
@@ -275,17 +233,13 @@ class TreeFoundation extends _foundation.default {
|
|
|
275
233
|
data
|
|
276
234
|
} = treeNode;
|
|
277
235
|
const targetSelected = !selected;
|
|
278
|
-
|
|
279
236
|
this._adapter.notifySelect(eventKey, true, data);
|
|
280
|
-
|
|
281
237
|
if (!targetSelected) {
|
|
282
238
|
return;
|
|
283
239
|
}
|
|
284
|
-
|
|
285
240
|
if (!selectedKeys.includes(eventKey)) {
|
|
286
241
|
selectedKeys = [eventKey];
|
|
287
242
|
this.notifyChange(eventKey, e);
|
|
288
|
-
|
|
289
243
|
if (!this._isControlledComponent()) {
|
|
290
244
|
this._adapter.updateState({
|
|
291
245
|
selectedKeys
|
|
@@ -293,7 +247,6 @@ class TreeFoundation extends _foundation.default {
|
|
|
293
247
|
}
|
|
294
248
|
}
|
|
295
249
|
}
|
|
296
|
-
|
|
297
250
|
calcCheckedKeys(eventKey, targetStatus) {
|
|
298
251
|
const {
|
|
299
252
|
keyEntities
|
|
@@ -307,28 +260,24 @@ class TreeFoundation extends _foundation.default {
|
|
|
307
260
|
/*
|
|
308
261
|
* Compute the checked state of the node
|
|
309
262
|
*/
|
|
310
|
-
|
|
311
|
-
|
|
312
263
|
calcCheckedStatus(targetStatus, eventKey) {
|
|
313
264
|
// From checked to unchecked, you can change it directly
|
|
314
265
|
if (!targetStatus) {
|
|
315
266
|
return targetStatus;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
|
|
267
|
+
}
|
|
268
|
+
// Starting from unchecked, you need to judge according to the descendant nodes
|
|
319
269
|
const {
|
|
320
270
|
checkedKeys,
|
|
321
271
|
keyEntities,
|
|
322
272
|
disabledKeys
|
|
323
273
|
} = this.getStates();
|
|
324
274
|
const descendantKeys = (0, _treeUtil.normalizeKeyList)((0, _treeUtil.findDescendantKeys)([eventKey], keyEntities, false), keyEntities, true);
|
|
325
|
-
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
326
|
-
|
|
275
|
+
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
276
|
+
// If the descendant nodes are not disabled, they will be directly changed to checked
|
|
327
277
|
if (!hasDisabled) {
|
|
328
278
|
return targetStatus;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
279
|
+
}
|
|
280
|
+
// If all descendant nodes that are not disabled are selected, return unchecked, otherwise, return checked
|
|
332
281
|
const nonDisabledKeys = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
333
282
|
const allChecked = nonDisabledKeys.every(key => checkedKeys.has(key));
|
|
334
283
|
return !allChecked;
|
|
@@ -336,8 +285,6 @@ class TreeFoundation extends _foundation.default {
|
|
|
336
285
|
/*
|
|
337
286
|
* In strict disable mode, calculate the nodes of checked and halfCheckedKeys and return their corresponding keys
|
|
338
287
|
*/
|
|
339
|
-
|
|
340
|
-
|
|
341
288
|
calcNonDisabledCheckedKeys(eventKey, targetStatus) {
|
|
342
289
|
const {
|
|
343
290
|
keyEntities,
|
|
@@ -347,12 +294,11 @@ class TreeFoundation extends _foundation.default {
|
|
|
347
294
|
checkedKeys
|
|
348
295
|
} = this.getCopyFromState(['checkedKeys']);
|
|
349
296
|
const descendantKeys = (0, _treeUtil.normalizeKeyList)((0, _treeUtil.findDescendantKeys)([eventKey], keyEntities, false), keyEntities, true);
|
|
350
|
-
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
351
|
-
|
|
297
|
+
const hasDisabled = descendantKeys.some(key => disabledKeys.has(key));
|
|
298
|
+
// If none of the descendant nodes are disabled, follow the normal logic
|
|
352
299
|
if (!hasDisabled) {
|
|
353
300
|
return this.calcCheckedKeys(eventKey, targetStatus);
|
|
354
301
|
}
|
|
355
|
-
|
|
356
302
|
const nonDisabled = descendantKeys.filter(key => !disabledKeys.has(key));
|
|
357
303
|
const newCheckedKeys = targetStatus ? [...nonDisabled, ...checkedKeys] : (0, _difference2.default)((0, _treeUtil.normalizeKeyList)([...checkedKeys], keyEntities, true), nonDisabled);
|
|
358
304
|
return (0, _treeUtil.calcCheckedKeys)(newCheckedKeys, keyEntities);
|
|
@@ -360,8 +306,6 @@ class TreeFoundation extends _foundation.default {
|
|
|
360
306
|
/*
|
|
361
307
|
* Handle the selection event in the case of multiple selection
|
|
362
308
|
*/
|
|
363
|
-
|
|
364
|
-
|
|
365
309
|
handleMultipleSelect(e, treeNode) {
|
|
366
310
|
const {
|
|
367
311
|
disableStrictly,
|
|
@@ -369,14 +313,13 @@ class TreeFoundation extends _foundation.default {
|
|
|
369
313
|
} = this.getProps();
|
|
370
314
|
const {
|
|
371
315
|
realCheckedKeys
|
|
372
|
-
} = this.getStates();
|
|
373
|
-
|
|
316
|
+
} = this.getStates();
|
|
317
|
+
// eventKey: The key value of the currently clicked node
|
|
374
318
|
const {
|
|
375
319
|
checked,
|
|
376
320
|
eventKey,
|
|
377
321
|
data
|
|
378
322
|
} = treeNode;
|
|
379
|
-
|
|
380
323
|
if (checkRelation === 'related') {
|
|
381
324
|
// Find the checked state of the current node
|
|
382
325
|
const targetStatus = disableStrictly ? this.calcCheckedStatus(!checked, eventKey) : !checked;
|
|
@@ -384,11 +327,8 @@ class TreeFoundation extends _foundation.default {
|
|
|
384
327
|
checkedKeys,
|
|
385
328
|
halfCheckedKeys
|
|
386
329
|
} = disableStrictly ? this.calcNonDisabledCheckedKeys(eventKey, targetStatus) : this.calcCheckedKeys(eventKey, targetStatus);
|
|
387
|
-
|
|
388
330
|
this._adapter.notifySelect(eventKey, targetStatus, data);
|
|
389
|
-
|
|
390
331
|
this.notifyChange([...checkedKeys], e);
|
|
391
|
-
|
|
392
332
|
if (!this._isControlledComponent()) {
|
|
393
333
|
this._adapter.updateState({
|
|
394
334
|
checkedKeys,
|
|
@@ -398,7 +338,6 @@ class TreeFoundation extends _foundation.default {
|
|
|
398
338
|
} else if (checkRelation === 'unRelated') {
|
|
399
339
|
const newRealCheckedKeys = new Set(realCheckedKeys);
|
|
400
340
|
let targetStatus;
|
|
401
|
-
|
|
402
341
|
if (realCheckedKeys.has(eventKey)) {
|
|
403
342
|
newRealCheckedKeys.delete(eventKey);
|
|
404
343
|
targetStatus = false;
|
|
@@ -406,11 +345,8 @@ class TreeFoundation extends _foundation.default {
|
|
|
406
345
|
newRealCheckedKeys.add(eventKey);
|
|
407
346
|
targetStatus = true;
|
|
408
347
|
}
|
|
409
|
-
|
|
410
348
|
this._adapter.notifySelect(eventKey, targetStatus, data);
|
|
411
|
-
|
|
412
349
|
this.notifyChange([...newRealCheckedKeys], e);
|
|
413
|
-
|
|
414
350
|
if (!this._isControlledComponent()) {
|
|
415
351
|
this._adapter.updateState({
|
|
416
352
|
realCheckedKeys: newRealCheckedKeys
|
|
@@ -418,7 +354,6 @@ class TreeFoundation extends _foundation.default {
|
|
|
418
354
|
}
|
|
419
355
|
}
|
|
420
356
|
}
|
|
421
|
-
|
|
422
357
|
setExpandedStatus(treeNode) {
|
|
423
358
|
const {
|
|
424
359
|
inputValue,
|
|
@@ -427,9 +362,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
427
362
|
keyEntities
|
|
428
363
|
} = this.getStates();
|
|
429
364
|
const isSearching = Boolean(inputValue);
|
|
430
|
-
|
|
431
365
|
const showFilteredOnly = this._showFilteredOnly();
|
|
432
|
-
|
|
433
366
|
const expandedStateKey = isSearching ? 'filteredExpandedKeys' : 'expandedKeys';
|
|
434
367
|
const expandedKeys = this.getCopyFromState(expandedStateKey)[expandedStateKey];
|
|
435
368
|
let motionType = 'show';
|
|
@@ -438,16 +371,13 @@ class TreeFoundation extends _foundation.default {
|
|
|
438
371
|
expanded,
|
|
439
372
|
data
|
|
440
373
|
} = treeNode;
|
|
441
|
-
|
|
442
374
|
if (!expanded) {
|
|
443
375
|
expandedKeys.add(eventKey);
|
|
444
376
|
} else if (expandedKeys.has(eventKey)) {
|
|
445
377
|
expandedKeys.delete(eventKey);
|
|
446
378
|
motionType = 'hide';
|
|
447
379
|
}
|
|
448
|
-
|
|
449
380
|
this._adapter.cacheFlattenNodes(motionType === 'hide' && this._isAnimated());
|
|
450
|
-
|
|
451
381
|
if (!this._isExpandControlled()) {
|
|
452
382
|
const flattenNodes = (0, _treeUtil.flattenTreeData)(treeData, expandedKeys, isSearching && showFilteredOnly && filteredShownKeys);
|
|
453
383
|
const motionKeys = this._isAnimated() ? (0, _treeUtil.getMotionKeys)(eventKey, expandedKeys, keyEntities) : [];
|
|
@@ -457,39 +387,32 @@ class TreeFoundation extends _foundation.default {
|
|
|
457
387
|
motionKeys: new Set(motionKeys),
|
|
458
388
|
motionType
|
|
459
389
|
};
|
|
460
|
-
|
|
461
390
|
this._adapter.updateState(newState);
|
|
462
391
|
}
|
|
463
|
-
|
|
464
392
|
return {
|
|
465
393
|
expandedKeys,
|
|
466
394
|
expanded: !expanded,
|
|
467
395
|
data
|
|
468
396
|
};
|
|
469
397
|
}
|
|
470
|
-
|
|
471
398
|
handleNodeExpand(e, treeNode) {
|
|
472
399
|
const {
|
|
473
400
|
loadData
|
|
474
401
|
} = this.getProps();
|
|
475
|
-
|
|
476
402
|
if (!loadData && (!treeNode.children || !treeNode.children.length)) {
|
|
477
403
|
return;
|
|
478
404
|
}
|
|
479
|
-
|
|
480
405
|
const {
|
|
481
406
|
expandedKeys,
|
|
482
407
|
data,
|
|
483
408
|
expanded
|
|
484
409
|
} = this.setExpandedStatus(treeNode);
|
|
485
|
-
|
|
486
410
|
this._adapter.notifyExpand(expandedKeys, {
|
|
487
411
|
expanded,
|
|
488
412
|
node: data
|
|
489
413
|
});
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
|
|
414
|
+
}
|
|
415
|
+
// eslint-disable-next-line max-len
|
|
493
416
|
handleNodeLoad(loadedKeys, loadingKeys, data, resolve) {
|
|
494
417
|
const {
|
|
495
418
|
loadData,
|
|
@@ -498,12 +421,10 @@ class TreeFoundation extends _foundation.default {
|
|
|
498
421
|
const {
|
|
499
422
|
key
|
|
500
423
|
} = data;
|
|
501
|
-
|
|
502
424
|
if (!loadData || loadedKeys.has(key) || loadingKeys.has(key)) {
|
|
503
425
|
return {};
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
|
|
426
|
+
}
|
|
427
|
+
// Process the loaded data
|
|
507
428
|
loadData(data).then(() => {
|
|
508
429
|
const {
|
|
509
430
|
loadedKeys: prevLoadedKeys,
|
|
@@ -511,32 +432,27 @@ class TreeFoundation extends _foundation.default {
|
|
|
511
432
|
} = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
|
|
512
433
|
const newLoadedKeys = prevLoadedKeys.add(key);
|
|
513
434
|
const newLoadingKeys = new Set([...prevLoadingKeys]);
|
|
514
|
-
newLoadingKeys.delete(key);
|
|
515
|
-
|
|
435
|
+
newLoadingKeys.delete(key);
|
|
436
|
+
// onLoad should be triggered before internal setState to avoid `loadData` being triggered twice
|
|
516
437
|
onLoad && onLoad(newLoadedKeys, data);
|
|
517
|
-
|
|
518
438
|
if (!this._isLoadControlled()) {
|
|
519
439
|
this._adapter.updateState({
|
|
520
440
|
loadedKeys: newLoadedKeys
|
|
521
441
|
});
|
|
522
442
|
}
|
|
523
|
-
|
|
524
443
|
this._adapter.setState({
|
|
525
444
|
loadingKeys: newLoadingKeys
|
|
526
445
|
});
|
|
527
|
-
|
|
528
446
|
resolve();
|
|
529
447
|
});
|
|
530
448
|
return {
|
|
531
449
|
loadingKeys: loadingKeys.add(key)
|
|
532
450
|
};
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
|
|
451
|
+
}
|
|
452
|
+
// Drag and drop related processing logic
|
|
536
453
|
getDragEventNodeData(node) {
|
|
537
454
|
return Object.assign(Object.assign({}, node.data), (0, _pick2.default)(node, ['expanded', 'pos', 'children']));
|
|
538
455
|
}
|
|
539
|
-
|
|
540
456
|
triggerDragEvent(name, event, node) {
|
|
541
457
|
let extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
542
458
|
const callEvent = this.getProp(name);
|
|
@@ -545,7 +461,6 @@ class TreeFoundation extends _foundation.default {
|
|
|
545
461
|
node: this.getDragEventNodeData(node)
|
|
546
462
|
}, extra));
|
|
547
463
|
}
|
|
548
|
-
|
|
549
464
|
handleNodeDragStart(e, treeNode) {
|
|
550
465
|
const {
|
|
551
466
|
keyEntities
|
|
@@ -559,31 +474,24 @@ class TreeFoundation extends _foundation.default {
|
|
|
559
474
|
nodeInstance,
|
|
560
475
|
data
|
|
561
476
|
} = treeNode;
|
|
562
|
-
|
|
563
477
|
if (hideDraggingNode || renderDraggingNode) {
|
|
564
478
|
let dragImg;
|
|
565
|
-
|
|
566
479
|
if (typeof renderDraggingNode === 'function') {
|
|
567
480
|
dragImg = renderDraggingNode(nodeInstance, data);
|
|
568
481
|
} else if (hideDraggingNode) {
|
|
569
482
|
dragImg = nodeInstance.cloneNode(true);
|
|
570
483
|
dragImg.style.opacity = 0;
|
|
571
484
|
}
|
|
572
|
-
|
|
573
485
|
document.body.appendChild(dragImg);
|
|
574
486
|
e.dataTransfer.setDragImage(dragImg, 0, 0);
|
|
575
487
|
}
|
|
576
|
-
|
|
577
488
|
this._adapter.setDragNode(treeNode);
|
|
578
|
-
|
|
579
489
|
this._adapter.updateState({
|
|
580
490
|
dragging: true,
|
|
581
491
|
dragNodesKeys: new Set((0, _treeUtil.getDragNodesKeys)(eventKey, keyEntities))
|
|
582
492
|
});
|
|
583
|
-
|
|
584
493
|
this.triggerDragEvent('onDragStart', e, treeNode);
|
|
585
494
|
}
|
|
586
|
-
|
|
587
495
|
handleNodeDragEnter(e, treeNode, dragNode) {
|
|
588
496
|
const {
|
|
589
497
|
dragging,
|
|
@@ -597,40 +505,33 @@ class TreeFoundation extends _foundation.default {
|
|
|
597
505
|
eventKey,
|
|
598
506
|
expanded
|
|
599
507
|
} = treeNode;
|
|
600
|
-
|
|
601
508
|
if (!dragNode || dragNodesKeys.has(eventKey)) {
|
|
602
509
|
return;
|
|
603
510
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
511
|
+
const dropPosition = (0, _treeUtil.calcDropRelativePosition)(e, treeNode);
|
|
512
|
+
// If the drag node is itself, skip
|
|
607
513
|
if (dragNode.eventKey === eventKey && dropPosition === 0) {
|
|
608
514
|
this._adapter.updateState({
|
|
609
515
|
dragOverNodeKey: '',
|
|
610
516
|
dropPosition: null
|
|
611
517
|
});
|
|
612
|
-
|
|
613
518
|
return;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
|
|
519
|
+
}
|
|
520
|
+
// Trigger dragenter after clearing the prev state in dragleave
|
|
617
521
|
setTimeout(() => {
|
|
618
522
|
this._adapter.updateState({
|
|
619
523
|
dragOverNodeKey: eventKey,
|
|
620
524
|
dropPosition
|
|
621
|
-
});
|
|
622
|
-
|
|
623
|
-
|
|
525
|
+
});
|
|
526
|
+
// If autoExpand is already expanded or not allowed, trigger the event and return
|
|
624
527
|
if (!autoExpandWhenDragEnter || expanded) {
|
|
625
528
|
this.triggerDragEvent('onDragEnter', e, treeNode);
|
|
626
529
|
return;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
|
|
530
|
+
}
|
|
531
|
+
// Side effects of delayed drag
|
|
630
532
|
if (!this.delayedDragEnterLogic) {
|
|
631
533
|
this.delayedDragEnterLogic = {};
|
|
632
534
|
}
|
|
633
|
-
|
|
634
535
|
Object.keys(this.delayedDragEnterLogic).forEach(key => {
|
|
635
536
|
clearTimeout(this.delayedDragEnterLogic[key]);
|
|
636
537
|
});
|
|
@@ -638,7 +539,6 @@ class TreeFoundation extends _foundation.default {
|
|
|
638
539
|
if (!dragging) {
|
|
639
540
|
return;
|
|
640
541
|
}
|
|
641
|
-
|
|
642
542
|
const {
|
|
643
543
|
expandedKeys: newExpandedKeys
|
|
644
544
|
} = this.setExpandedStatus(treeNode);
|
|
@@ -648,7 +548,6 @@ class TreeFoundation extends _foundation.default {
|
|
|
648
548
|
}, 400);
|
|
649
549
|
}, 0);
|
|
650
550
|
}
|
|
651
|
-
|
|
652
551
|
handleNodeDragOver(e, treeNode, dragNode) {
|
|
653
552
|
const {
|
|
654
553
|
dropPosition,
|
|
@@ -658,42 +557,32 @@ class TreeFoundation extends _foundation.default {
|
|
|
658
557
|
const {
|
|
659
558
|
eventKey
|
|
660
559
|
} = treeNode;
|
|
661
|
-
|
|
662
560
|
if (dragNodesKeys.has(eventKey)) {
|
|
663
561
|
return;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
|
|
562
|
+
}
|
|
563
|
+
// Update the drag position
|
|
667
564
|
if (dragNode && eventKey === dragOverNodeKey) {
|
|
668
565
|
const newPos = (0, _treeUtil.calcDropRelativePosition)(e, treeNode);
|
|
669
|
-
|
|
670
566
|
if (dropPosition === newPos) {
|
|
671
567
|
return;
|
|
672
568
|
}
|
|
673
|
-
|
|
674
569
|
this._adapter.updateState({
|
|
675
570
|
dropPosition: newPos
|
|
676
571
|
});
|
|
677
572
|
}
|
|
678
|
-
|
|
679
573
|
this.triggerDragEvent('onDragOver', e, treeNode);
|
|
680
574
|
}
|
|
681
|
-
|
|
682
575
|
handleNodeDragLeave(e, treeNode) {
|
|
683
576
|
this._adapter.updateState({
|
|
684
577
|
dragOverNodeKey: ''
|
|
685
578
|
});
|
|
686
|
-
|
|
687
579
|
this.triggerDragEvent('onDragLeave', e, treeNode);
|
|
688
580
|
}
|
|
689
|
-
|
|
690
581
|
handleNodeDragEnd(e, treeNode) {
|
|
691
582
|
this.clearDragState();
|
|
692
583
|
this.triggerDragEvent('onDragEnd', e, treeNode);
|
|
693
|
-
|
|
694
584
|
this._adapter.setDragNode(null);
|
|
695
585
|
}
|
|
696
|
-
|
|
697
586
|
handleNodeDrop(e, treeNode, dragNode) {
|
|
698
587
|
const {
|
|
699
588
|
dropPosition,
|
|
@@ -704,11 +593,9 @@ class TreeFoundation extends _foundation.default {
|
|
|
704
593
|
pos
|
|
705
594
|
} = treeNode;
|
|
706
595
|
this.clearDragState();
|
|
707
|
-
|
|
708
596
|
if (dragNodesKeys.has(eventKey)) {
|
|
709
597
|
return;
|
|
710
598
|
}
|
|
711
|
-
|
|
712
599
|
const dropRes = {
|
|
713
600
|
dragNode: dragNode ? this.getDragEventNodeData(dragNode) : null,
|
|
714
601
|
dragNodesKeys: [...dragNodesKeys],
|
|
@@ -716,10 +603,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
716
603
|
dropToGap: dropPosition !== 0
|
|
717
604
|
};
|
|
718
605
|
this.triggerDragEvent('onDrop', e, treeNode, dropRes);
|
|
719
|
-
|
|
720
606
|
this._adapter.setDragNode(null);
|
|
721
607
|
}
|
|
722
|
-
|
|
723
608
|
}
|
|
724
|
-
|
|
725
609
|
exports.default = TreeFoundation;
|