@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
|
@@ -6,70 +6,58 @@ import _noop from "lodash/noop";
|
|
|
6
6
|
import BaseFoundation from '../base/foundation';
|
|
7
7
|
import { strings } from './constants';
|
|
8
8
|
import { ENTER_KEY } from './../utils/keyCode';
|
|
9
|
-
|
|
10
9
|
class InputFoundation extends BaseFoundation {
|
|
11
|
-
constructor(adapter) {
|
|
12
|
-
super(Object.assign(Object.assign({}, InputFoundation.inputDefaultAdapter), adapter));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
10
|
static get inputDefaultAdapter() {
|
|
16
11
|
return {
|
|
17
12
|
notifyChange: _noop,
|
|
18
|
-
setValue: _noop
|
|
19
|
-
|
|
13
|
+
setValue: _noop
|
|
14
|
+
// toggleAllowClear: noop,
|
|
20
15
|
};
|
|
21
16
|
}
|
|
22
17
|
|
|
18
|
+
constructor(adapter) {
|
|
19
|
+
super(Object.assign(Object.assign({}, InputFoundation.inputDefaultAdapter), adapter));
|
|
20
|
+
}
|
|
23
21
|
init() {
|
|
24
22
|
this._setInitValue();
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
destroy() {
|
|
28
25
|
if (this._timer) {
|
|
29
26
|
clearTimeout(this._timer);
|
|
30
27
|
this._timer = null;
|
|
31
28
|
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
}
|
|
30
|
+
// eslint-disable-next-line
|
|
35
31
|
setDisable() {}
|
|
36
|
-
|
|
37
32
|
_setInitValue() {
|
|
38
33
|
const {
|
|
39
34
|
defaultValue,
|
|
40
35
|
value
|
|
41
36
|
} = this.getProps();
|
|
42
37
|
let v = defaultValue;
|
|
43
|
-
|
|
44
38
|
if (this._isControlledComponent()) {
|
|
45
39
|
v = value;
|
|
46
40
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
this._adapter.setValue(v);
|
|
42
|
+
// this.checkAllowClear(v);
|
|
50
43
|
}
|
|
51
44
|
|
|
52
45
|
setValue(value) {
|
|
53
46
|
this._adapter.setValue(value);
|
|
54
47
|
}
|
|
55
|
-
|
|
56
48
|
handleChange(value, e) {
|
|
57
49
|
const {
|
|
58
50
|
maxLength,
|
|
59
51
|
minLength,
|
|
60
52
|
getValueLength
|
|
61
53
|
} = this._adapter.getProps();
|
|
62
|
-
|
|
63
54
|
let nextValue = value;
|
|
64
|
-
|
|
65
55
|
if (maxLength && _isFunction(getValueLength)) {
|
|
66
56
|
nextValue = this.handleVisibleMaxLength(value);
|
|
67
57
|
}
|
|
68
|
-
|
|
69
58
|
if (minLength && _isFunction(getValueLength)) {
|
|
70
59
|
this.handleVisibleMinLength(nextValue);
|
|
71
60
|
}
|
|
72
|
-
|
|
73
61
|
if (this._isControlledComponent()) {
|
|
74
62
|
/**
|
|
75
63
|
* If it is a controlled component, directly notify the caller of the modified value.
|
|
@@ -79,9 +67,8 @@ class InputFoundation extends BaseFoundation {
|
|
|
79
67
|
this._adapter.notifyChange(nextValue, e);
|
|
80
68
|
} else {
|
|
81
69
|
this._adapter.setValue(nextValue);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
70
|
+
this._adapter.notifyChange(nextValue, e);
|
|
71
|
+
// this.checkAllowClear(value);
|
|
85
72
|
}
|
|
86
73
|
}
|
|
87
74
|
/**
|
|
@@ -89,21 +76,16 @@ class InputFoundation extends BaseFoundation {
|
|
|
89
76
|
* Controlled mode is not checked
|
|
90
77
|
* @param {String} value
|
|
91
78
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
79
|
handleVisibleMinLength(value) {
|
|
95
80
|
const {
|
|
96
81
|
minLength,
|
|
97
82
|
getValueLength
|
|
98
83
|
} = this._adapter.getProps();
|
|
99
|
-
|
|
100
84
|
const {
|
|
101
85
|
minLength: stateMinLength
|
|
102
86
|
} = this._adapter.getStates();
|
|
103
|
-
|
|
104
87
|
if (_isNumber(minLength) && minLength >= 0 && _isFunction(getValueLength) && _isString(value)) {
|
|
105
88
|
const valueLength = getValueLength(value);
|
|
106
|
-
|
|
107
89
|
if (valueLength < minLength) {
|
|
108
90
|
const newMinLength = value.length + (minLength - valueLength);
|
|
109
91
|
newMinLength !== stateMinLength && this._adapter.setMinLength(newMinLength);
|
|
@@ -117,17 +99,13 @@ class InputFoundation extends BaseFoundation {
|
|
|
117
99
|
* Controlled mode is not checked
|
|
118
100
|
* @param {String} value
|
|
119
101
|
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
102
|
handleVisibleMaxLength(value) {
|
|
123
103
|
const {
|
|
124
104
|
maxLength,
|
|
125
105
|
getValueLength
|
|
126
106
|
} = this._adapter.getProps();
|
|
127
|
-
|
|
128
107
|
if (_isNumber(maxLength) && maxLength >= 0 && _isFunction(getValueLength) && _isString(value)) {
|
|
129
108
|
const valueLength = getValueLength(value);
|
|
130
|
-
|
|
131
109
|
if (valueLength > maxLength) {
|
|
132
110
|
// eslint-disable-next-line max-len
|
|
133
111
|
console.warn('[Semi Input] The input character is truncated because the input length exceeds the maximum length limit');
|
|
@@ -144,36 +122,29 @@ class InputFoundation extends BaseFoundation {
|
|
|
144
122
|
* @param {Number} maxLength
|
|
145
123
|
* @returns {String}
|
|
146
124
|
*/
|
|
147
|
-
|
|
148
|
-
|
|
149
125
|
handleTruncateValue(value, maxLength) {
|
|
150
126
|
const {
|
|
151
127
|
getValueLength
|
|
152
128
|
} = this._adapter.getProps();
|
|
153
|
-
|
|
154
129
|
if (_isFunction(getValueLength)) {
|
|
155
130
|
let truncatedValue = '';
|
|
156
|
-
|
|
157
131
|
for (let i = 1, len = value.length; i <= len; i++) {
|
|
158
132
|
const currentValue = value.slice(0, i);
|
|
159
|
-
|
|
160
133
|
if (getValueLength(currentValue) > maxLength) {
|
|
161
134
|
return truncatedValue;
|
|
162
135
|
} else {
|
|
163
136
|
truncatedValue = currentValue;
|
|
164
137
|
}
|
|
165
138
|
}
|
|
166
|
-
|
|
167
139
|
return truncatedValue;
|
|
168
140
|
} else {
|
|
169
141
|
return value.slice(0, maxLength);
|
|
170
142
|
}
|
|
171
143
|
}
|
|
172
|
-
|
|
173
144
|
handleClear(e) {
|
|
174
145
|
let eventObj = e;
|
|
175
|
-
const value = '';
|
|
176
|
-
|
|
146
|
+
const value = '';
|
|
147
|
+
// let input = this._adapter.getInput();
|
|
177
148
|
if (this._isControlledComponent('value')) {
|
|
178
149
|
this._adapter.setState({
|
|
179
150
|
isFocus: false
|
|
@@ -184,18 +155,12 @@ class InputFoundation extends BaseFoundation {
|
|
|
184
155
|
isFocus: false
|
|
185
156
|
});
|
|
186
157
|
}
|
|
187
|
-
|
|
188
158
|
if (!eventObj || typeof eventObj !== 'object') {
|
|
189
159
|
eventObj = {};
|
|
190
160
|
}
|
|
191
|
-
|
|
192
161
|
_set(eventObj, strings.CLEARBTN_CLICKED_EVENT_FLAG, true); // this is useful for DateInput
|
|
193
|
-
|
|
194
|
-
|
|
195
162
|
this._adapter.notifyChange(value, eventObj);
|
|
196
|
-
|
|
197
163
|
this._adapter.notifyClear(eventObj);
|
|
198
|
-
|
|
199
164
|
if (eventObj) {
|
|
200
165
|
// When input is in popover and popover needs to judge clickOutSide, such as TreeSelect
|
|
201
166
|
// If the click event bubbles up, it will mistakenly trigger clickOutSide's judgment.
|
|
@@ -208,29 +173,22 @@ class InputFoundation extends BaseFoundation {
|
|
|
208
173
|
* trigger when click input wrapper
|
|
209
174
|
* @param {Event} e
|
|
210
175
|
*/
|
|
211
|
-
|
|
212
|
-
|
|
213
176
|
handleClick(e) {
|
|
214
177
|
const {
|
|
215
178
|
disabled
|
|
216
179
|
} = this._adapter.getProps();
|
|
217
|
-
|
|
218
180
|
const {
|
|
219
181
|
isFocus
|
|
220
182
|
} = this._adapter.getStates();
|
|
221
|
-
|
|
222
183
|
if (disabled || isFocus) {
|
|
223
184
|
return;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
185
|
+
}
|
|
186
|
+
// do not handle bubbling up events
|
|
227
187
|
if (this._adapter.isEventTarget(e)) {
|
|
228
188
|
this._adapter.focusInput();
|
|
229
|
-
|
|
230
189
|
this._adapter.toggleFocusing(true);
|
|
231
190
|
}
|
|
232
191
|
}
|
|
233
|
-
|
|
234
192
|
handleModeChange(mode) {
|
|
235
193
|
if (mode === 'password') {
|
|
236
194
|
this._adapter.setEyeClosed(true);
|
|
@@ -238,106 +196,78 @@ class InputFoundation extends BaseFoundation {
|
|
|
238
196
|
this._adapter.setEyeClosed(false);
|
|
239
197
|
}
|
|
240
198
|
}
|
|
241
|
-
|
|
242
199
|
handleClickEye(e) {
|
|
243
200
|
const eyeClosed = this._adapter.getState('eyeClosed');
|
|
244
|
-
|
|
245
201
|
this._adapter.focusInput();
|
|
246
|
-
|
|
247
202
|
this._adapter.toggleFocusing(true);
|
|
248
|
-
|
|
249
203
|
this._adapter.setEyeClosed(!eyeClosed);
|
|
250
204
|
}
|
|
251
|
-
|
|
252
205
|
handleInputType(type) {
|
|
253
206
|
const mode = this._adapter.getProp('mode');
|
|
254
|
-
|
|
255
207
|
const eyeClosed = this._adapter.getState('eyeClosed');
|
|
256
|
-
|
|
257
208
|
if (mode === 'password') {
|
|
258
209
|
return eyeClosed ? 'password' : 'text';
|
|
259
210
|
}
|
|
260
|
-
|
|
261
211
|
return type;
|
|
262
212
|
}
|
|
263
|
-
|
|
264
213
|
handleMouseDown(e) {
|
|
265
214
|
e.preventDefault();
|
|
266
215
|
}
|
|
267
|
-
|
|
268
216
|
handleMouseUp(e) {
|
|
269
217
|
e.preventDefault();
|
|
270
218
|
}
|
|
271
|
-
|
|
272
219
|
handleBlur(e) {
|
|
273
220
|
const {
|
|
274
221
|
value
|
|
275
222
|
} = this.getStates();
|
|
276
|
-
|
|
277
223
|
this._adapter.toggleFocusing(false);
|
|
278
|
-
|
|
279
224
|
this._adapter.notifyBlur(value, e);
|
|
280
225
|
}
|
|
281
|
-
|
|
282
226
|
handleFocus(e) {
|
|
283
227
|
const {
|
|
284
228
|
value
|
|
285
229
|
} = this.getStates();
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
230
|
+
this._adapter.toggleFocusing(true);
|
|
231
|
+
// this.checkAllowClear(this.getState('value'), true);
|
|
290
232
|
this._adapter.notifyFocus(value, e);
|
|
291
233
|
}
|
|
292
|
-
|
|
293
234
|
handleInput(e) {
|
|
294
235
|
this._adapter.notifyInput(e);
|
|
295
236
|
}
|
|
296
|
-
|
|
297
237
|
handleKeyDown(e) {
|
|
298
238
|
this._adapter.notifyKeyDown(e);
|
|
299
239
|
}
|
|
300
|
-
|
|
301
240
|
handleKeyUp(e) {
|
|
302
241
|
this._adapter.notifyKeyUp(e);
|
|
303
242
|
}
|
|
304
|
-
|
|
305
243
|
handleKeyPress(e) {
|
|
306
244
|
this._adapter.notifyKeyPress(e);
|
|
307
|
-
|
|
308
245
|
if (e.key === ENTER_KEY) {
|
|
309
246
|
this._adapter.notifyEnterPress(e);
|
|
310
247
|
}
|
|
311
248
|
}
|
|
312
|
-
|
|
313
249
|
isAllowClear() {
|
|
314
250
|
const {
|
|
315
251
|
value,
|
|
316
252
|
isFocus,
|
|
317
253
|
isHovering
|
|
318
254
|
} = this._adapter.getStates();
|
|
319
|
-
|
|
320
255
|
const {
|
|
321
256
|
showClear,
|
|
322
257
|
disabled
|
|
323
258
|
} = this._adapter.getProps();
|
|
324
|
-
|
|
325
259
|
const allowClear = value && showClear && !disabled && (isFocus || isHovering);
|
|
326
260
|
return allowClear;
|
|
327
261
|
}
|
|
328
|
-
|
|
329
262
|
handleClickPrefixOrSuffix(e) {
|
|
330
263
|
const {
|
|
331
264
|
disabled
|
|
332
265
|
} = this._adapter.getProps();
|
|
333
|
-
|
|
334
266
|
const {
|
|
335
267
|
isFocus
|
|
336
268
|
} = this._adapter.getStates();
|
|
337
|
-
|
|
338
269
|
if (!disabled && !isFocus) {
|
|
339
270
|
this._adapter.focusInput();
|
|
340
|
-
|
|
341
271
|
this._adapter.toggleFocusing(true);
|
|
342
272
|
}
|
|
343
273
|
}
|
|
@@ -345,8 +275,6 @@ class InputFoundation extends BaseFoundation {
|
|
|
345
275
|
* Blocking mousedown events prevents input from losing focus
|
|
346
276
|
* @param {Event} e
|
|
347
277
|
*/
|
|
348
|
-
|
|
349
|
-
|
|
350
278
|
handlePreventMouseDown(e) {
|
|
351
279
|
if (e && _isFunction(e.preventDefault)) {
|
|
352
280
|
e.preventDefault();
|
|
@@ -355,8 +283,6 @@ class InputFoundation extends BaseFoundation {
|
|
|
355
283
|
/**
|
|
356
284
|
* A11y: simulate password button click
|
|
357
285
|
*/
|
|
358
|
-
|
|
359
|
-
|
|
360
286
|
handleModeEnterPress(e) {
|
|
361
287
|
// trigger by Enter or Space key
|
|
362
288
|
if (['Enter', ' '].includes(e === null || e === void 0 ? void 0 : e.key)) {
|
|
@@ -364,7 +290,5 @@ class InputFoundation extends BaseFoundation {
|
|
|
364
290
|
this.handleClickEye(e);
|
|
365
291
|
}
|
|
366
292
|
}
|
|
367
|
-
|
|
368
293
|
}
|
|
369
|
-
|
|
370
294
|
export default InputFoundation;
|
|
@@ -6,9 +6,20 @@ import BaseFoundation from '../base/foundation';
|
|
|
6
6
|
import calculateNodeHeight from './util/calculateNodeHeight';
|
|
7
7
|
import getSizingData from './util/getSizingData';
|
|
8
8
|
export default class TextAreaFoundation extends BaseFoundation {
|
|
9
|
+
static get textAreaDefaultAdapter() {
|
|
10
|
+
return {
|
|
11
|
+
notifyChange: _noop,
|
|
12
|
+
setValue: _noop,
|
|
13
|
+
toggleFocusing: _noop,
|
|
14
|
+
toggleHovering: _noop,
|
|
15
|
+
notifyFocus: _noop,
|
|
16
|
+
notifyBlur: _noop,
|
|
17
|
+
notifyKeyDown: _noop,
|
|
18
|
+
notifyEnterPress: _noop
|
|
19
|
+
};
|
|
20
|
+
}
|
|
9
21
|
constructor(adapter) {
|
|
10
22
|
super(Object.assign(Object.assign({}, TextAreaFoundation.textAreaDefaultAdapter), adapter));
|
|
11
|
-
|
|
12
23
|
this.resizeTextarea = cb => {
|
|
13
24
|
const {
|
|
14
25
|
height
|
|
@@ -16,90 +27,60 @@ export default class TextAreaFoundation extends BaseFoundation {
|
|
|
16
27
|
const {
|
|
17
28
|
rows
|
|
18
29
|
} = this.getProps();
|
|
19
|
-
|
|
20
30
|
const node = this._adapter.getRef();
|
|
21
|
-
|
|
22
31
|
const nodeSizingData = getSizingData(node);
|
|
23
|
-
|
|
24
32
|
if (!nodeSizingData) {
|
|
25
33
|
cb && cb();
|
|
26
34
|
return;
|
|
27
35
|
}
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
const newHeight = calculateNodeHeight(nodeSizingData, node.value || node.placeholder || 'x', rows
|
|
37
|
+
// maxRows,
|
|
30
38
|
);
|
|
31
39
|
|
|
32
40
|
if (height !== newHeight) {
|
|
33
41
|
this._adapter.notifyHeightUpdate(newHeight);
|
|
34
|
-
|
|
35
42
|
node.style.height = `${newHeight}px`;
|
|
36
43
|
return;
|
|
37
44
|
}
|
|
38
|
-
|
|
39
45
|
cb && cb();
|
|
40
46
|
};
|
|
41
47
|
}
|
|
42
|
-
|
|
43
|
-
static get textAreaDefaultAdapter() {
|
|
44
|
-
return {
|
|
45
|
-
notifyChange: _noop,
|
|
46
|
-
setValue: _noop,
|
|
47
|
-
toggleFocusing: _noop,
|
|
48
|
-
toggleHovering: _noop,
|
|
49
|
-
notifyFocus: _noop,
|
|
50
|
-
notifyBlur: _noop,
|
|
51
|
-
notifyKeyDown: _noop,
|
|
52
|
-
notifyEnterPress: _noop
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
48
|
init() {
|
|
57
49
|
this.setInitValue();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
}
|
|
51
|
+
// eslint-disable-next-line
|
|
61
52
|
destroy() {}
|
|
62
|
-
|
|
63
53
|
setInitValue() {
|
|
64
54
|
const {
|
|
65
55
|
defaultValue,
|
|
66
56
|
value
|
|
67
57
|
} = this.getProps();
|
|
68
58
|
let v = defaultValue;
|
|
69
|
-
|
|
70
59
|
if (this._isControlledComponent()) {
|
|
71
60
|
v = value;
|
|
72
61
|
}
|
|
73
|
-
|
|
74
62
|
this._adapter.setValue(v);
|
|
75
63
|
}
|
|
76
|
-
|
|
77
64
|
handleValueChange(v) {
|
|
78
65
|
this._adapter.setValue(v);
|
|
79
66
|
}
|
|
80
|
-
|
|
81
67
|
handleChange(value, e) {
|
|
82
68
|
const {
|
|
83
69
|
maxLength,
|
|
84
70
|
minLength,
|
|
85
71
|
getValueLength
|
|
86
72
|
} = this._adapter.getProps();
|
|
87
|
-
|
|
88
73
|
let nextValue = value;
|
|
89
|
-
|
|
90
74
|
if (maxLength && _isFunction(getValueLength)) {
|
|
91
75
|
nextValue = this.handleVisibleMaxLength(value);
|
|
92
76
|
}
|
|
93
|
-
|
|
94
77
|
if (minLength && _isFunction(getValueLength)) {
|
|
95
78
|
this.handleVisibleMinLength(nextValue);
|
|
96
79
|
}
|
|
97
|
-
|
|
98
80
|
if (this._isControlledComponent()) {
|
|
99
81
|
this._adapter.notifyChange(nextValue, e);
|
|
100
82
|
} else {
|
|
101
83
|
this._adapter.setValue(nextValue);
|
|
102
|
-
|
|
103
84
|
this._adapter.notifyChange(nextValue, e);
|
|
104
85
|
}
|
|
105
86
|
}
|
|
@@ -108,21 +89,16 @@ export default class TextAreaFoundation extends BaseFoundation {
|
|
|
108
89
|
* Controlled mode is not checked
|
|
109
90
|
* @param {String} value
|
|
110
91
|
*/
|
|
111
|
-
|
|
112
|
-
|
|
113
92
|
handleVisibleMinLength(value) {
|
|
114
93
|
const {
|
|
115
94
|
minLength,
|
|
116
95
|
getValueLength
|
|
117
96
|
} = this._adapter.getProps();
|
|
118
|
-
|
|
119
97
|
const {
|
|
120
98
|
minLength: stateMinLength
|
|
121
99
|
} = this._adapter.getStates();
|
|
122
|
-
|
|
123
100
|
if (_isNumber(minLength) && minLength >= 0 && _isFunction(getValueLength) && _isString(value)) {
|
|
124
101
|
const valueLength = getValueLength(value);
|
|
125
|
-
|
|
126
102
|
if (valueLength < minLength) {
|
|
127
103
|
const newMinLength = value.length + (minLength - valueLength);
|
|
128
104
|
newMinLength !== stateMinLength && this._adapter.setMinLength(newMinLength);
|
|
@@ -136,17 +112,13 @@ export default class TextAreaFoundation extends BaseFoundation {
|
|
|
136
112
|
* Controlled mode is not checked
|
|
137
113
|
* @param {String} value
|
|
138
114
|
*/
|
|
139
|
-
|
|
140
|
-
|
|
141
115
|
handleVisibleMaxLength(value) {
|
|
142
116
|
const {
|
|
143
117
|
maxLength,
|
|
144
118
|
getValueLength
|
|
145
119
|
} = this._adapter.getProps();
|
|
146
|
-
|
|
147
120
|
if (_isNumber(maxLength) && maxLength >= 0 && _isFunction(getValueLength) && _isString(value)) {
|
|
148
121
|
const valueLength = getValueLength(value);
|
|
149
|
-
|
|
150
122
|
if (valueLength > maxLength) {
|
|
151
123
|
// eslint-disable-next-line max-len
|
|
152
124
|
console.warn('[Semi TextArea] The input character is truncated because the input length exceeds the maximum length limit');
|
|
@@ -156,7 +128,6 @@ export default class TextAreaFoundation extends BaseFoundation {
|
|
|
156
128
|
return value;
|
|
157
129
|
}
|
|
158
130
|
}
|
|
159
|
-
|
|
160
131
|
return undefined;
|
|
161
132
|
}
|
|
162
133
|
/**
|
|
@@ -165,92 +136,71 @@ export default class TextAreaFoundation extends BaseFoundation {
|
|
|
165
136
|
* @param {Number} maxLength
|
|
166
137
|
* @returns {String}
|
|
167
138
|
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
139
|
handleTruncateValue(value, maxLength) {
|
|
171
140
|
const {
|
|
172
141
|
getValueLength
|
|
173
142
|
} = this._adapter.getProps();
|
|
174
|
-
|
|
175
143
|
if (_isFunction(getValueLength)) {
|
|
176
144
|
let truncatedValue = '';
|
|
177
|
-
|
|
178
145
|
for (let i = 1, len = value.length; i <= len; i++) {
|
|
179
146
|
const currentValue = value.slice(0, i);
|
|
180
|
-
|
|
181
147
|
if (getValueLength(currentValue) > maxLength) {
|
|
182
148
|
return truncatedValue;
|
|
183
149
|
} else {
|
|
184
150
|
truncatedValue = currentValue;
|
|
185
151
|
}
|
|
186
152
|
}
|
|
187
|
-
|
|
188
153
|
return truncatedValue;
|
|
189
154
|
} else {
|
|
190
155
|
return value.slice(0, maxLength);
|
|
191
156
|
}
|
|
192
157
|
}
|
|
193
|
-
|
|
194
158
|
handleFocus(e) {
|
|
195
159
|
const {
|
|
196
160
|
value
|
|
197
161
|
} = this.getStates();
|
|
198
|
-
|
|
199
162
|
this._adapter.toggleFocusing(true);
|
|
200
|
-
|
|
201
163
|
this._adapter.notifyFocus(value, e);
|
|
202
164
|
}
|
|
203
|
-
|
|
204
165
|
handleBlur(e) {
|
|
205
166
|
const {
|
|
206
167
|
value
|
|
207
168
|
} = this.getStates();
|
|
208
|
-
|
|
209
169
|
this._adapter.toggleFocusing(false);
|
|
210
|
-
|
|
211
170
|
this._adapter.notifyBlur(value, e);
|
|
212
171
|
}
|
|
213
|
-
|
|
214
172
|
handleKeyDown(e) {
|
|
215
173
|
this._adapter.notifyKeyDown(e);
|
|
216
|
-
|
|
217
174
|
if (e.keyCode === 13) {
|
|
218
175
|
this._adapter.notifyPressEnter(e);
|
|
219
176
|
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
177
|
+
}
|
|
178
|
+
// e: MouseEvent
|
|
223
179
|
handleMouseEnter(e) {
|
|
224
180
|
this._adapter.toggleHovering(true);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
181
|
+
}
|
|
182
|
+
// e: MouseEvent
|
|
228
183
|
handleMouseLeave(e) {
|
|
229
184
|
this._adapter.toggleHovering(false);
|
|
230
185
|
}
|
|
231
|
-
|
|
232
186
|
isAllowClear() {
|
|
233
187
|
const {
|
|
234
188
|
value,
|
|
235
189
|
isFocus,
|
|
236
190
|
isHover
|
|
237
191
|
} = this._adapter.getStates();
|
|
238
|
-
|
|
239
192
|
const {
|
|
240
193
|
showClear,
|
|
241
194
|
disabled,
|
|
242
195
|
readonly
|
|
243
196
|
} = this._adapter.getProps();
|
|
244
|
-
|
|
245
197
|
const allowClear = value && showClear && !disabled && (isFocus || isHover) && !readonly;
|
|
246
198
|
return allowClear;
|
|
247
199
|
}
|
|
248
|
-
|
|
249
200
|
handleClear(e) {
|
|
250
201
|
const {
|
|
251
202
|
isFocus
|
|
252
203
|
} = this.getStates();
|
|
253
|
-
|
|
254
204
|
if (this._isControlledComponent('value')) {
|
|
255
205
|
this._adapter.setState({
|
|
256
206
|
isFocus: false
|
|
@@ -261,16 +211,11 @@ export default class TextAreaFoundation extends BaseFoundation {
|
|
|
261
211
|
isFocus: false
|
|
262
212
|
});
|
|
263
213
|
}
|
|
264
|
-
|
|
265
214
|
if (isFocus) {
|
|
266
215
|
this._adapter.notifyBlur('', e);
|
|
267
216
|
}
|
|
268
|
-
|
|
269
217
|
this._adapter.notifyChange('', e);
|
|
270
|
-
|
|
271
218
|
this._adapter.notifyClear(e);
|
|
272
|
-
|
|
273
219
|
this.stopPropagation(e);
|
|
274
220
|
}
|
|
275
|
-
|
|
276
221
|
}
|
|
@@ -11,40 +11,32 @@ const HIDDEN_TEXTAREA_STYLE = {
|
|
|
11
11
|
top: '0',
|
|
12
12
|
right: '0'
|
|
13
13
|
};
|
|
14
|
-
|
|
15
14
|
const forceHiddenStyles = node => {
|
|
16
15
|
Object.keys(HIDDEN_TEXTAREA_STYLE).forEach(key => {
|
|
17
16
|
node.style.setProperty(key, HIDDEN_TEXTAREA_STYLE[key], 'important');
|
|
18
17
|
});
|
|
19
18
|
};
|
|
20
|
-
|
|
21
19
|
const getContentHeight = (node, sizingData) => {
|
|
22
20
|
const height = node.scrollHeight;
|
|
23
|
-
|
|
24
21
|
if (sizingData.sizingStyle.boxSizing === 'border-box') {
|
|
25
22
|
// border-box: add border, since height = content + padding + border
|
|
26
23
|
return height + sizingData.borderSize;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
}
|
|
25
|
+
// remove padding, since height = content
|
|
30
26
|
return height - sizingData.paddingSize;
|
|
31
27
|
};
|
|
32
|
-
|
|
33
28
|
export default function calculateNodeHeight(sizingData, value) {
|
|
34
29
|
let minRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
35
30
|
let maxRows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Infinity;
|
|
36
|
-
|
|
37
31
|
if (!hiddenTextarea) {
|
|
38
32
|
hiddenTextarea = document.createElement('textarea');
|
|
39
33
|
hiddenTextarea.setAttribute('tab-index', '-1');
|
|
40
34
|
hiddenTextarea.setAttribute('aria-hidden', 'true');
|
|
41
35
|
forceHiddenStyles(hiddenTextarea);
|
|
42
36
|
}
|
|
43
|
-
|
|
44
37
|
if (hiddenTextarea.parentNode === null) {
|
|
45
38
|
document.body.appendChild(hiddenTextarea);
|
|
46
39
|
}
|
|
47
|
-
|
|
48
40
|
const {
|
|
49
41
|
paddingSize,
|
|
50
42
|
borderSize,
|
|
@@ -58,24 +50,20 @@ export default function calculateNodeHeight(sizingData, value) {
|
|
|
58
50
|
});
|
|
59
51
|
forceHiddenStyles(hiddenTextarea);
|
|
60
52
|
hiddenTextarea.value = value;
|
|
61
|
-
let height = getContentHeight(hiddenTextarea, sizingData);
|
|
62
|
-
|
|
63
|
-
hiddenTextarea.value = 'x';
|
|
64
|
-
|
|
53
|
+
let height = getContentHeight(hiddenTextarea, sizingData);
|
|
54
|
+
// measure height of a textarea with a single row
|
|
55
|
+
hiddenTextarea.value = 'x';
|
|
56
|
+
// calc single row need to remove padding and border to avoid duplicated calc
|
|
65
57
|
const rowHeight = getContentHeight(hiddenTextarea, sizingData) - paddingSize - borderSize;
|
|
66
58
|
let minHeight = rowHeight * minRows;
|
|
67
|
-
|
|
68
59
|
if (boxSizing === 'border-box') {
|
|
69
60
|
minHeight = minHeight + paddingSize + borderSize;
|
|
70
61
|
}
|
|
71
|
-
|
|
72
62
|
height = Math.max(minHeight, height);
|
|
73
63
|
let maxHeight = rowHeight * maxRows;
|
|
74
|
-
|
|
75
64
|
if (boxSizing === 'border-box') {
|
|
76
65
|
maxHeight = maxHeight + paddingSize + borderSize;
|
|
77
66
|
}
|
|
78
|
-
|
|
79
67
|
height = Math.min(maxHeight, height);
|
|
80
68
|
return height;
|
|
81
69
|
}
|