@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,47 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _isString2 = _interopRequireDefault(require("lodash/isString"));
|
|
9
|
-
|
|
10
8
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
11
|
-
|
|
12
9
|
var _toString2 = _interopRequireDefault(require("lodash/toString"));
|
|
13
|
-
|
|
14
10
|
var _toNumber2 = _interopRequireDefault(require("lodash/toNumber"));
|
|
15
|
-
|
|
16
11
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
17
|
-
|
|
18
12
|
var _keyCode = _interopRequireDefault(require("../utils/keyCode"));
|
|
19
|
-
|
|
20
13
|
var _constants = require("./constants");
|
|
21
|
-
|
|
22
14
|
var _number = require("../utils/number");
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
16
|
/* eslint-disable max-len */
|
|
27
|
-
|
|
28
17
|
/* eslint-disable no-param-reassign */
|
|
29
|
-
|
|
30
18
|
/* eslint-disable eqeqeq */
|
|
19
|
+
|
|
31
20
|
class InputNumberFoundation extends _foundation.default {
|
|
32
21
|
init() {
|
|
33
22
|
this._setInitValue();
|
|
34
23
|
}
|
|
35
|
-
|
|
36
24
|
destroy() {
|
|
37
25
|
this._unregisterInterval();
|
|
38
|
-
|
|
39
26
|
this._unregisterTimer();
|
|
40
|
-
|
|
41
27
|
this._adapter.unregisterGlobalEvent('mouseup');
|
|
42
28
|
}
|
|
43
|
-
|
|
44
29
|
isControlled() {
|
|
45
30
|
return this._isControlledComponent('value');
|
|
46
31
|
}
|
|
47
|
-
|
|
48
32
|
_doInput() {
|
|
49
33
|
let v = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
50
34
|
let event = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -52,37 +36,30 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
52
36
|
let notifyVal = v;
|
|
53
37
|
let number = v;
|
|
54
38
|
let isValidNumber = true;
|
|
55
|
-
const isControlled = this.isControlled();
|
|
56
|
-
|
|
39
|
+
const isControlled = this.isControlled();
|
|
40
|
+
// console.log(v);
|
|
57
41
|
if (typeof v !== 'number') {
|
|
58
42
|
number = this.doParse(v, false);
|
|
59
43
|
isValidNumber = !isNaN(number);
|
|
60
44
|
}
|
|
61
|
-
|
|
62
45
|
if (isValidNumber) {
|
|
63
46
|
notifyVal = number;
|
|
64
|
-
|
|
65
47
|
if (!isControlled) {
|
|
66
48
|
this._adapter.setNumber(number);
|
|
67
49
|
}
|
|
68
50
|
}
|
|
69
|
-
|
|
70
51
|
if (!isControlled) {
|
|
71
52
|
this._adapter.setValue(v, updateCb);
|
|
72
53
|
}
|
|
73
|
-
|
|
74
54
|
if (this.getProp('keepFocus')) {
|
|
75
55
|
this._adapter.setFocusing(true, () => {
|
|
76
56
|
this._adapter.setClickUpOrDown(true);
|
|
77
57
|
});
|
|
78
58
|
}
|
|
79
|
-
|
|
80
59
|
this.notifyChange(notifyVal, event);
|
|
81
60
|
}
|
|
82
|
-
|
|
83
61
|
_registerInterval(cb) {
|
|
84
62
|
const pressInterval = this.getProp('pressInterval') || _constants.numbers.DEFAULT_PRESS_INTERVAL;
|
|
85
|
-
|
|
86
63
|
this._intervalHasRegistered = true;
|
|
87
64
|
this._interval = setInterval(() => {
|
|
88
65
|
if (typeof cb === 'function' && this._intervalHasRegistered) {
|
|
@@ -90,7 +67,6 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
90
67
|
}
|
|
91
68
|
}, pressInterval);
|
|
92
69
|
}
|
|
93
|
-
|
|
94
70
|
_unregisterInterval() {
|
|
95
71
|
if (this._interval) {
|
|
96
72
|
this._intervalHasRegistered = false;
|
|
@@ -98,10 +74,8 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
98
74
|
this._interval = null;
|
|
99
75
|
}
|
|
100
76
|
}
|
|
101
|
-
|
|
102
77
|
_registerTimer(cb) {
|
|
103
78
|
const pressTimeout = this.getProp('pressTimeout') || _constants.numbers.DEFAULT_PRESS_TIMEOUT;
|
|
104
|
-
|
|
105
79
|
this._timerHasRegistered = true;
|
|
106
80
|
this._timer = setTimeout(() => {
|
|
107
81
|
if (this._timerHasRegistered && typeof cb === 'function') {
|
|
@@ -109,7 +83,6 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
109
83
|
}
|
|
110
84
|
}, pressTimeout);
|
|
111
85
|
}
|
|
112
|
-
|
|
113
86
|
_unregisterTimer() {
|
|
114
87
|
if (this._timer) {
|
|
115
88
|
this._timerHasRegistered = false;
|
|
@@ -117,20 +90,15 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
117
90
|
this._timer = null;
|
|
118
91
|
}
|
|
119
92
|
}
|
|
120
|
-
|
|
121
93
|
handleInputFocus(e) {
|
|
122
94
|
const value = this.getState('value');
|
|
123
|
-
|
|
124
|
-
|
|
95
|
+
if (value !== '') {
|
|
96
|
+
// let parsedStr = this.doParse(this.getState('value'));
|
|
125
97
|
// this._adapter.setValue(Number(parsedStr));
|
|
126
98
|
}
|
|
127
|
-
|
|
128
99
|
this._adapter.recordCursorPosition();
|
|
129
|
-
|
|
130
100
|
this._adapter.setFocusing(true, null);
|
|
131
|
-
|
|
132
101
|
this._adapter.setClickUpOrDown(false);
|
|
133
|
-
|
|
134
102
|
this._adapter.notifyFocus(e);
|
|
135
103
|
}
|
|
136
104
|
/**
|
|
@@ -138,23 +106,18 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
138
106
|
* @param {String} value
|
|
139
107
|
* @param {*} event
|
|
140
108
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
109
|
handleInputChange(value, event) {
|
|
144
110
|
// Check accuracy, adjust accuracy, adjust maximum and minimum values, call parser to parse the number
|
|
145
|
-
const parsedNum = this.doParse(value, true, true, true);
|
|
146
|
-
|
|
147
|
-
const toNum = this.doParse(value, false, false, false);
|
|
148
|
-
|
|
111
|
+
const parsedNum = this.doParse(value, true, true, true);
|
|
112
|
+
// Parser parsed number, type Number (normal number or NaN)
|
|
113
|
+
const toNum = this.doParse(value, false, false, false);
|
|
114
|
+
// String converted from parser parsed numbers or directly converted without parser
|
|
149
115
|
const valueAfterParser = this.afterParser(value);
|
|
150
|
-
|
|
151
116
|
this._adapter.recordCursorPosition();
|
|
152
|
-
|
|
153
117
|
let notifyVal;
|
|
154
|
-
let num = toNum;
|
|
155
|
-
|
|
118
|
+
let num = toNum;
|
|
119
|
+
// The formatted input value
|
|
156
120
|
let formattedNum = value;
|
|
157
|
-
|
|
158
121
|
if (value === '') {
|
|
159
122
|
if (!this.isControlled()) {
|
|
160
123
|
num = null;
|
|
@@ -167,13 +130,11 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
167
130
|
* This logic is used to solve the problem that parsedNum is not a valid number
|
|
168
131
|
*/
|
|
169
132
|
if (typeof toNum === 'number' && !isNaN(toNum)) {
|
|
170
|
-
formattedNum = this.doFormat(toNum, false);
|
|
171
|
-
|
|
133
|
+
formattedNum = this.doFormat(toNum, false);
|
|
134
|
+
// console.log(`parsedStr: `, parsedStr, `toNum: `, toNum);
|
|
172
135
|
const dotIndex = valueAfterParser.lastIndexOf('.');
|
|
173
136
|
const lengthAfterDot = valueAfterParser.length - 1 - dotIndex;
|
|
174
|
-
|
|
175
137
|
const precLength = this._getPrecLen(toNum);
|
|
176
|
-
|
|
177
138
|
if (!precLength) {
|
|
178
139
|
const dotBeginStr = dotIndex > -1 ? valueAfterParser.slice(dotIndex) : '';
|
|
179
140
|
formattedNum += dotBeginStr;
|
|
@@ -182,9 +143,8 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
182
143
|
for (let i = 0; i < lengthAfterDot - precLength; i++) {
|
|
183
144
|
formattedNum += '0';
|
|
184
145
|
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
146
|
+
}
|
|
147
|
+
// NOUSE:
|
|
188
148
|
num = toNum;
|
|
189
149
|
} else {
|
|
190
150
|
/**
|
|
@@ -196,162 +156,120 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
196
156
|
*/
|
|
197
157
|
formattedNum = this.doFormat(valueAfterParser, false);
|
|
198
158
|
}
|
|
199
|
-
|
|
200
159
|
notifyVal = valueAfterParser;
|
|
201
160
|
}
|
|
202
|
-
|
|
203
161
|
if (!this.isControlled() && (num === null || typeof num === 'number' && !isNaN(num))) {
|
|
204
162
|
this._adapter.setNumber(num);
|
|
205
163
|
}
|
|
206
|
-
|
|
207
164
|
this._adapter.setValue(this.isControlled() ? formattedNum : this.doFormat(valueAfterParser, false), () => {
|
|
208
165
|
this._adapter.restoreCursor();
|
|
209
166
|
});
|
|
210
|
-
|
|
211
167
|
this.notifyChange(notifyVal, event);
|
|
212
168
|
}
|
|
213
|
-
|
|
214
169
|
handleInputKeyDown(event) {
|
|
215
170
|
const code = event.keyCode;
|
|
216
|
-
|
|
217
171
|
if (code === _keyCode.default.UP || code === _keyCode.default.DOWN) {
|
|
218
172
|
this._adapter.setClickUpOrDown(true);
|
|
219
|
-
|
|
220
173
|
this._adapter.recordCursorPosition();
|
|
221
|
-
|
|
222
174
|
const formattedVal = code === _keyCode.default.UP ? this.add(null, event) : this.minus(null, event);
|
|
223
|
-
|
|
224
175
|
this._doInput(formattedVal, event, () => {
|
|
225
176
|
this._adapter.restoreCursor();
|
|
226
177
|
});
|
|
227
|
-
|
|
228
178
|
event.preventDefault();
|
|
229
179
|
}
|
|
230
|
-
|
|
231
180
|
this._adapter.notifyKeyDown(event);
|
|
232
181
|
}
|
|
233
|
-
|
|
234
182
|
handleInputBlur(e) {
|
|
235
183
|
const currentValue = (0, _toString2.default)(this.getState('value'));
|
|
236
184
|
let currentNumber = this.getState('number');
|
|
237
|
-
|
|
238
185
|
if (currentNumber != null || currentValue != null && currentValue !== '') {
|
|
239
186
|
const parsedNum = this.doParse(currentValue, false, true, true);
|
|
240
187
|
let numHasChanged = false;
|
|
241
188
|
let strHasChanged = false;
|
|
242
189
|
let willSetNum, willSetVal;
|
|
243
|
-
|
|
244
190
|
if (this.isValidNumber(parsedNum) && currentNumber !== parsedNum) {
|
|
245
191
|
willSetNum = parsedNum;
|
|
246
|
-
|
|
247
192
|
if (!this.isControlled()) {
|
|
248
193
|
currentNumber = willSetNum;
|
|
249
194
|
}
|
|
250
|
-
|
|
251
195
|
numHasChanged = true;
|
|
252
196
|
}
|
|
253
|
-
|
|
254
197
|
const currentFormattedNum = this.doFormat(currentNumber, true);
|
|
255
|
-
|
|
256
198
|
if (currentFormattedNum !== currentValue) {
|
|
257
199
|
willSetVal = currentFormattedNum;
|
|
258
200
|
strHasChanged = true;
|
|
259
201
|
}
|
|
260
|
-
|
|
261
202
|
if (strHasChanged || numHasChanged) {
|
|
262
203
|
const notifyVal = willSetVal != null ? willSetVal : willSetNum;
|
|
263
|
-
|
|
264
204
|
if (willSetVal != null) {
|
|
265
|
-
this._adapter.setValue(willSetVal);
|
|
266
|
-
|
|
205
|
+
this._adapter.setValue(willSetVal);
|
|
206
|
+
// this.notifyChange(willSetVal);
|
|
267
207
|
}
|
|
268
208
|
|
|
269
209
|
if (willSetNum != null) {
|
|
270
210
|
// eslint-disable-next-line max-depth
|
|
271
211
|
if (!this._isControlledComponent('value')) {
|
|
272
212
|
this._adapter.setNumber(willSetNum);
|
|
273
|
-
}
|
|
274
|
-
|
|
213
|
+
}
|
|
214
|
+
// this.notifyChange(willSetNum);
|
|
275
215
|
}
|
|
276
216
|
|
|
277
217
|
this.notifyChange(notifyVal, e);
|
|
278
218
|
}
|
|
279
219
|
}
|
|
280
|
-
|
|
281
220
|
this._adapter.setFocusing(false);
|
|
282
|
-
|
|
283
221
|
this._adapter.notifyBlur(e);
|
|
284
222
|
}
|
|
285
|
-
|
|
286
223
|
handleInputMouseEnter(event) {
|
|
287
224
|
this._adapter.setHovering(true);
|
|
288
225
|
}
|
|
289
|
-
|
|
290
226
|
handleInputMouseLeave(event) {
|
|
291
227
|
this._adapter.setHovering(false);
|
|
292
228
|
}
|
|
293
|
-
|
|
294
229
|
handleInputMouseMove(event) {
|
|
295
230
|
this._adapter.setHovering(true);
|
|
296
231
|
}
|
|
297
|
-
|
|
298
232
|
handleMouseUp(e) {
|
|
299
233
|
this._unregisterInterval();
|
|
300
|
-
|
|
301
234
|
this._unregisterTimer();
|
|
302
|
-
|
|
303
235
|
this._adapter.unregisterGlobalEvent('mouseup');
|
|
304
236
|
}
|
|
305
|
-
|
|
306
237
|
handleUpClick(event) {
|
|
307
238
|
const {
|
|
308
239
|
readonly
|
|
309
240
|
} = this.getProps();
|
|
310
|
-
|
|
311
241
|
if (!this._isMouseButtonLeft(event) || readonly) {
|
|
312
242
|
return;
|
|
313
243
|
}
|
|
314
|
-
|
|
315
244
|
this._adapter.setClickUpOrDown(true);
|
|
316
|
-
|
|
317
245
|
if (event) {
|
|
318
246
|
this._persistEvent(event);
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
247
|
+
event.stopPropagation();
|
|
248
|
+
// Prevent native blurring events
|
|
322
249
|
this._preventDefault(event);
|
|
323
250
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
251
|
+
this.upClick(event);
|
|
252
|
+
// Cannot access event objects asynchronously https://reactjs.org/docs/events.html#event-pooling
|
|
327
253
|
this._registerTimer(() => {
|
|
328
254
|
this._registerInterval(() => {
|
|
329
255
|
this.upClick(event);
|
|
330
256
|
});
|
|
331
257
|
});
|
|
332
258
|
}
|
|
333
|
-
|
|
334
259
|
handleDownClick(event) {
|
|
335
260
|
const {
|
|
336
261
|
readonly
|
|
337
262
|
} = this.getProps();
|
|
338
|
-
|
|
339
263
|
if (!this._isMouseButtonLeft(event) || readonly) {
|
|
340
264
|
return;
|
|
341
265
|
}
|
|
342
|
-
|
|
343
266
|
this._adapter.setClickUpOrDown(true);
|
|
344
|
-
|
|
345
267
|
if (event) {
|
|
346
268
|
this._persistEvent(event);
|
|
347
|
-
|
|
348
269
|
event.stopPropagation();
|
|
349
|
-
|
|
350
270
|
this._preventDefault(event);
|
|
351
271
|
}
|
|
352
|
-
|
|
353
272
|
this.downClick(event);
|
|
354
|
-
|
|
355
273
|
this._registerTimer(() => {
|
|
356
274
|
this._registerInterval(() => {
|
|
357
275
|
this.downClick(event);
|
|
@@ -362,44 +280,31 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
362
280
|
* Whether it is a left mouse button click
|
|
363
281
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
|
364
282
|
*/
|
|
365
|
-
|
|
366
|
-
|
|
367
283
|
_isMouseButtonLeft(event) {
|
|
368
284
|
return (0, _get2.default)(event, 'button') === _constants.numbers.MOUSE_BUTTON_LEFT;
|
|
369
285
|
}
|
|
370
|
-
|
|
371
286
|
_preventDefault(event) {
|
|
372
287
|
const keepFocus = this._adapter.getProp('keepFocus');
|
|
373
|
-
|
|
374
288
|
const innerButtons = this._adapter.getProp('innerButtons');
|
|
375
|
-
|
|
376
289
|
if (keepFocus || innerButtons) {
|
|
377
290
|
event.preventDefault();
|
|
378
291
|
}
|
|
379
292
|
}
|
|
380
|
-
|
|
381
293
|
handleMouseLeave(event) {
|
|
382
294
|
this._adapter.registerGlobalEvent('mouseup', () => {
|
|
383
295
|
this.handleMouseUp(event);
|
|
384
296
|
});
|
|
385
297
|
}
|
|
386
|
-
|
|
387
298
|
upClick(event) {
|
|
388
299
|
const value = this.add(null, event);
|
|
389
|
-
|
|
390
300
|
this._doInput(value, event);
|
|
391
|
-
|
|
392
301
|
this._adapter.notifyUpClick(value, event);
|
|
393
302
|
}
|
|
394
|
-
|
|
395
303
|
downClick(event) {
|
|
396
304
|
const value = this.minus(null, event);
|
|
397
|
-
|
|
398
305
|
this._doInput(value, event);
|
|
399
|
-
|
|
400
306
|
this._adapter.notifyDownClick(value, event);
|
|
401
307
|
}
|
|
402
|
-
|
|
403
308
|
_setInitValue() {
|
|
404
309
|
const {
|
|
405
310
|
defaultValue,
|
|
@@ -408,22 +313,16 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
408
313
|
const propsValue = this._isControlledComponent('value') ? value : defaultValue;
|
|
409
314
|
const tmpNumber = this.doParse((0, _toString2.default)(propsValue), false, true, true);
|
|
410
315
|
let number = null;
|
|
411
|
-
|
|
412
316
|
if (typeof tmpNumber === 'number' && !isNaN(tmpNumber)) {
|
|
413
317
|
number = tmpNumber;
|
|
414
318
|
}
|
|
415
|
-
|
|
416
319
|
const formattedValue = typeof number === 'number' ? this.doFormat(number, true) : '';
|
|
417
|
-
|
|
418
320
|
this._adapter.setNumber(number);
|
|
419
|
-
|
|
420
321
|
this._adapter.setValue(formattedValue);
|
|
421
|
-
|
|
422
322
|
if ((0, _isString2.default)(formattedValue) && formattedValue !== String(propsValue !== null && propsValue !== void 0 ? propsValue : '')) {
|
|
423
323
|
this.notifyChange(formattedValue, null);
|
|
424
324
|
}
|
|
425
325
|
}
|
|
426
|
-
|
|
427
326
|
add(step, event) {
|
|
428
327
|
const pressShift = event && event.shiftKey;
|
|
429
328
|
const propStep = pressShift ? this.getProp('shiftStep') : this.getProp('step');
|
|
@@ -433,17 +332,11 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
433
332
|
let curNum = this.toNumber(curVal) || 0;
|
|
434
333
|
const min = this.getProp('min');
|
|
435
334
|
const max = this.getProp('max');
|
|
436
|
-
|
|
437
335
|
const minPrecLen = this._getPrecLen(min);
|
|
438
|
-
|
|
439
336
|
const maxPrecLen = this._getPrecLen(max);
|
|
440
|
-
|
|
441
337
|
const curPrecLen = this._getPrecLen(curNum);
|
|
442
|
-
|
|
443
338
|
const stepPrecLen = this._getPrecLen(step);
|
|
444
|
-
|
|
445
339
|
const scale = Math.pow(10, Math.max(minPrecLen, maxPrecLen, curPrecLen, stepPrecLen));
|
|
446
|
-
|
|
447
340
|
if (step < 0) {
|
|
448
341
|
// Js accuracy problem
|
|
449
342
|
if (Math.abs((0, _number.minus)(min, curNum)) >= stepAbs) {
|
|
@@ -454,19 +347,15 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
454
347
|
curNum = (curNum * scale + step * scale) / scale;
|
|
455
348
|
}
|
|
456
349
|
}
|
|
457
|
-
|
|
458
350
|
if (typeof min === 'number' && min > curNum) {
|
|
459
351
|
curNum = min;
|
|
460
352
|
}
|
|
461
|
-
|
|
462
353
|
if (typeof max === 'number' && max < curNum) {
|
|
463
354
|
curNum = max;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
|
|
355
|
+
}
|
|
356
|
+
// console.log('scale: ', scale, 'curNum: ', curNum);
|
|
467
357
|
return this.doFormat(curNum, true);
|
|
468
358
|
}
|
|
469
|
-
|
|
470
359
|
minus(step, event) {
|
|
471
360
|
const pressShift = event && event.shiftKey;
|
|
472
361
|
const propStep = pressShift ? this.getProp('shiftStep') : this.getProp('step');
|
|
@@ -478,24 +367,18 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
478
367
|
* @param {number} num
|
|
479
368
|
* @returns {number}
|
|
480
369
|
*/
|
|
481
|
-
|
|
482
|
-
|
|
483
370
|
_getPrecLen(num) {
|
|
484
371
|
if (typeof num !== 'string') {
|
|
485
372
|
num = String(Math.abs(Number(num || '')));
|
|
486
373
|
}
|
|
487
|
-
|
|
488
374
|
const idx = num.indexOf('.') + 1;
|
|
489
375
|
return idx ? num.length - idx : 0;
|
|
490
376
|
}
|
|
491
|
-
|
|
492
377
|
_adjustPrec(num) {
|
|
493
378
|
const precision = this.getProp('precision');
|
|
494
|
-
|
|
495
379
|
if (typeof precision === 'number' && num !== '' && num !== null && !Number.isNaN(Number(num))) {
|
|
496
380
|
num = Number(num).toFixed(precision);
|
|
497
381
|
}
|
|
498
|
-
|
|
499
382
|
return (0, _toString2.default)(num);
|
|
500
383
|
}
|
|
501
384
|
/**
|
|
@@ -504,8 +387,6 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
504
387
|
* @param {boolean} needAdjustPrec
|
|
505
388
|
* @returns {string}
|
|
506
389
|
*/
|
|
507
|
-
|
|
508
|
-
|
|
509
390
|
doFormat() {
|
|
510
391
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
511
392
|
let needAdjustPrec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
@@ -514,17 +395,14 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
514
395
|
// }
|
|
515
396
|
let str;
|
|
516
397
|
const formatter = this.getProp('formatter');
|
|
517
|
-
|
|
518
398
|
if (needAdjustPrec) {
|
|
519
399
|
str = this._adjustPrec(value);
|
|
520
400
|
} else {
|
|
521
401
|
str = (0, _toString2.default)(value);
|
|
522
402
|
}
|
|
523
|
-
|
|
524
403
|
if (typeof formatter === 'function') {
|
|
525
404
|
str = formatter(str);
|
|
526
405
|
}
|
|
527
|
-
|
|
528
406
|
return str;
|
|
529
407
|
}
|
|
530
408
|
/**
|
|
@@ -532,20 +410,16 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
532
410
|
* @param {number} current
|
|
533
411
|
* @returns {number}
|
|
534
412
|
*/
|
|
535
|
-
|
|
536
|
-
|
|
537
413
|
fetchMinOrMax(current) {
|
|
538
414
|
const {
|
|
539
415
|
min,
|
|
540
416
|
max
|
|
541
417
|
} = this.getProps();
|
|
542
|
-
|
|
543
418
|
if (current < min) {
|
|
544
419
|
return min;
|
|
545
420
|
} else if (current > max) {
|
|
546
421
|
return max;
|
|
547
422
|
}
|
|
548
|
-
|
|
549
423
|
return current;
|
|
550
424
|
}
|
|
551
425
|
/**
|
|
@@ -556,49 +430,38 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
556
430
|
* @param {boolean} needAdjustMaxMin
|
|
557
431
|
* @returns {number}
|
|
558
432
|
*/
|
|
559
|
-
|
|
560
|
-
|
|
561
433
|
doParse(value) {
|
|
562
434
|
let needCheckPrec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
563
435
|
let needAdjustPrec = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
564
436
|
let needAdjustMaxMin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
565
|
-
|
|
566
437
|
if (typeof value === 'number') {
|
|
567
438
|
if (needAdjustMaxMin) {
|
|
568
439
|
value = this.fetchMinOrMax(value);
|
|
569
440
|
}
|
|
570
|
-
|
|
571
441
|
if (needAdjustPrec) {
|
|
572
442
|
value = this._adjustPrec(value);
|
|
573
443
|
}
|
|
574
|
-
|
|
575
444
|
return (0, _toNumber2.default)(value);
|
|
576
445
|
}
|
|
577
|
-
|
|
578
446
|
const parser = this.getProp('parser');
|
|
579
|
-
|
|
580
447
|
if (typeof parser === 'function') {
|
|
581
448
|
value = parser(value);
|
|
582
449
|
}
|
|
583
|
-
|
|
584
450
|
if (needCheckPrec && typeof value === 'string') {
|
|
585
451
|
const zeroIsValid = value.indexOf('.') === -1 || value.indexOf('.') > -1 && (value === '0' || value.lastIndexOf('0') < value.length - 1);
|
|
586
452
|
const dotIsValid = value.lastIndexOf('.') < value.length - 1 && value.split('').filter(v => v === '.').length < 2;
|
|
587
|
-
|
|
588
|
-
|
|
453
|
+
if (!zeroIsValid || !dotIsValid
|
|
454
|
+
// (this.getProp('precision') > 0 && this._getPrecLen(value) > this.getProp('precision'))
|
|
589
455
|
) {
|
|
590
456
|
return NaN;
|
|
591
457
|
}
|
|
592
458
|
}
|
|
593
|
-
|
|
594
459
|
if (needAdjustPrec) {
|
|
595
460
|
value = this._adjustPrec(value);
|
|
596
461
|
}
|
|
597
|
-
|
|
598
462
|
if (typeof value === 'string' && value.length) {
|
|
599
463
|
return needAdjustMaxMin ? this.fetchMinOrMax((0, _toNumber2.default)(value)) : (0, _toNumber2.default)(value);
|
|
600
464
|
}
|
|
601
|
-
|
|
602
465
|
return NaN;
|
|
603
466
|
}
|
|
604
467
|
/**
|
|
@@ -606,37 +469,27 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
606
469
|
* @param {string} value
|
|
607
470
|
* @returns {string}
|
|
608
471
|
*/
|
|
609
|
-
|
|
610
|
-
|
|
611
472
|
afterParser(value) {
|
|
612
473
|
const parser = this.getProp('parser');
|
|
613
|
-
|
|
614
474
|
if (typeof value === 'string' && typeof parser === 'function') {
|
|
615
475
|
return (0, _toString2.default)(parser(value));
|
|
616
476
|
}
|
|
617
|
-
|
|
618
477
|
return (0, _toString2.default)(value);
|
|
619
478
|
}
|
|
620
|
-
|
|
621
479
|
toNumber(value) {
|
|
622
480
|
let needAdjustPrec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
623
|
-
|
|
624
481
|
if (typeof value === 'number') {
|
|
625
482
|
return value;
|
|
626
483
|
}
|
|
627
|
-
|
|
628
484
|
if (typeof value === 'string') {
|
|
629
485
|
const parser = this.getProp('parser');
|
|
630
|
-
|
|
631
486
|
if (typeof parser === 'function') {
|
|
632
487
|
value = parser(value);
|
|
633
488
|
}
|
|
634
|
-
|
|
635
489
|
if (needAdjustPrec) {
|
|
636
490
|
value = this._adjustPrec(value);
|
|
637
491
|
}
|
|
638
492
|
}
|
|
639
|
-
|
|
640
493
|
return (0, _toNumber2.default)(value);
|
|
641
494
|
}
|
|
642
495
|
/**
|
|
@@ -648,71 +501,55 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
648
501
|
* @param {*} needCheckPrec
|
|
649
502
|
* @returns
|
|
650
503
|
*/
|
|
651
|
-
|
|
652
|
-
|
|
653
504
|
isValidNumber(num) {
|
|
654
505
|
let needCheckPrec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
655
|
-
|
|
656
506
|
if (typeof num === 'number' && !isNaN(num)) {
|
|
657
507
|
const {
|
|
658
508
|
min,
|
|
659
509
|
max,
|
|
660
510
|
precision
|
|
661
511
|
} = this.getProps();
|
|
662
|
-
|
|
663
512
|
const numPrec = this._getPrecLen(num);
|
|
664
|
-
|
|
665
513
|
const precIsValid = needCheckPrec ? typeof precision === 'number' && numPrec <= precision || typeof precision !== 'number' : true;
|
|
666
|
-
|
|
667
514
|
if (num >= min && num <= max && precIsValid) {
|
|
668
515
|
return true;
|
|
669
516
|
}
|
|
670
517
|
}
|
|
671
|
-
|
|
672
518
|
return false;
|
|
673
519
|
}
|
|
674
|
-
|
|
675
520
|
isValidString(str) {
|
|
676
521
|
if (typeof str === 'string' && str.length) {
|
|
677
522
|
const parsedNum = this.doParse(str);
|
|
678
523
|
return this.isValidNumber(parsedNum);
|
|
679
524
|
}
|
|
680
|
-
|
|
681
525
|
return false;
|
|
682
526
|
}
|
|
683
|
-
|
|
684
527
|
notifyChange(value, e) {
|
|
685
528
|
if (value == null || value === '') {
|
|
686
529
|
this._adapter.notifyChange('', e);
|
|
687
530
|
} else {
|
|
688
531
|
const parsedNum = this.toNumber(value, true);
|
|
689
|
-
|
|
690
532
|
if (typeof parsedNum === 'number' && !isNaN(parsedNum)) {
|
|
691
533
|
// this._adapter.notifyChange(typeof value === 'number' ? parsedNum : this.afterParser(value), e);
|
|
692
534
|
this._adapter.notifyChange(parsedNum, e);
|
|
693
|
-
|
|
694
535
|
this.notifyNumberChange(parsedNum, e);
|
|
695
536
|
} else {
|
|
696
537
|
this._adapter.notifyChange(this.afterParser(value), e);
|
|
697
538
|
}
|
|
698
539
|
}
|
|
699
540
|
}
|
|
700
|
-
|
|
701
541
|
notifyNumberChange(value, e) {
|
|
702
542
|
const {
|
|
703
543
|
number
|
|
704
|
-
} = this.getStates();
|
|
705
|
-
|
|
544
|
+
} = this.getStates();
|
|
545
|
+
// Does not trigger numberChange if value is not a significant number
|
|
706
546
|
if (this.isValidNumber(value) && value !== number) {
|
|
707
547
|
this._adapter.notifyNumberChange(value, e);
|
|
708
548
|
}
|
|
709
549
|
}
|
|
710
|
-
|
|
711
550
|
updateStates(states, callback) {
|
|
712
551
|
this._adapter.updateStates(states, callback);
|
|
713
552
|
}
|
|
714
|
-
|
|
715
553
|
}
|
|
716
|
-
|
|
717
554
|
var _default = InputNumberFoundation;
|
|
718
555
|
exports.default = _default;
|