@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
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
|
-
|
|
3
2
|
/* eslint-disable max-len */
|
|
4
|
-
|
|
5
3
|
/* eslint-disable no-nested-ternary */
|
|
6
4
|
import BaseFoundation from '../base/foundation';
|
|
7
5
|
import touchEventPolyfill from '../utils/touchPolyfill';
|
|
@@ -10,16 +8,14 @@ import { handlePrevent } from '../utils/a11y';
|
|
|
10
8
|
export default class SliderFoundation extends BaseFoundation {
|
|
11
9
|
constructor(adapter) {
|
|
12
10
|
var _this;
|
|
13
|
-
|
|
14
|
-
super(Object.assign(Object.assign({}, SliderFoundation.defaultAdapter), adapter));
|
|
15
|
-
_this = this;
|
|
16
|
-
|
|
17
11
|
/**
|
|
18
12
|
* Calculate the percentage corresponding to the current value for style calculation
|
|
19
13
|
* @{}
|
|
20
14
|
*
|
|
21
15
|
* @memberof SliderFoundation
|
|
22
16
|
*/
|
|
17
|
+
super(Object.assign(Object.assign({}, SliderFoundation.defaultAdapter), adapter));
|
|
18
|
+
_this = this;
|
|
23
19
|
this.getMinAndMaxPercent = value => {
|
|
24
20
|
// debugger
|
|
25
21
|
const {
|
|
@@ -27,7 +23,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
27
23
|
min,
|
|
28
24
|
max
|
|
29
25
|
} = this._adapter.getProps();
|
|
30
|
-
|
|
31
26
|
const minPercent = range ? (value[0] - min) / (max - min) : (value - min) / (max - min);
|
|
32
27
|
const maxPercent = range ? (value[1] - min) / (max - min) : 1;
|
|
33
28
|
return {
|
|
@@ -39,8 +34,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
39
34
|
* Check if value is out of range
|
|
40
35
|
* @memberof SliderFoundation
|
|
41
36
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
37
|
this._checkValidity = function (value) {
|
|
45
38
|
let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
46
39
|
let max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
@@ -53,21 +46,17 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
53
46
|
* @formatter: tooltip content formatting function
|
|
54
47
|
* @memberof SliderFoundation
|
|
55
48
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
49
|
this.computeHandleVisibleVal = (visible, formatter, range) => {
|
|
59
50
|
// debugger;
|
|
60
51
|
const {
|
|
61
52
|
focusPos,
|
|
62
53
|
currentValue
|
|
63
54
|
} = this._adapter.getStates();
|
|
64
|
-
|
|
65
55
|
const tipVisible = {
|
|
66
56
|
min: false,
|
|
67
57
|
max: false
|
|
68
58
|
};
|
|
69
59
|
let tipChildren;
|
|
70
|
-
|
|
71
60
|
if (formatter) {
|
|
72
61
|
tipChildren = {
|
|
73
62
|
min: range ? formatter(this.outPutValue(currentValue[0])) : formatter(this.outPutValue(currentValue)),
|
|
@@ -79,7 +68,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
79
68
|
max: range ? this.outPutValue(currentValue[1]) : null
|
|
80
69
|
};
|
|
81
70
|
}
|
|
82
|
-
|
|
83
71
|
if (visible) {
|
|
84
72
|
tipVisible.min = true;
|
|
85
73
|
tipVisible.max = true;
|
|
@@ -90,7 +78,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
90
78
|
tipVisible.max = true;
|
|
91
79
|
}
|
|
92
80
|
}
|
|
93
|
-
|
|
94
81
|
const result = {
|
|
95
82
|
tipVisible,
|
|
96
83
|
tipChildren
|
|
@@ -102,8 +89,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
102
89
|
*
|
|
103
90
|
* @memberof SliderFoundation
|
|
104
91
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
92
|
this.valueFormatIsCorrect = value => {
|
|
108
93
|
if (Array.isArray(value)) {
|
|
109
94
|
return typeof value[0] === 'number' && typeof value[0] === 'number';
|
|
@@ -116,13 +101,9 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
116
101
|
*
|
|
117
102
|
* @memberof SliderFoundation
|
|
118
103
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
104
|
this.handleMousePos = (clientX, clientY) => {
|
|
122
105
|
const parentRect = this._adapter.getParentRect();
|
|
123
|
-
|
|
124
106
|
const scrollParent = this._adapter.getScrollParentVal();
|
|
125
|
-
|
|
126
107
|
const parentX = parentRect ? parentRect.left : 0;
|
|
127
108
|
const parentY = parentRect ? parentRect.top : 0;
|
|
128
109
|
return {
|
|
@@ -135,19 +116,13 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
135
116
|
*
|
|
136
117
|
* @memberof SliderFoundation
|
|
137
118
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
119
|
this.getScrollParent = element => {
|
|
141
120
|
// TODO: move window document out of foundation.
|
|
142
121
|
const el = element;
|
|
143
122
|
const regex = /(auto|scroll)/;
|
|
144
|
-
|
|
145
123
|
const style = (node, prop) => window.getComputedStyle(node, null).getPropertyValue(prop);
|
|
146
|
-
|
|
147
124
|
const scroll = node => regex.test(style(node, 'overflow') + style(node, 'overflow-y') + style(node, 'overflow-x'));
|
|
148
|
-
|
|
149
125
|
const scrollParent = node => !node || node === document.body || !(node instanceof Element) ? document.body : scroll(node) ? node : scrollParent(node.parentNode);
|
|
150
|
-
|
|
151
126
|
return scrollParent(el);
|
|
152
127
|
};
|
|
153
128
|
/**
|
|
@@ -155,8 +130,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
155
130
|
*
|
|
156
131
|
* @memberof SliderFoundation
|
|
157
132
|
*/
|
|
158
|
-
|
|
159
|
-
|
|
160
133
|
this.checkMeetMinMax = position => {
|
|
161
134
|
// Returns the length of the distance to the left
|
|
162
135
|
const {
|
|
@@ -164,43 +137,34 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
164
137
|
verticalReverse,
|
|
165
138
|
range
|
|
166
139
|
} = this._adapter.getProps();
|
|
167
|
-
|
|
168
140
|
const value = this._adapter.getState('currentValue');
|
|
169
|
-
|
|
170
141
|
const currentPos = this.transValueToPos(value);
|
|
171
|
-
|
|
172
142
|
const {
|
|
173
143
|
sliderX,
|
|
174
144
|
sliderY,
|
|
175
145
|
sliderWidth,
|
|
176
146
|
sliderHeight
|
|
177
147
|
} = this._adapter.getSliderLengths();
|
|
178
|
-
|
|
179
148
|
const {
|
|
180
149
|
chooseMovePos,
|
|
181
150
|
isDrag
|
|
182
151
|
} = this._adapter.getStates();
|
|
183
|
-
|
|
184
152
|
const len = vertical ? sliderHeight : sliderWidth;
|
|
185
153
|
let startPos;
|
|
186
|
-
|
|
187
154
|
if (vertical && verticalReverse) {
|
|
188
155
|
startPos = sliderY + len;
|
|
189
156
|
} else {
|
|
190
157
|
startPos = vertical ? sliderY : sliderX;
|
|
191
|
-
}
|
|
158
|
+
}
|
|
159
|
+
// startPos = chooseMovePos === 'max' && isDrag ? currentPos[0] : startPos;
|
|
192
160
|
// eslint-disable-next-line one-var
|
|
193
|
-
|
|
194
|
-
|
|
195
161
|
let endPos;
|
|
196
|
-
|
|
197
162
|
if (vertical && verticalReverse) {
|
|
198
163
|
endPos = sliderY;
|
|
199
164
|
} else {
|
|
200
165
|
endPos = vertical ? sliderY + sliderHeight : sliderX + sliderWidth;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
166
|
+
}
|
|
167
|
+
// endPos = chooseMovePos === 'min' && isDrag && range ? currentPos[1] : endPos;
|
|
204
168
|
if (vertical && verticalReverse) {
|
|
205
169
|
if (position >= startPos) {
|
|
206
170
|
position = startPos;
|
|
@@ -214,7 +178,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
214
178
|
position = endPos;
|
|
215
179
|
}
|
|
216
180
|
}
|
|
217
|
-
|
|
218
181
|
return position;
|
|
219
182
|
};
|
|
220
183
|
/**
|
|
@@ -222,57 +185,46 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
222
185
|
*
|
|
223
186
|
* @memberof SliderFoundation
|
|
224
187
|
*/
|
|
225
|
-
|
|
226
|
-
|
|
227
188
|
this.transPosToValue = (mousePos, isMin) => {
|
|
228
189
|
const pos = this.checkMeetMinMax(mousePos);
|
|
229
|
-
|
|
230
190
|
const {
|
|
231
191
|
min,
|
|
232
192
|
max,
|
|
233
193
|
currentValue
|
|
234
194
|
} = this._adapter.getStates();
|
|
235
|
-
|
|
236
195
|
const {
|
|
237
196
|
range,
|
|
238
197
|
vertical,
|
|
239
198
|
step,
|
|
240
199
|
verticalReverse
|
|
241
200
|
} = this._adapter.getProps();
|
|
242
|
-
|
|
243
201
|
const {
|
|
244
202
|
sliderX,
|
|
245
203
|
sliderY,
|
|
246
204
|
sliderWidth,
|
|
247
205
|
sliderHeight
|
|
248
206
|
} = this._adapter.getSliderLengths();
|
|
249
|
-
|
|
250
207
|
const startPos = vertical ? sliderY : sliderX;
|
|
251
208
|
const len = vertical ? sliderHeight : sliderWidth;
|
|
252
209
|
let stepValue;
|
|
253
|
-
|
|
254
210
|
if (vertical && verticalReverse) {
|
|
255
211
|
//isMin = !isMin;
|
|
256
212
|
stepValue = (startPos + len - pos) / len * (max - min) + min;
|
|
257
213
|
} else {
|
|
258
214
|
stepValue = (pos - startPos) / len * (max - min) + min;
|
|
259
|
-
}
|
|
215
|
+
}
|
|
216
|
+
// debugger
|
|
260
217
|
// eslint-disable-next-line one-var
|
|
261
|
-
|
|
262
|
-
|
|
263
218
|
let compareValue;
|
|
264
|
-
|
|
265
219
|
if (range) {
|
|
266
220
|
compareValue = isMin ? currentValue[0] : currentValue[1];
|
|
267
221
|
} else {
|
|
268
222
|
compareValue = currentValue;
|
|
269
223
|
}
|
|
270
|
-
|
|
271
224
|
if (step !== 1) {
|
|
272
225
|
// Find nearest step point
|
|
273
226
|
stepValue = Math.round(stepValue / step) * step;
|
|
274
227
|
}
|
|
275
|
-
|
|
276
228
|
if (range && stepValue !== compareValue) {
|
|
277
229
|
return isMin ? [stepValue, currentValue[1]] : [currentValue[0], stepValue];
|
|
278
230
|
} else if (!range && stepValue !== compareValue) {
|
|
@@ -286,30 +238,24 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
286
238
|
*
|
|
287
239
|
* @memberof SliderFoundation
|
|
288
240
|
*/
|
|
289
|
-
|
|
290
|
-
|
|
291
241
|
this.transValueToPos = value => {
|
|
292
242
|
const {
|
|
293
243
|
min,
|
|
294
244
|
max
|
|
295
245
|
} = this._adapter.getStates();
|
|
296
|
-
|
|
297
246
|
const {
|
|
298
247
|
vertical,
|
|
299
248
|
range,
|
|
300
249
|
verticalReverse
|
|
301
250
|
} = this._adapter.getProps();
|
|
302
|
-
|
|
303
251
|
const {
|
|
304
252
|
sliderX,
|
|
305
253
|
sliderY,
|
|
306
254
|
sliderWidth,
|
|
307
255
|
sliderHeight
|
|
308
256
|
} = this._adapter.getSliderLengths();
|
|
309
|
-
|
|
310
257
|
const startPos = vertical ? sliderY : sliderX;
|
|
311
258
|
const len = vertical ? sliderHeight : sliderWidth;
|
|
312
|
-
|
|
313
259
|
if (range) {
|
|
314
260
|
return [(value[0] - min) * len / (max - min) + startPos, (value[1] - min) * len / (max - min) + startPos];
|
|
315
261
|
} else {
|
|
@@ -321,8 +267,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
321
267
|
*
|
|
322
268
|
* @memberof SliderFoundation
|
|
323
269
|
*/
|
|
324
|
-
|
|
325
|
-
|
|
326
270
|
this.isMarkActive = mark => {
|
|
327
271
|
const {
|
|
328
272
|
min,
|
|
@@ -330,9 +274,7 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
330
274
|
range,
|
|
331
275
|
included
|
|
332
276
|
} = this._adapter.getProps();
|
|
333
|
-
|
|
334
277
|
const currentValue = this._adapter.getState('currentValue');
|
|
335
|
-
|
|
336
278
|
if (typeof (mark / 1) === 'number' && mark >= min && mark <= max) {
|
|
337
279
|
if (range) {
|
|
338
280
|
return (mark > currentValue[1] || mark < currentValue[0]) && included ? 'unActive' : 'active';
|
|
@@ -348,23 +290,16 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
348
290
|
*
|
|
349
291
|
* @memberof SliderFoundation
|
|
350
292
|
*/
|
|
351
|
-
|
|
352
|
-
|
|
353
293
|
this.outPutValue = inputValue => {
|
|
354
294
|
const checkHowManyDecimals = num => {
|
|
355
295
|
var _a, _b;
|
|
356
|
-
|
|
357
296
|
const reg = /^\d+(\.\d+)?$/;
|
|
358
|
-
|
|
359
297
|
if (reg.test(String(num))) {
|
|
360
298
|
return (_b = (_a = num.toString().split('.')[1]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
361
299
|
}
|
|
362
|
-
|
|
363
300
|
return 0;
|
|
364
301
|
};
|
|
365
|
-
|
|
366
302
|
const step = this._adapter.getProp('step');
|
|
367
|
-
|
|
368
303
|
const transWay = (() => {
|
|
369
304
|
const decimals = checkHowManyDecimals(step);
|
|
370
305
|
const multipler = Math.pow(10, decimals);
|
|
@@ -372,27 +307,21 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
372
307
|
return Math.round(value * multipler) / multipler;
|
|
373
308
|
};
|
|
374
309
|
})();
|
|
375
|
-
|
|
376
310
|
if (Array.isArray(inputValue)) {
|
|
377
311
|
return [transWay(inputValue[0]), transWay(inputValue[1])];
|
|
378
312
|
} else {
|
|
379
313
|
return transWay(inputValue);
|
|
380
314
|
}
|
|
381
315
|
};
|
|
382
|
-
|
|
383
316
|
this.handleDisabledChange = disabled => {
|
|
384
317
|
this._adapter.updateDisabled(disabled);
|
|
385
318
|
};
|
|
386
|
-
|
|
387
319
|
this.checkAndUpdateIsInRenderTreeState = () => this._adapter.checkAndUpdateIsInRenderTreeState();
|
|
388
|
-
|
|
389
320
|
this.calculateOutputValue = (position, isMin) => {
|
|
390
321
|
const moveValue = this.transPosToValue(position, isMin);
|
|
391
|
-
|
|
392
322
|
if (moveValue === false) {
|
|
393
323
|
return undefined;
|
|
394
324
|
}
|
|
395
|
-
|
|
396
325
|
return this.outPutValue(moveValue);
|
|
397
326
|
};
|
|
398
327
|
/**
|
|
@@ -400,35 +329,29 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
400
329
|
*
|
|
401
330
|
* @memberof SliderFoundation
|
|
402
331
|
*/
|
|
403
|
-
|
|
404
|
-
|
|
405
332
|
this.handleValueChange = (prevValue, nextValue) => {
|
|
406
333
|
const {
|
|
407
334
|
min,
|
|
408
335
|
max
|
|
409
336
|
} = this._adapter.getStates();
|
|
410
|
-
|
|
411
337
|
let resultState = null;
|
|
412
338
|
const disableState = {};
|
|
413
|
-
|
|
414
339
|
if (this.valueFormatIsCorrect(nextValue)) {
|
|
415
340
|
if (Array.isArray(prevValue) && Array.isArray(nextValue)) {
|
|
416
341
|
nextValue = [nextValue[0] < min ? min : nextValue[0], nextValue[1] > max ? max : nextValue[1] // Math.round(nextValue[1])
|
|
417
|
-
];
|
|
418
|
-
|
|
342
|
+
];
|
|
343
|
+
// this._adapter.notifyChange(this.outPutValue(nextValue));
|
|
419
344
|
resultState = Object.assign(disableState, {
|
|
420
345
|
currentValue: nextValue
|
|
421
346
|
});
|
|
422
347
|
}
|
|
423
|
-
|
|
424
348
|
if (typeof prevValue === 'number' && typeof nextValue === 'number') {
|
|
425
349
|
if (nextValue > max) {
|
|
426
350
|
nextValue = max;
|
|
427
351
|
} else {
|
|
428
352
|
nextValue = nextValue < min ? min : nextValue; // Math.round(nextValue);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
|
|
353
|
+
}
|
|
354
|
+
// this._adapter.notifyChange(this.outPutValue(nextValue));
|
|
432
355
|
resultState = Object.assign(disableState, {
|
|
433
356
|
currentValue: nextValue
|
|
434
357
|
});
|
|
@@ -436,119 +359,88 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
436
359
|
} else {
|
|
437
360
|
resultState = disableState;
|
|
438
361
|
}
|
|
439
|
-
|
|
440
362
|
if (resultState) {
|
|
441
363
|
this._adapter.transNewPropsToState(resultState);
|
|
442
364
|
}
|
|
443
365
|
};
|
|
444
|
-
|
|
445
366
|
this.onHandleDown = (e, handler) => {
|
|
446
367
|
this._adapter.onHandleDown(e);
|
|
447
|
-
|
|
448
368
|
const disabled = this._adapter.getState('disabled');
|
|
449
|
-
|
|
450
369
|
const {
|
|
451
370
|
vertical
|
|
452
371
|
} = this._adapter.getProps();
|
|
453
|
-
|
|
454
372
|
const {
|
|
455
373
|
dragging
|
|
456
374
|
} = this._adapter.getOverallVars();
|
|
457
|
-
|
|
458
375
|
if (disabled) {
|
|
459
376
|
return false;
|
|
460
377
|
}
|
|
461
|
-
|
|
462
378
|
this._adapter.setStateVal('isDrag', true);
|
|
463
|
-
|
|
464
379
|
this._adapter.setStateVal('chooseMovePos', handler);
|
|
465
|
-
|
|
466
380
|
if (handler === 'min') {
|
|
467
381
|
this._adapter.setDragging([true, dragging[1]]);
|
|
468
382
|
} else {
|
|
469
383
|
this._adapter.setDragging([dragging[0], true]);
|
|
470
384
|
}
|
|
471
|
-
|
|
472
385
|
const mousePos = this.handleMousePos(e.clientX, e.clientY);
|
|
473
386
|
let pos = vertical ? mousePos.y : mousePos.x;
|
|
474
|
-
|
|
475
387
|
if (!this._adapter.isEventFromHandle(e)) {
|
|
476
388
|
this._dragOffset = 0;
|
|
477
389
|
} else {
|
|
478
390
|
const handlePosition = this._getHandleCenterPosition(vertical, e.target);
|
|
479
|
-
|
|
480
391
|
this._dragOffset = vertical ? pos - handlePosition : pos - handlePosition;
|
|
481
392
|
pos = handlePosition;
|
|
482
393
|
}
|
|
483
|
-
|
|
484
394
|
return true;
|
|
485
395
|
};
|
|
486
|
-
|
|
487
396
|
this.onHandleMove = e => {
|
|
488
397
|
this._adapter.setEventDefault(e);
|
|
489
|
-
|
|
490
398
|
const {
|
|
491
399
|
disabled,
|
|
492
400
|
chooseMovePos
|
|
493
401
|
} = this._adapter.getStates();
|
|
494
|
-
|
|
495
402
|
const {
|
|
496
403
|
vertical
|
|
497
404
|
} = this._adapter.getProps();
|
|
498
|
-
|
|
499
405
|
const {
|
|
500
406
|
dragging
|
|
501
407
|
} = this._adapter.getOverallVars();
|
|
502
|
-
|
|
503
408
|
if (disabled) {
|
|
504
409
|
return false;
|
|
505
410
|
}
|
|
506
|
-
|
|
507
411
|
this.onHandleEnter(chooseMovePos);
|
|
508
412
|
const mousePos = this.handleMousePos(e.clientX, e.clientY);
|
|
509
413
|
let pagePos = vertical ? mousePos.y : mousePos.x;
|
|
510
414
|
pagePos = pagePos - this._dragOffset;
|
|
511
|
-
|
|
512
415
|
if (chooseMovePos === 'min' && dragging[0] || chooseMovePos === 'max' && dragging[1]) {
|
|
513
416
|
const outPutValue = this.calculateOutputValue(pagePos, chooseMovePos === 'min');
|
|
514
|
-
|
|
515
417
|
if (outPutValue === undefined) {
|
|
516
418
|
return false;
|
|
517
419
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
420
|
+
this._adapter.notifyChange(outPutValue);
|
|
421
|
+
// allow drag for controlled component, so no _isControlledComponent check
|
|
522
422
|
this._adapter.onHandleMove(pagePos, chooseMovePos === 'min', undefined, false, outPutValue);
|
|
523
423
|
}
|
|
524
|
-
|
|
525
424
|
return true;
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
|
|
425
|
+
};
|
|
426
|
+
// run when user touch left or right handle.
|
|
529
427
|
this.onHandleTouchStart = (e, handler) => {
|
|
530
428
|
const handleMinDom = this._adapter.getMinHandleEl();
|
|
531
|
-
|
|
532
429
|
const handleMaxDom = this._adapter.getMaxHandleEl();
|
|
533
|
-
|
|
534
430
|
if (e.target === handleMinDom || e.target === handleMaxDom) {
|
|
535
431
|
handlePrevent(e);
|
|
536
432
|
const touch = touchEventPolyfill(e.touches[0], e);
|
|
537
433
|
this.onHandleDown(touch, handler);
|
|
538
434
|
}
|
|
539
435
|
};
|
|
540
|
-
|
|
541
436
|
this.onHandleTouchMove = e => {
|
|
542
437
|
const handleMinDom = this._adapter.getMinHandleEl();
|
|
543
|
-
|
|
544
438
|
const handleMaxDom = this._adapter.getMaxHandleEl();
|
|
545
|
-
|
|
546
439
|
if (e.target === handleMinDom || e.target === handleMaxDom) {
|
|
547
440
|
const touch = touchEventPolyfill(e.touches[0], e);
|
|
548
441
|
this.onHandleMove(touch);
|
|
549
442
|
}
|
|
550
443
|
};
|
|
551
|
-
|
|
552
444
|
this.onHandleEnter = pos => {
|
|
553
445
|
// debugger;
|
|
554
446
|
// this._adapter.setEventDefault(e);
|
|
@@ -556,55 +448,42 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
556
448
|
disabled,
|
|
557
449
|
focusPos
|
|
558
450
|
} = this._adapter.getStates();
|
|
559
|
-
|
|
560
451
|
if (!disabled) {
|
|
561
452
|
if (!focusPos && pos !== focusPos) {
|
|
562
453
|
this._adapter.onHandleEnter(pos);
|
|
563
454
|
}
|
|
564
455
|
}
|
|
565
456
|
};
|
|
566
|
-
|
|
567
457
|
this.onHandleLeave = () => {
|
|
568
458
|
// this._adapter.setEventDefault(e);
|
|
569
459
|
const disabled = this._adapter.getState('disabled');
|
|
570
|
-
|
|
571
460
|
if (!disabled) {
|
|
572
461
|
this._adapter.onHandleLeave();
|
|
573
462
|
}
|
|
574
463
|
};
|
|
575
|
-
|
|
576
464
|
this.onHandleUp = e => {
|
|
577
|
-
this._adapter.onHandleUpBefore(e);
|
|
578
|
-
|
|
579
|
-
|
|
465
|
+
this._adapter.onHandleUpBefore(e);
|
|
466
|
+
// const value = this._adapter.getProp('value');
|
|
580
467
|
const {
|
|
581
468
|
disabled,
|
|
582
469
|
chooseMovePos
|
|
583
470
|
} = this._adapter.getStates();
|
|
584
|
-
|
|
585
471
|
const {
|
|
586
472
|
dragging
|
|
587
473
|
} = this._adapter.getOverallVars();
|
|
588
|
-
|
|
589
474
|
if (disabled) {
|
|
590
475
|
return false;
|
|
591
476
|
}
|
|
592
|
-
|
|
593
477
|
if (chooseMovePos === 'min') {
|
|
594
478
|
this._adapter.setDragging([false, dragging[1]]);
|
|
595
479
|
} else {
|
|
596
480
|
this._adapter.setDragging([dragging[0], false]);
|
|
597
481
|
}
|
|
598
|
-
|
|
599
482
|
this._adapter.setStateVal('isDrag', false);
|
|
600
|
-
|
|
601
483
|
this._adapter.onHandleLeave();
|
|
602
|
-
|
|
603
484
|
this._adapter.onHandleUpAfter();
|
|
604
|
-
|
|
605
485
|
return true;
|
|
606
486
|
};
|
|
607
|
-
|
|
608
487
|
this._handleValueDecreaseWithKeyBoard = (step, handler) => {
|
|
609
488
|
const {
|
|
610
489
|
min,
|
|
@@ -613,7 +492,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
613
492
|
const {
|
|
614
493
|
range
|
|
615
494
|
} = this.getProps();
|
|
616
|
-
|
|
617
495
|
if (handler === 'min') {
|
|
618
496
|
if (range) {
|
|
619
497
|
let newMinValue = currentValue[0] - step;
|
|
@@ -630,7 +508,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
630
508
|
return [currentValue[0], newMaxValue];
|
|
631
509
|
}
|
|
632
510
|
};
|
|
633
|
-
|
|
634
511
|
this._handleValueIncreaseWithKeyBoard = (step, handler) => {
|
|
635
512
|
const {
|
|
636
513
|
max,
|
|
@@ -639,7 +516,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
639
516
|
const {
|
|
640
517
|
range
|
|
641
518
|
} = this.getProps();
|
|
642
|
-
|
|
643
519
|
if (handler === 'min') {
|
|
644
520
|
if (range) {
|
|
645
521
|
let newMinValue = currentValue[0] + step;
|
|
@@ -656,7 +532,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
656
532
|
return [currentValue[0], newMaxValue];
|
|
657
533
|
}
|
|
658
534
|
};
|
|
659
|
-
|
|
660
535
|
this._handleHomeKey = handler => {
|
|
661
536
|
const {
|
|
662
537
|
min,
|
|
@@ -665,7 +540,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
665
540
|
const {
|
|
666
541
|
range
|
|
667
542
|
} = this.getProps();
|
|
668
|
-
|
|
669
543
|
if (handler === 'min') {
|
|
670
544
|
if (range) {
|
|
671
545
|
return [min, currentValue[1]];
|
|
@@ -676,7 +550,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
676
550
|
return [currentValue[0], currentValue[0]];
|
|
677
551
|
}
|
|
678
552
|
};
|
|
679
|
-
|
|
680
553
|
this._handleEndKey = handler => {
|
|
681
554
|
const {
|
|
682
555
|
max,
|
|
@@ -685,7 +558,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
685
558
|
const {
|
|
686
559
|
range
|
|
687
560
|
} = this.getProps();
|
|
688
|
-
|
|
689
561
|
if (handler === 'min') {
|
|
690
562
|
if (range) {
|
|
691
563
|
return [currentValue[1], currentValue[1]];
|
|
@@ -696,7 +568,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
696
568
|
return [currentValue[0], max];
|
|
697
569
|
}
|
|
698
570
|
};
|
|
699
|
-
|
|
700
571
|
this.handleKeyDown = (event, handler) => {
|
|
701
572
|
const {
|
|
702
573
|
min,
|
|
@@ -708,64 +579,50 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
708
579
|
range
|
|
709
580
|
} = this.getProps();
|
|
710
581
|
let outputValue;
|
|
711
|
-
|
|
712
582
|
switch (event.key) {
|
|
713
583
|
case "ArrowLeft":
|
|
714
584
|
case "ArrowDown":
|
|
715
585
|
outputValue = this._handleValueDecreaseWithKeyBoard(step, handler);
|
|
716
586
|
break;
|
|
717
|
-
|
|
718
587
|
case "ArrowRight":
|
|
719
588
|
case "ArrowUp":
|
|
720
589
|
outputValue = this._handleValueIncreaseWithKeyBoard(step, handler);
|
|
721
590
|
break;
|
|
722
|
-
|
|
723
591
|
case "PageUp":
|
|
724
592
|
outputValue = this._handleValueIncreaseWithKeyBoard(10 * step, handler);
|
|
725
593
|
break;
|
|
726
|
-
|
|
727
594
|
case "PageDown":
|
|
728
595
|
outputValue = this._handleValueDecreaseWithKeyBoard(10 * step, handler);
|
|
729
596
|
break;
|
|
730
|
-
|
|
731
597
|
case "Home":
|
|
732
598
|
outputValue = this._handleHomeKey(handler);
|
|
733
599
|
break;
|
|
734
|
-
|
|
735
600
|
case "End":
|
|
736
601
|
outputValue = this._handleEndKey(handler);
|
|
737
602
|
break;
|
|
738
|
-
|
|
739
603
|
case 'default':
|
|
740
604
|
break;
|
|
741
605
|
}
|
|
742
|
-
|
|
743
606
|
if (["ArrowLeft", "ArrowDown", "ArrowRight", "ArrowUp", "PageUp", "PageDown", "Home", "End"].includes(event.key)) {
|
|
744
607
|
let update = true;
|
|
745
|
-
|
|
746
608
|
if (Array.isArray(currentValue)) {
|
|
747
609
|
update = !(currentValue[0] === outputValue[0] && currentValue[1] === outputValue[1]);
|
|
748
610
|
} else {
|
|
749
611
|
update = currentValue !== outputValue;
|
|
750
612
|
}
|
|
751
|
-
|
|
752
613
|
if (update) {
|
|
753
614
|
this._adapter.updateCurrentValue(outputValue);
|
|
754
|
-
|
|
755
615
|
this._adapter.notifyChange(outputValue);
|
|
756
616
|
}
|
|
757
|
-
|
|
758
617
|
handlePrevent(event);
|
|
759
618
|
}
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
|
|
619
|
+
};
|
|
620
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
763
621
|
this.onFocus = (e, handler) => {
|
|
764
622
|
handlePrevent(e);
|
|
765
623
|
const {
|
|
766
624
|
target
|
|
767
625
|
} = e;
|
|
768
|
-
|
|
769
626
|
try {
|
|
770
627
|
if (target.matches(':focus-visible')) {
|
|
771
628
|
if (handler === 'min') {
|
|
@@ -778,30 +635,25 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
778
635
|
warning(true, 'Warning: [Semi Slider] The current browser does not support the focus-visible');
|
|
779
636
|
}
|
|
780
637
|
};
|
|
781
|
-
|
|
782
638
|
this.onBlur = (e, handler) => {
|
|
783
639
|
const {
|
|
784
640
|
firstDotFocusVisible,
|
|
785
641
|
secondDotFocusVisible
|
|
786
642
|
} = this.getStates();
|
|
787
|
-
|
|
788
643
|
if (handler === 'min') {
|
|
789
644
|
firstDotFocusVisible && this._adapter.setStateVal('firstDotFocusVisible', false);
|
|
790
645
|
} else {
|
|
791
646
|
secondDotFocusVisible && this._adapter.setStateVal('secondDotFocusVisible', false);
|
|
792
647
|
}
|
|
793
648
|
};
|
|
794
|
-
|
|
795
649
|
this.handleWrapClick = e => {
|
|
796
650
|
const {
|
|
797
651
|
disabled,
|
|
798
652
|
isDrag
|
|
799
653
|
} = this._adapter.getStates();
|
|
800
|
-
|
|
801
654
|
if (isDrag || disabled || this._adapter.isEventFromHandle(e)) {
|
|
802
655
|
return;
|
|
803
656
|
}
|
|
804
|
-
|
|
805
657
|
const {
|
|
806
658
|
vertical
|
|
807
659
|
} = this.getProps();
|
|
@@ -809,20 +661,16 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
809
661
|
const position = vertical ? mousePos.y : mousePos.x;
|
|
810
662
|
const isMin = this.checkWhichHandle(position);
|
|
811
663
|
const outPutValue = this.calculateOutputValue(position, isMin);
|
|
812
|
-
|
|
813
664
|
if (outPutValue === undefined) {
|
|
814
665
|
return;
|
|
815
666
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
667
|
+
this._adapter.notifyChange(outPutValue);
|
|
668
|
+
// check if is controlled component
|
|
820
669
|
if (this._isControlledComponent()) {
|
|
821
670
|
// only perform callback ops, skip UI update
|
|
822
671
|
return;
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
|
|
672
|
+
}
|
|
673
|
+
// trigger UI state update
|
|
826
674
|
this.setHandlePos(position, isMin, true, outPutValue);
|
|
827
675
|
};
|
|
828
676
|
/**
|
|
@@ -830,12 +678,9 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
830
678
|
*
|
|
831
679
|
* @memberof SliderFoundation
|
|
832
680
|
*/
|
|
833
|
-
|
|
834
|
-
|
|
835
681
|
this.setHandlePos = function (position, isMin) {
|
|
836
682
|
let clickTrack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
837
683
|
let outPutValue = arguments.length > 3 ? arguments[3] : undefined;
|
|
838
|
-
|
|
839
684
|
_this._adapter.onHandleMove(position, isMin, () => _this._adapter.onHandleUpAfter(), clickTrack, outPutValue);
|
|
840
685
|
};
|
|
841
686
|
/**
|
|
@@ -843,50 +688,38 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
843
688
|
*
|
|
844
689
|
* @memberof SliderFoundation
|
|
845
690
|
*/
|
|
846
|
-
|
|
847
|
-
|
|
848
691
|
this.checkWhichHandle = pagePos => {
|
|
849
692
|
const {
|
|
850
693
|
vertical,
|
|
851
694
|
verticalReverse
|
|
852
695
|
} = this.getProps();
|
|
853
|
-
|
|
854
696
|
const {
|
|
855
697
|
currentValue
|
|
856
698
|
} = this._adapter.getStates();
|
|
857
|
-
|
|
858
699
|
const currentPos = this.transValueToPos(currentValue);
|
|
859
700
|
let isMin = true;
|
|
860
|
-
|
|
861
701
|
if (Array.isArray(currentPos)) {
|
|
862
702
|
// Slide on both sides
|
|
863
703
|
if (pagePos > currentPos[1] || Math.abs(pagePos - currentPos[0]) > Math.abs(pagePos - currentPos[1])) {
|
|
864
704
|
isMin = false;
|
|
865
705
|
}
|
|
866
706
|
}
|
|
867
|
-
|
|
868
707
|
if (vertical && verticalReverse) {
|
|
869
708
|
isMin = !isMin;
|
|
870
709
|
}
|
|
871
|
-
|
|
872
710
|
return isMin;
|
|
873
711
|
};
|
|
874
|
-
|
|
875
712
|
this.handleWrapperEnter = () => {
|
|
876
713
|
this._adapter.setStateVal('showBoundary', true);
|
|
877
714
|
};
|
|
878
|
-
|
|
879
715
|
this.handleWrapperLeave = () => {
|
|
880
716
|
this._adapter.setStateVal('showBoundary', false);
|
|
881
717
|
};
|
|
882
718
|
}
|
|
883
|
-
|
|
884
719
|
init() {
|
|
885
720
|
this._checkCurrentValue();
|
|
886
|
-
|
|
887
721
|
this._dragOffset = 0;
|
|
888
722
|
}
|
|
889
|
-
|
|
890
723
|
_checkCurrentValue() {
|
|
891
724
|
const {
|
|
892
725
|
currentValue,
|
|
@@ -894,7 +727,6 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
894
727
|
max
|
|
895
728
|
} = this.getStates();
|
|
896
729
|
let checked;
|
|
897
|
-
|
|
898
730
|
if (Array.isArray(currentValue)) {
|
|
899
731
|
checked = [];
|
|
900
732
|
checked[0] = this._checkValidity(currentValue[0], min, max);
|
|
@@ -902,20 +734,16 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
902
734
|
} else {
|
|
903
735
|
checked = this._checkValidity(currentValue, min, max);
|
|
904
736
|
}
|
|
905
|
-
|
|
906
737
|
this._adapter.updateCurrentValue(checked);
|
|
907
738
|
}
|
|
908
739
|
/**
|
|
909
740
|
* Untie event
|
|
910
741
|
* @memberof SliderFoundation
|
|
911
742
|
*/
|
|
912
|
-
|
|
913
|
-
|
|
914
743
|
destroy() {
|
|
915
744
|
// debugger
|
|
916
745
|
this._adapter.unSubscribeEventListener();
|
|
917
746
|
}
|
|
918
|
-
|
|
919
747
|
_getHandleCenterPosition(vertical, handle) {
|
|
920
748
|
const pos = handle.getBoundingClientRect();
|
|
921
749
|
const {
|
|
@@ -924,5 +752,4 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
924
752
|
} = this.handleMousePos(pos.left + pos.width * 0.5, pos.top + pos.height * 0.5);
|
|
925
753
|
return vertical ? y : x;
|
|
926
754
|
}
|
|
927
|
-
|
|
928
755
|
}
|