@arco-design/mobile-react 2.38.4 → 2.39.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/CHANGELOG.md +16 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/hooks.js +59 -141
- package/cjs/_helpers/index.js +2 -18
- package/cjs/_helpers/react-dom.js +0 -14
- package/cjs/_helpers/render.js +5 -21
- package/cjs/action-sheet/index.js +10 -30
- package/cjs/action-sheet/methods.js +0 -2
- package/cjs/action-sheet/style/css/index.js +0 -2
- package/cjs/action-sheet/style/index.js +0 -2
- package/cjs/avatar/group.js +12 -24
- package/cjs/avatar/index.js +53 -79
- package/cjs/avatar/style/css/index.js +0 -2
- package/cjs/avatar/style/index.js +0 -2
- package/cjs/badge/index.js +18 -29
- package/cjs/badge/style/css/index.js +0 -1
- package/cjs/badge/style/index.js +0 -1
- package/cjs/button/hooks.js +15 -20
- package/cjs/button/index.js +46 -67
- package/cjs/button/style/css/index.js +0 -2
- package/cjs/button/style/index.js +0 -2
- package/cjs/carousel/index.js +153 -288
- package/cjs/carousel/style/css/index.js +0 -1
- package/cjs/carousel/style/index.js +0 -1
- package/cjs/cell/arrow.js +0 -3
- package/cjs/cell/cell.js +18 -34
- package/cjs/cell/group.js +9 -21
- package/cjs/cell/index.js +1 -7
- package/cjs/cell/style/css/index.js +0 -1
- package/cjs/cell/style/index.js +0 -1
- package/cjs/checkbox/checkbox.js +31 -57
- package/cjs/checkbox/group.js +24 -38
- package/cjs/checkbox/hooks/index.js +0 -2
- package/cjs/checkbox/hooks/useMergeProps.js +7 -14
- package/cjs/checkbox/index.js +1 -8
- package/cjs/checkbox/style/css/index.js +0 -1
- package/cjs/checkbox/style/index.js +0 -1
- package/cjs/checkbox/type.js +0 -2
- package/cjs/circle-progress/index.js +37 -57
- package/cjs/circle-progress/style/css/index.js +0 -1
- package/cjs/circle-progress/style/index.js +0 -1
- package/cjs/collapse/collapse.js +30 -61
- package/cjs/collapse/group.js +20 -44
- package/cjs/collapse/index.js +0 -9
- package/cjs/collapse/style/css/index.js +0 -1
- package/cjs/collapse/style/index.js +0 -1
- package/cjs/collapse/utils.js +0 -7
- package/cjs/context-provider/index.js +18 -43
- package/cjs/context-provider/style/css/index.js +0 -1
- package/cjs/context-provider/style/index.js +0 -1
- package/cjs/count-down/hooks.js +24 -43
- package/cjs/count-down/index.js +29 -37
- package/cjs/count-down/singleton.js +2 -12
- package/cjs/count-down/style/css/index.js +0 -1
- package/cjs/count-down/style/index.js +0 -1
- package/cjs/count-down/util.js +33 -47
- package/cjs/date-picker/helper.js +7 -14
- package/cjs/date-picker/index.js +66 -167
- package/cjs/date-picker/style/css/index.js +0 -2
- package/cjs/date-picker/style/index.js +0 -2
- package/cjs/dialog/index.js +31 -57
- package/cjs/dialog/methods.js +9 -22
- package/cjs/dialog/style/css/index.js +0 -2
- package/cjs/dialog/style/index.js +0 -2
- package/cjs/divider/index.js +8 -20
- package/cjs/divider/style/css/index.js +0 -1
- package/cjs/divider/style/index.js +0 -1
- package/cjs/dropdown/dropdown.js +74 -113
- package/cjs/dropdown/index.js +1 -8
- package/cjs/dropdown/options.js +12 -28
- package/cjs/dropdown/style/css/index.js +0 -1
- package/cjs/dropdown/style/index.js +0 -1
- package/cjs/dropdown-menu/dropdown-menu.js +49 -84
- package/cjs/dropdown-menu/helper.js +4 -24
- package/cjs/dropdown-menu/index.js +0 -6
- package/cjs/dropdown-menu/style/css/index.js +0 -2
- package/cjs/dropdown-menu/style/index.js +0 -2
- package/cjs/ellipsis/components/js-ellipsis.js +32 -70
- package/cjs/ellipsis/components/native-ellipsis.js +9 -14
- package/cjs/ellipsis/index.js +19 -32
- package/cjs/ellipsis/style/css/index.js +0 -1
- package/cjs/ellipsis/style/index.js +0 -1
- package/cjs/ellipsis/utils/dom.js +0 -8
- package/cjs/ellipsis/utils/is.js +1 -5
- package/cjs/form/form-item-context.js +0 -5
- package/cjs/form/form-item.js +74 -163
- package/cjs/form/index.js +18 -38
- package/cjs/form/linked-container.js +5 -24
- package/cjs/form/style/css/index.js +0 -1
- package/cjs/form/style/index.js +0 -1
- package/cjs/form/type.d.ts +11 -1
- package/cjs/form/type.js +0 -5
- package/cjs/form/useForm.js +10 -79
- package/cjs/form/utils.js +4 -22
- package/cjs/grid/index.js +22 -45
- package/cjs/grid/style/css/index.js +0 -1
- package/cjs/grid/style/index.js +0 -1
- package/cjs/icon/IconAdd/index.js +5 -12
- package/cjs/icon/IconArrowBack/index.js +5 -12
- package/cjs/icon/IconArrowDown/index.js +5 -12
- package/cjs/icon/IconArrowIn/index.js +5 -12
- package/cjs/icon/IconArrowUp/index.js +5 -12
- package/cjs/icon/IconCheck/index.js +5 -12
- package/cjs/icon/IconCheckBold/index.js +5 -12
- package/cjs/icon/IconCircleChecked/index.js +5 -12
- package/cjs/icon/IconCircleDisabled/index.js +5 -12
- package/cjs/icon/IconCircleUnchecked/index.js +5 -12
- package/cjs/icon/IconClear/index.js +5 -12
- package/cjs/icon/IconClose/index.js +5 -12
- package/cjs/icon/IconCloseBold/index.js +5 -12
- package/cjs/icon/IconDelete/index.js +5 -12
- package/cjs/icon/IconDownload/index.js +5 -12
- package/cjs/icon/IconEdit/index.js +5 -12
- package/cjs/icon/IconErrorCircle/index.js +5 -12
- package/cjs/icon/IconEyeInvisible/index.js +5 -12
- package/cjs/icon/IconEyeVisible/index.js +5 -12
- package/cjs/icon/IconEyelashInvisible/index.js +5 -12
- package/cjs/icon/IconFile/index.js +5 -12
- package/cjs/icon/IconGift/index.js +5 -12
- package/cjs/icon/IconHeart/index.js +5 -12
- package/cjs/icon/IconHome/index.js +5 -12
- package/cjs/icon/IconKeyboard/index.js +5 -12
- package/cjs/icon/IconKeyboardDelete/index.js +5 -12
- package/cjs/icon/IconLikeCircle/index.js +5 -12
- package/cjs/icon/IconMinus/index.js +5 -12
- package/cjs/icon/IconMore/index.js +5 -12
- package/cjs/icon/IconNotice/index.js +5 -12
- package/cjs/icon/IconNoticeOff/index.js +5 -12
- package/cjs/icon/IconPicture/index.js +5 -12
- package/cjs/icon/IconPlay/index.js +5 -12
- package/cjs/icon/IconQuestionCircle/index.js +5 -12
- package/cjs/icon/IconRefresh/index.js +5 -12
- package/cjs/icon/IconSad/index.js +5 -12
- package/cjs/icon/IconScan/index.js +5 -12
- package/cjs/icon/IconSearch/index.js +5 -12
- package/cjs/icon/IconSetting/index.js +5 -12
- package/cjs/icon/IconShop/index.js +5 -12
- package/cjs/icon/IconShopping/index.js +5 -12
- package/cjs/icon/IconSmileFill/index.js +5 -12
- package/cjs/icon/IconSound/index.js +5 -12
- package/cjs/icon/IconSquareChecked/index.js +5 -12
- package/cjs/icon/IconSquareDisabled/index.js +5 -12
- package/cjs/icon/IconSquareUnchecked/index.js +5 -12
- package/cjs/icon/IconStar/index.js +5 -12
- package/cjs/icon/IconStarFill/index.js +5 -12
- package/cjs/icon/IconStarHalf/index.js +5 -12
- package/cjs/icon/IconSubway/index.js +5 -12
- package/cjs/icon/IconSuccessCircle/index.js +5 -12
- package/cjs/icon/IconTriDown/index.js +5 -12
- package/cjs/icon/IconTriUp/index.js +5 -12
- package/cjs/icon/IconUpload/index.js +5 -12
- package/cjs/icon/IconUser/index.js +5 -12
- package/cjs/icon/IconUserFill/index.js +5 -12
- package/cjs/icon/IconWarnCircle/index.js +5 -12
- package/cjs/icon/IconWarnCircleFill/index.js +5 -12
- package/cjs/icon/index.js +0 -119
- package/cjs/image/index.js +53 -94
- package/cjs/image/style/css/index.js +0 -2
- package/cjs/image/style/index.js +0 -2
- package/cjs/image-picker/add-icon.js +0 -3
- package/cjs/image-picker/index.js +32 -59
- package/cjs/image-picker/style/css/index.js +0 -3
- package/cjs/image-picker/style/index.js +0 -3
- package/cjs/image-preview/index.js +129 -254
- package/cjs/image-preview/methods.js +5 -18
- package/cjs/image-preview/style/css/index.js +0 -4
- package/cjs/image-preview/style/index.js +0 -4
- package/cjs/index-bar/context.js +0 -2
- package/cjs/index-bar/group.js +16 -35
- package/cjs/index-bar/index.js +55 -87
- package/cjs/index-bar/side-bar.js +15 -34
- package/cjs/index-bar/style/css/index.js +0 -2
- package/cjs/index-bar/style/index.js +0 -2
- package/cjs/index-bar/utils.js +3 -17
- package/cjs/index.js +0 -119
- package/cjs/input/hooks.js +45 -84
- package/cjs/input/index.js +26 -40
- package/cjs/input/style/css/index.js +0 -1
- package/cjs/input/style/index.js +0 -1
- package/cjs/keyboard/index.js +37 -73
- package/cjs/keyboard/style/css/index.js +0 -2
- package/cjs/keyboard/style/index.js +0 -2
- package/cjs/load-more/index.js +33 -65
- package/cjs/load-more/style/css/index.js +0 -1
- package/cjs/load-more/style/index.js +0 -1
- package/cjs/loading/index.js +19 -48
- package/cjs/loading/style/css/index.js +0 -1
- package/cjs/loading/style/index.js +0 -1
- package/cjs/masking/index.js +47 -80
- package/cjs/masking/methods.js +5 -21
- package/cjs/masking/style/css/index.js +0 -2
- package/cjs/masking/style/index.js +0 -2
- package/cjs/nav-bar/back-icon.js +2 -8
- package/cjs/nav-bar/index.js +37 -61
- package/cjs/nav-bar/style/css/index.js +0 -1
- package/cjs/nav-bar/style/index.js +0 -1
- package/cjs/notice-bar/index.js +34 -60
- package/cjs/notice-bar/style/css/index.js +0 -1
- package/cjs/notice-bar/style/index.js +0 -1
- package/cjs/notify/index.js +20 -49
- package/cjs/notify/methods.js +2 -17
- package/cjs/notify/style/css/index.js +0 -1
- package/cjs/notify/style/index.js +0 -1
- package/cjs/pagination/arrow.js +0 -3
- package/cjs/pagination/index.js +27 -58
- package/cjs/pagination/style/css/index.js +0 -1
- package/cjs/pagination/style/index.js +0 -1
- package/cjs/picker/index.js +48 -84
- package/cjs/picker/style/css/index.js +0 -3
- package/cjs/picker/style/index.js +0 -3
- package/cjs/picker-view/components/cascader.js +13 -32
- package/cjs/picker-view/components/multi-picker.js +8 -17
- package/cjs/picker-view/components/picker-cell.js +45 -101
- package/cjs/picker-view/index.js +30 -76
- package/cjs/picker-view/style/css/index.js +0 -1
- package/cjs/picker-view/style/index.js +0 -1
- package/cjs/popover/hooks/index.js +0 -4
- package/cjs/popover/hooks/useEvent.js +25 -49
- package/cjs/popover/hooks/usePosition.js +100 -159
- package/cjs/popover/index.js +1 -8
- package/cjs/popover/menu.js +32 -52
- package/cjs/popover/popover-inner.js +30 -48
- package/cjs/popover/popover.js +69 -101
- package/cjs/popover/style/css/index.js +0 -2
- package/cjs/popover/style/index.js +0 -2
- package/cjs/popup/index.js +22 -39
- package/cjs/popup/methods.js +0 -2
- package/cjs/popup/style/css/index.js +0 -2
- package/cjs/popup/style/index.js +0 -2
- package/cjs/popup-swiper/index.js +50 -92
- package/cjs/popup-swiper/methods.js +0 -2
- package/cjs/popup-swiper/style/css/index.js +0 -2
- package/cjs/popup-swiper/style/index.js +0 -2
- package/cjs/portal/index.js +3 -8
- package/cjs/portal/style/css/index.js +0 -1
- package/cjs/portal/style/index.js +0 -1
- package/cjs/progress/index.js +27 -44
- package/cjs/progress/style/css/index.js +0 -1
- package/cjs/progress/style/index.js +0 -1
- package/cjs/pull-refresh/android-pull-refresh.js +56 -95
- package/cjs/pull-refresh/hooks.js +11 -32
- package/cjs/pull-refresh/index.js +3 -14
- package/cjs/pull-refresh/ios-pull-refresh.js +53 -81
- package/cjs/pull-refresh/model.js +0 -1
- package/cjs/pull-refresh/style/css/index.js +0 -2
- package/cjs/pull-refresh/style/index.js +0 -2
- package/cjs/radio/group.js +20 -34
- package/cjs/radio/index.js +1 -8
- package/cjs/radio/radio.js +0 -10
- package/cjs/radio/style/css/index.js +0 -1
- package/cjs/radio/style/index.js +0 -1
- package/cjs/rate/index.js +28 -54
- package/cjs/rate/style/css/index.js +0 -1
- package/cjs/rate/style/index.js +0 -1
- package/cjs/search-bar/association.js +14 -32
- package/cjs/search-bar/cancel-button.js +8 -16
- package/cjs/search-bar/highlight.js +14 -25
- package/cjs/search-bar/index.js +77 -97
- package/cjs/search-bar/style/css/index.js +0 -1
- package/cjs/search-bar/style/index.js +0 -1
- package/cjs/show-monitor/index.js +40 -108
- package/cjs/show-monitor/style/css/index.js +0 -1
- package/cjs/show-monitor/style/index.js +0 -1
- package/cjs/skeleton/elements.js +47 -84
- package/cjs/skeleton/index.js +18 -36
- package/cjs/skeleton/skeleton-context.js +0 -4
- package/cjs/skeleton/style/css/index.js +0 -2
- package/cjs/skeleton/style/index.js +0 -2
- package/cjs/slider/hooks/index.js +0 -13
- package/cjs/slider/hooks/useSliderEvents.js +27 -59
- package/cjs/slider/hooks/useSliderIcon.js +6 -20
- package/cjs/slider/hooks/useSliderInit.js +32 -52
- package/cjs/slider/hooks/useSliderStyle.js +13 -27
- package/cjs/slider/index.js +47 -73
- package/cjs/slider/marks.js +13 -27
- package/cjs/slider/popover.js +4 -13
- package/cjs/slider/style/css/index.js +0 -2
- package/cjs/slider/style/index.js +0 -2
- package/cjs/slider/thumb.js +11 -22
- package/cjs/stepper/hooks/useButtonClick.js +15 -25
- package/cjs/stepper/hooks/useInputEvent.js +10 -19
- package/cjs/stepper/hooks/useValue.js +9 -15
- package/cjs/stepper/index.js +84 -98
- package/cjs/stepper/style/css/index.js +0 -1
- package/cjs/stepper/style/index.js +0 -1
- package/cjs/steps/index.js +25 -43
- package/cjs/steps/step.js +10 -27
- package/cjs/steps/style/css/index.js +0 -1
- package/cjs/steps/style/index.js +0 -1
- package/cjs/sticky/index.js +40 -74
- package/cjs/sticky/style/css/index.js +0 -1
- package/cjs/sticky/style/index.js +0 -1
- package/cjs/style.js +0 -59
- package/cjs/swipe-action/index.js +40 -92
- package/cjs/swipe-action/item.js +9 -17
- package/cjs/swipe-action/style/css/index.js +0 -1
- package/cjs/swipe-action/style/index.js +0 -1
- package/cjs/swipe-load/index.js +78 -113
- package/cjs/swipe-load/style/css/index.js +0 -1
- package/cjs/swipe-load/style/index.js +0 -1
- package/cjs/switch/index.js +28 -49
- package/cjs/switch/style/css/index.js +0 -1
- package/cjs/switch/style/index.js +0 -1
- package/cjs/tab-bar/index.js +0 -7
- package/cjs/tab-bar/item.js +6 -24
- package/cjs/tab-bar/style/css/index.js +0 -1
- package/cjs/tab-bar/style/index.js +0 -1
- package/cjs/tab-bar/tab-bar.js +16 -32
- package/cjs/tabs/index.js +136 -206
- package/cjs/tabs/style/css/index.js +0 -1
- package/cjs/tabs/style/index.js +0 -1
- package/cjs/tabs/tab-cell-underline.js +28 -76
- package/cjs/tabs/tab-cell.js +73 -128
- package/cjs/tabs/tab-pane.js +53 -103
- package/cjs/tag/index.js +1 -8
- package/cjs/tag/list.js +11 -26
- package/cjs/tag/style/css/index.js +0 -1
- package/cjs/tag/style/index.js +0 -1
- package/cjs/tag/tag.js +20 -32
- package/cjs/textarea/index.js +35 -56
- package/cjs/textarea/style/css/index.js +0 -2
- package/cjs/textarea/style/index.js +0 -2
- package/cjs/toast/index.js +26 -61
- package/cjs/toast/methods.js +2 -16
- package/cjs/toast/style/css/index.js +0 -3
- package/cjs/toast/style/index.js +0 -3
- package/cjs/transition/index.js +17 -29
- package/cjs/transition/style/css/index.js +0 -1
- package/cjs/transition/style/index.js +0 -1
- package/cjs/uploader/index.d.ts +1 -1
- package/cjs/uploader/index.js +28 -49
- package/cjs/uploader/style/css/index.js +0 -3
- package/cjs/uploader/style/index.js +0 -3
- package/cjs/uploader/upload/index.js +0 -4
- package/cjs/uploader/upload/upload.js +9 -45
- package/dist/index.js +3838 -6455
- package/dist/index.min.js +2 -2
- package/esm/_helpers/hooks.js +59 -123
- package/esm/_helpers/index.js +4 -6
- package/esm/_helpers/react-dom.js +0 -11
- package/esm/_helpers/render.js +5 -15
- package/esm/action-sheet/index.js +10 -16
- package/esm/avatar/group.js +12 -16
- package/esm/avatar/index.js +53 -64
- package/esm/badge/index.js +18 -22
- package/esm/button/hooks.js +15 -18
- package/esm/button/index.js +46 -57
- package/esm/carousel/index.js +153 -280
- package/esm/cell/cell.js +18 -25
- package/esm/cell/group.js +9 -11
- package/esm/cell/index.js +1 -1
- package/esm/checkbox/checkbox.js +31 -42
- package/esm/checkbox/group.js +24 -28
- package/esm/checkbox/hooks/useMergeProps.js +7 -9
- package/esm/checkbox/index.js +2 -2
- package/esm/checkbox/type.js +0 -1
- package/esm/circle-progress/index.js +37 -49
- package/esm/collapse/collapse.js +30 -51
- package/esm/collapse/group.js +20 -34
- package/esm/collapse/index.js +1 -1
- package/esm/collapse/utils.js +0 -1
- package/esm/context-provider/index.js +18 -33
- package/esm/count-down/hooks.js +24 -37
- package/esm/count-down/index.js +30 -29
- package/esm/count-down/singleton.js +2 -5
- package/esm/count-down/util.js +33 -42
- package/esm/date-picker/helper.js +7 -9
- package/esm/date-picker/index.js +66 -155
- package/esm/dialog/index.js +31 -42
- package/esm/dialog/methods.js +9 -11
- package/esm/divider/index.js +8 -12
- package/esm/dropdown/dropdown.js +74 -102
- package/esm/dropdown/index.js +1 -1
- package/esm/dropdown/options.js +12 -20
- package/esm/dropdown-menu/dropdown-menu.js +49 -74
- package/esm/dropdown-menu/helper.js +4 -14
- package/esm/dropdown-menu/index.js +1 -1
- package/esm/ellipsis/components/js-ellipsis.js +32 -60
- package/esm/ellipsis/components/native-ellipsis.js +9 -11
- package/esm/ellipsis/index.js +20 -21
- package/esm/ellipsis/utils/dom.js +0 -7
- package/esm/ellipsis/utils/is.js +1 -1
- package/esm/form/form-item.js +74 -147
- package/esm/form/index.js +18 -23
- package/esm/form/linked-container.js +5 -14
- package/esm/form/type.d.ts +11 -1
- package/esm/form/type.js +0 -5
- package/esm/form/useForm.js +10 -74
- package/esm/form/utils.js +4 -11
- package/esm/grid/index.js +22 -38
- package/esm/icon/IconAdd/index.js +5 -6
- package/esm/icon/IconArrowBack/index.js +5 -6
- package/esm/icon/IconArrowDown/index.js +5 -6
- package/esm/icon/IconArrowIn/index.js +5 -6
- package/esm/icon/IconArrowUp/index.js +5 -6
- package/esm/icon/IconCheck/index.js +5 -6
- package/esm/icon/IconCheckBold/index.js +5 -6
- package/esm/icon/IconCircleChecked/index.js +5 -6
- package/esm/icon/IconCircleDisabled/index.js +5 -6
- package/esm/icon/IconCircleUnchecked/index.js +5 -6
- package/esm/icon/IconClear/index.js +5 -6
- package/esm/icon/IconClose/index.js +5 -6
- package/esm/icon/IconCloseBold/index.js +5 -6
- package/esm/icon/IconDelete/index.js +5 -6
- package/esm/icon/IconDownload/index.js +5 -6
- package/esm/icon/IconEdit/index.js +5 -6
- package/esm/icon/IconErrorCircle/index.js +5 -6
- package/esm/icon/IconEyeInvisible/index.js +5 -6
- package/esm/icon/IconEyeVisible/index.js +5 -6
- package/esm/icon/IconEyelashInvisible/index.js +5 -6
- package/esm/icon/IconFile/index.js +5 -6
- package/esm/icon/IconGift/index.js +5 -6
- package/esm/icon/IconHeart/index.js +5 -6
- package/esm/icon/IconHome/index.js +5 -6
- package/esm/icon/IconKeyboard/index.js +5 -6
- package/esm/icon/IconKeyboardDelete/index.js +5 -6
- package/esm/icon/IconLikeCircle/index.js +5 -6
- package/esm/icon/IconMinus/index.js +5 -6
- package/esm/icon/IconMore/index.js +5 -6
- package/esm/icon/IconNotice/index.js +5 -6
- package/esm/icon/IconNoticeOff/index.js +5 -6
- package/esm/icon/IconPicture/index.js +5 -6
- package/esm/icon/IconPlay/index.js +5 -6
- package/esm/icon/IconQuestionCircle/index.js +5 -6
- package/esm/icon/IconRefresh/index.js +5 -6
- package/esm/icon/IconSad/index.js +5 -6
- package/esm/icon/IconScan/index.js +5 -6
- package/esm/icon/IconSearch/index.js +5 -6
- package/esm/icon/IconSetting/index.js +5 -6
- package/esm/icon/IconShop/index.js +5 -6
- package/esm/icon/IconShopping/index.js +5 -6
- package/esm/icon/IconSmileFill/index.js +5 -6
- package/esm/icon/IconSound/index.js +5 -6
- package/esm/icon/IconSquareChecked/index.js +5 -6
- package/esm/icon/IconSquareDisabled/index.js +5 -6
- package/esm/icon/IconSquareUnchecked/index.js +5 -6
- package/esm/icon/IconStar/index.js +5 -6
- package/esm/icon/IconStarFill/index.js +5 -6
- package/esm/icon/IconStarHalf/index.js +5 -6
- package/esm/icon/IconSubway/index.js +5 -6
- package/esm/icon/IconSuccessCircle/index.js +5 -6
- package/esm/icon/IconTriDown/index.js +5 -6
- package/esm/icon/IconTriUp/index.js +5 -6
- package/esm/icon/IconUpload/index.js +5 -6
- package/esm/icon/IconUser/index.js +5 -6
- package/esm/icon/IconUserFill/index.js +5 -6
- package/esm/icon/IconWarnCircle/index.js +5 -6
- package/esm/icon/IconWarnCircleFill/index.js +5 -6
- package/esm/image/index.js +53 -85
- package/esm/image-picker/index.js +32 -42
- package/esm/image-preview/index.js +129 -232
- package/esm/image-preview/methods.js +5 -14
- package/esm/index-bar/group.js +16 -25
- package/esm/index-bar/index.js +55 -74
- package/esm/index-bar/side-bar.js +15 -28
- package/esm/index-bar/utils.js +3 -10
- package/esm/input/hooks.js +45 -75
- package/esm/input/index.js +26 -30
- package/esm/keyboard/index.js +40 -63
- package/esm/load-more/index.js +33 -57
- package/esm/loading/index.js +19 -40
- package/esm/masking/index.js +47 -65
- package/esm/masking/methods.js +5 -16
- package/esm/nav-bar/back-icon.js +2 -4
- package/esm/nav-bar/index.js +37 -52
- package/esm/notice-bar/index.js +34 -53
- package/esm/notify/index.js +20 -33
- package/esm/notify/methods.js +2 -13
- package/esm/pagination/index.js +27 -50
- package/esm/picker/index.js +48 -69
- package/esm/picker-view/components/cascader.js +13 -24
- package/esm/picker-view/components/multi-picker.js +8 -14
- package/esm/picker-view/components/picker-cell.js +45 -93
- package/esm/picker-view/index.js +30 -60
- package/esm/popover/hooks/useEvent.js +26 -41
- package/esm/popover/hooks/usePosition.js +100 -152
- package/esm/popover/index.js +2 -2
- package/esm/popover/menu.js +32 -41
- package/esm/popover/popover-inner.js +30 -39
- package/esm/popover/popover.js +69 -90
- package/esm/popup/index.js +22 -25
- package/esm/popup-swiper/index.js +50 -76
- package/esm/portal/index.js +3 -5
- package/esm/progress/index.js +27 -36
- package/esm/pull-refresh/android-pull-refresh.js +56 -83
- package/esm/pull-refresh/hooks.js +11 -23
- package/esm/pull-refresh/index.js +3 -5
- package/esm/pull-refresh/ios-pull-refresh.js +53 -68
- package/esm/pull-refresh/model.js +0 -1
- package/esm/radio/group.js +20 -24
- package/esm/radio/index.js +2 -2
- package/esm/rate/index.js +28 -43
- package/esm/search-bar/association.js +14 -27
- package/esm/search-bar/cancel-button.js +8 -11
- package/esm/search-bar/highlight.js +14 -20
- package/esm/search-bar/index.js +77 -86
- package/esm/show-monitor/index.js +40 -100
- package/esm/skeleton/elements.js +47 -75
- package/esm/skeleton/index.js +18 -24
- package/esm/slider/hooks/useSliderEvents.js +27 -54
- package/esm/slider/hooks/useSliderIcon.js +6 -13
- package/esm/slider/hooks/useSliderInit.js +32 -46
- package/esm/slider/hooks/useSliderStyle.js +13 -22
- package/esm/slider/index.js +47 -63
- package/esm/slider/marks.js +13 -19
- package/esm/slider/popover.js +4 -6
- package/esm/slider/thumb.js +11 -16
- package/esm/stepper/hooks/useButtonClick.js +15 -24
- package/esm/stepper/hooks/useInputEvent.js +10 -17
- package/esm/stepper/hooks/useValue.js +9 -12
- package/esm/stepper/index.js +84 -84
- package/esm/steps/index.js +25 -30
- package/esm/steps/step.js +10 -19
- package/esm/sticky/index.js +40 -65
- package/esm/swipe-action/index.js +40 -80
- package/esm/swipe-action/item.js +9 -12
- package/esm/swipe-load/index.js +79 -104
- package/esm/switch/index.js +28 -41
- package/esm/tab-bar/index.js +0 -1
- package/esm/tab-bar/item.js +6 -13
- package/esm/tab-bar/tab-bar.js +16 -22
- package/esm/tabs/index.js +137 -194
- package/esm/tabs/tab-cell-underline.js +28 -67
- package/esm/tabs/tab-cell.js +73 -118
- package/esm/tabs/tab-pane.js +53 -95
- package/esm/tag/index.js +2 -2
- package/esm/tag/list.js +11 -16
- package/esm/tag/tag.js +20 -22
- package/esm/textarea/index.js +35 -46
- package/esm/toast/index.js +26 -42
- package/esm/toast/methods.js +2 -12
- package/esm/transition/index.js +17 -20
- package/esm/uploader/index.d.ts +1 -1
- package/esm/uploader/index.js +28 -34
- package/esm/uploader/upload/upload.js +9 -38
- package/esnext/form/form-item.js +12 -7
- package/esnext/form/type.d.ts +11 -1
- package/esnext/uploader/index.d.ts +1 -1
- package/esnext/uploader/index.js +1 -1
- package/esnext/uploader/upload/upload.js +1 -1
- package/package.json +5 -3
- package/tokens/app/arcodesign/default/index.js +0 -2
- package/umd/_helpers/hooks.js +59 -138
- package/umd/_helpers/index.js +2 -9
- package/umd/_helpers/react-dom.js +0 -13
- package/umd/_helpers/render.js +5 -17
- package/umd/action-sheet/index.js +10 -22
- package/umd/action-sheet/methods.js +0 -1
- package/umd/avatar/group.js +12 -20
- package/umd/avatar/index.js +53 -70
- package/umd/badge/index.js +18 -25
- package/umd/button/hooks.js +15 -19
- package/umd/button/index.js +46 -60
- package/umd/carousel/index.js +153 -283
- package/umd/cell/arrow.js +0 -2
- package/umd/cell/cell.js +18 -29
- package/umd/cell/group.js +9 -17
- package/umd/cell/index.js +1 -2
- package/umd/checkbox/checkbox.js +31 -45
- package/umd/checkbox/group.js +24 -34
- package/umd/checkbox/hooks/useMergeProps.js +7 -12
- package/umd/checkbox/index.js +1 -3
- package/umd/checkbox/type.js +0 -2
- package/umd/circle-progress/index.js +37 -52
- package/umd/collapse/collapse.js +30 -55
- package/umd/collapse/group.js +20 -38
- package/umd/collapse/index.js +0 -3
- package/umd/collapse/utils.js +0 -5
- package/umd/context-provider/index.js +18 -38
- package/umd/count-down/hooks.js +24 -39
- package/umd/count-down/index.js +29 -31
- package/umd/count-down/singleton.js +2 -10
- package/umd/count-down/util.js +33 -47
- package/umd/date-picker/helper.js +7 -13
- package/umd/date-picker/index.js +66 -158
- package/umd/dialog/index.js +31 -47
- package/umd/dialog/methods.js +9 -18
- package/umd/divider/index.js +8 -15
- package/umd/dropdown/dropdown.js +74 -106
- package/umd/dropdown/index.js +1 -3
- package/umd/dropdown/options.js +12 -24
- package/umd/dropdown-menu/dropdown-menu.js +49 -78
- package/umd/dropdown-menu/helper.js +4 -22
- package/umd/dropdown-menu/index.js +0 -2
- package/umd/ellipsis/components/js-ellipsis.js +32 -66
- package/umd/ellipsis/components/native-ellipsis.js +9 -12
- package/umd/ellipsis/index.js +19 -24
- package/umd/ellipsis/utils/dom.js +0 -8
- package/umd/ellipsis/utils/is.js +1 -5
- package/umd/form/form-item-context.js +0 -3
- package/umd/form/form-item.js +74 -151
- package/umd/form/index.js +18 -28
- package/umd/form/linked-container.js +5 -19
- package/umd/form/type.d.ts +11 -1
- package/umd/form/type.js +0 -5
- package/umd/form/useForm.js +10 -74
- package/umd/form/utils.js +4 -19
- package/umd/grid/index.js +22 -41
- package/umd/icon/IconAdd/index.js +5 -7
- package/umd/icon/IconArrowBack/index.js +5 -7
- package/umd/icon/IconArrowDown/index.js +5 -7
- package/umd/icon/IconArrowIn/index.js +5 -7
- package/umd/icon/IconArrowUp/index.js +5 -7
- package/umd/icon/IconCheck/index.js +5 -7
- package/umd/icon/IconCheckBold/index.js +5 -7
- package/umd/icon/IconCircleChecked/index.js +5 -7
- package/umd/icon/IconCircleDisabled/index.js +5 -7
- package/umd/icon/IconCircleUnchecked/index.js +5 -7
- package/umd/icon/IconClear/index.js +5 -7
- package/umd/icon/IconClose/index.js +5 -7
- package/umd/icon/IconCloseBold/index.js +5 -7
- package/umd/icon/IconDelete/index.js +5 -7
- package/umd/icon/IconDownload/index.js +5 -7
- package/umd/icon/IconEdit/index.js +5 -7
- package/umd/icon/IconErrorCircle/index.js +5 -7
- package/umd/icon/IconEyeInvisible/index.js +5 -7
- package/umd/icon/IconEyeVisible/index.js +5 -7
- package/umd/icon/IconEyelashInvisible/index.js +5 -7
- package/umd/icon/IconFile/index.js +5 -7
- package/umd/icon/IconGift/index.js +5 -7
- package/umd/icon/IconHeart/index.js +5 -7
- package/umd/icon/IconHome/index.js +5 -7
- package/umd/icon/IconKeyboard/index.js +5 -7
- package/umd/icon/IconKeyboardDelete/index.js +5 -7
- package/umd/icon/IconLikeCircle/index.js +5 -7
- package/umd/icon/IconMinus/index.js +5 -7
- package/umd/icon/IconMore/index.js +5 -7
- package/umd/icon/IconNotice/index.js +5 -7
- package/umd/icon/IconNoticeOff/index.js +5 -7
- package/umd/icon/IconPicture/index.js +5 -7
- package/umd/icon/IconPlay/index.js +5 -7
- package/umd/icon/IconQuestionCircle/index.js +5 -7
- package/umd/icon/IconRefresh/index.js +5 -7
- package/umd/icon/IconSad/index.js +5 -7
- package/umd/icon/IconScan/index.js +5 -7
- package/umd/icon/IconSearch/index.js +5 -7
- package/umd/icon/IconSetting/index.js +5 -7
- package/umd/icon/IconShop/index.js +5 -7
- package/umd/icon/IconShopping/index.js +5 -7
- package/umd/icon/IconSmileFill/index.js +5 -7
- package/umd/icon/IconSound/index.js +5 -7
- package/umd/icon/IconSquareChecked/index.js +5 -7
- package/umd/icon/IconSquareDisabled/index.js +5 -7
- package/umd/icon/IconSquareUnchecked/index.js +5 -7
- package/umd/icon/IconStar/index.js +5 -7
- package/umd/icon/IconStarFill/index.js +5 -7
- package/umd/icon/IconStarHalf/index.js +5 -7
- package/umd/icon/IconSubway/index.js +5 -7
- package/umd/icon/IconSuccessCircle/index.js +5 -7
- package/umd/icon/IconTriDown/index.js +5 -7
- package/umd/icon/IconTriUp/index.js +5 -7
- package/umd/icon/IconUpload/index.js +5 -7
- package/umd/icon/IconUser/index.js +5 -7
- package/umd/icon/IconUserFill/index.js +5 -7
- package/umd/icon/IconWarnCircle/index.js +5 -7
- package/umd/icon/IconWarnCircleFill/index.js +5 -7
- package/umd/icon/index.js +0 -1
- package/umd/image/index.js +53 -88
- package/umd/image-picker/add-icon.js +0 -2
- package/umd/image-picker/index.js +32 -47
- package/umd/image-preview/index.js +129 -239
- package/umd/image-preview/methods.js +5 -15
- package/umd/index-bar/group.js +16 -30
- package/umd/index-bar/index.js +55 -79
- package/umd/index-bar/side-bar.js +15 -32
- package/umd/index-bar/utils.js +3 -16
- package/umd/index.js +0 -1
- package/umd/input/hooks.js +45 -79
- package/umd/input/index.js +26 -35
- package/umd/keyboard/index.js +37 -64
- package/umd/load-more/index.js +33 -60
- package/umd/loading/index.js +19 -43
- package/umd/masking/index.js +47 -72
- package/umd/masking/methods.js +5 -18
- package/umd/nav-bar/back-icon.js +2 -5
- package/umd/nav-bar/index.js +37 -55
- package/umd/notice-bar/index.js +34 -56
- package/umd/notify/index.js +20 -40
- package/umd/notify/methods.js +2 -14
- package/umd/pagination/arrow.js +0 -2
- package/umd/pagination/index.js +27 -53
- package/umd/picker/index.js +48 -73
- package/umd/picker-view/components/cascader.js +13 -28
- package/umd/picker-view/components/multi-picker.js +8 -16
- package/umd/picker-view/components/picker-cell.js +45 -97
- package/umd/picker-view/index.js +30 -63
- package/umd/popover/hooks/useEvent.js +25 -44
- package/umd/popover/hooks/usePosition.js +100 -153
- package/umd/popover/index.js +1 -3
- package/umd/popover/menu.js +32 -45
- package/umd/popover/popover-inner.js +30 -43
- package/umd/popover/popover.js +69 -94
- package/umd/popup/index.js +22 -31
- package/umd/popup/methods.js +0 -1
- package/umd/popup-swiper/index.js +50 -83
- package/umd/popup-swiper/methods.js +0 -1
- package/umd/portal/index.js +3 -6
- package/umd/progress/index.js +27 -39
- package/umd/pull-refresh/android-pull-refresh.js +56 -86
- package/umd/pull-refresh/hooks.js +11 -29
- package/umd/pull-refresh/index.js +3 -7
- package/umd/pull-refresh/ios-pull-refresh.js +53 -72
- package/umd/pull-refresh/model.js +0 -1
- package/umd/radio/group.js +20 -30
- package/umd/radio/index.js +1 -3
- package/umd/radio/radio.js +0 -5
- package/umd/rate/index.js +28 -48
- package/umd/search-bar/association.js +14 -29
- package/umd/search-bar/cancel-button.js +8 -14
- package/umd/search-bar/highlight.js +14 -21
- package/umd/search-bar/index.js +77 -87
- package/umd/show-monitor/index.js +40 -104
- package/umd/skeleton/elements.js +47 -78
- package/umd/skeleton/index.js +18 -28
- package/umd/skeleton/skeleton-context.js +0 -3
- package/umd/slider/hooks/index.js +0 -4
- package/umd/slider/hooks/useSliderEvents.js +27 -55
- package/umd/slider/hooks/useSliderIcon.js +6 -17
- package/umd/slider/hooks/useSliderInit.js +32 -50
- package/umd/slider/hooks/useSliderStyle.js +13 -24
- package/umd/slider/index.js +47 -66
- package/umd/slider/marks.js +13 -22
- package/umd/slider/popover.js +4 -10
- package/umd/slider/thumb.js +11 -18
- package/umd/stepper/hooks/useButtonClick.js +15 -24
- package/umd/stepper/hooks/useInputEvent.js +10 -18
- package/umd/stepper/hooks/useValue.js +9 -13
- package/umd/stepper/index.js +84 -89
- package/umd/steps/index.js +25 -35
- package/umd/steps/step.js +10 -22
- package/umd/sticky/index.js +40 -68
- package/umd/style.js +1 -1
- package/umd/swipe-action/index.js +40 -84
- package/umd/swipe-action/item.js +9 -14
- package/umd/swipe-load/index.js +78 -106
- package/umd/switch/index.js +28 -45
- package/umd/tab-bar/index.js +0 -2
- package/umd/tab-bar/item.js +6 -19
- package/umd/tab-bar/tab-bar.js +16 -27
- package/umd/tabs/index.js +136 -197
- package/umd/tabs/tab-cell-underline.js +28 -71
- package/umd/tabs/tab-cell.js +73 -122
- package/umd/tabs/tab-pane.js +53 -98
- package/umd/tag/index.js +1 -3
- package/umd/tag/list.js +11 -20
- package/umd/tag/tag.js +20 -26
- package/umd/textarea/index.js +35 -51
- package/umd/toast/index.js +26 -49
- package/umd/toast/methods.js +2 -13
- package/umd/transition/index.js +16 -22
- package/umd/uploader/index.d.ts +1 -1
- package/umd/uploader/index.js +28 -39
- package/umd/uploader/upload/upload.js +9 -43
package/esm/input/hooks.js
CHANGED
|
@@ -5,54 +5,49 @@ import IconClear from '../icon/IconClear';
|
|
|
5
5
|
import { useSystem } from '../_helpers';
|
|
6
6
|
export function useInputLogic(props, inputRef) {
|
|
7
7
|
var value = props.value,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
8
|
+
defaultValue = props.defaultValue,
|
|
9
|
+
validator = props.validator,
|
|
10
|
+
onChange = props.onChange,
|
|
11
|
+
onInput = props.onInput,
|
|
12
|
+
className = props.className,
|
|
13
|
+
style = props.style,
|
|
14
|
+
label = props.label,
|
|
15
|
+
required = props.required,
|
|
16
|
+
prepend = props.prepend,
|
|
17
|
+
append = props.append,
|
|
18
|
+
blurBeforeFocus = props.blurBeforeFocus,
|
|
19
|
+
onKeyDown = props.onKeyDown,
|
|
20
|
+
onPressEnter = props.onPressEnter,
|
|
21
|
+
onFocus = props.onFocus,
|
|
22
|
+
onBlur = props.onBlur,
|
|
23
|
+
onClick = props.onClick,
|
|
24
|
+
disabled = props.disabled,
|
|
25
|
+
_props$border = props.border,
|
|
26
|
+
border = _props$border === void 0 ? 'half' : _props$border,
|
|
27
|
+
prefix = props.prefix,
|
|
28
|
+
suffix = props.suffix,
|
|
29
|
+
clearable = props.clearable,
|
|
30
|
+
_props$clearShowType = props.clearShowType,
|
|
31
|
+
clearShowType = _props$clearShowType === void 0 ? 'focus' : _props$clearShowType,
|
|
32
|
+
_props$clearIcon = props.clearIcon,
|
|
33
|
+
clearIcon = _props$clearIcon === void 0 ? /*#__PURE__*/React.createElement(IconClear, null) : _props$clearIcon,
|
|
34
|
+
_props$preventEventWh = props.preventEventWhenClearing,
|
|
35
|
+
preventEventWhenClearing = _props$preventEventWh === void 0 ? true : _props$preventEventWh,
|
|
36
|
+
onClear = props.onClear,
|
|
37
|
+
autoFocus = props.autoFocus,
|
|
38
|
+
blockChangeWhenCompositing = props.blockChangeWhenCompositing;
|
|
40
39
|
var _useState = useState(value || defaultValue || ''),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
inputValue = _useState[0],
|
|
41
|
+
setInputValue = _useState[1];
|
|
44
42
|
var _useState2 = useState(function () {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
return clearShowType === 'always' || clearShowType === 'value' && Boolean(value || defaultValue);
|
|
44
|
+
}),
|
|
45
|
+
showClear = _useState2[0],
|
|
46
|
+
toggleClear = _useState2[1];
|
|
50
47
|
var compositingRef = useRef(false);
|
|
51
|
-
|
|
52
48
|
var _useState3 = useState(false),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
isFocusing = _useState3[0],
|
|
50
|
+
setIsFocusing = _useState3[1];
|
|
56
51
|
var shouldPreventEvent = useRef(false);
|
|
57
52
|
var actualInputValue = value !== void 0 ? value : inputValue;
|
|
58
53
|
var system = useSystem();
|
|
@@ -69,17 +64,14 @@ export function useInputLogic(props, inputRef) {
|
|
|
69
64
|
var handleCompositionStart = function handleCompositionStart() {
|
|
70
65
|
compositingRef.current = true;
|
|
71
66
|
};
|
|
72
|
-
|
|
73
67
|
var handleCompositionEnd = function handleCompositionEnd(e) {
|
|
74
68
|
compositingRef.current = false;
|
|
75
69
|
handleChange(e);
|
|
76
70
|
};
|
|
77
|
-
|
|
78
71
|
if (inputRef.current && needComposition) {
|
|
79
72
|
inputRef.current.addEventListener('compositionstart', handleCompositionStart);
|
|
80
73
|
inputRef.current.addEventListener('compositionend', handleCompositionEnd);
|
|
81
74
|
}
|
|
82
|
-
|
|
83
75
|
return function () {
|
|
84
76
|
if (inputRef.current && needComposition) {
|
|
85
77
|
inputRef.current.removeEventListener('compositionstart', handleCompositionStart);
|
|
@@ -94,12 +86,10 @@ export function useInputLogic(props, inputRef) {
|
|
|
94
86
|
toggleClear(Boolean(value));
|
|
95
87
|
}
|
|
96
88
|
}, [value]);
|
|
97
|
-
|
|
98
89
|
function changeValue(nowValue, callback) {
|
|
99
90
|
if (callback === void 0) {
|
|
100
91
|
callback = function callback() {};
|
|
101
92
|
}
|
|
102
|
-
|
|
103
93
|
if (nowValue && validator) {
|
|
104
94
|
if (typeof validator === 'function') {
|
|
105
95
|
if (!validator(nowValue)) {
|
|
@@ -108,65 +98,53 @@ export function useInputLogic(props, inputRef) {
|
|
|
108
98
|
} else if (!validator.test(nowValue)) {
|
|
109
99
|
return;
|
|
110
100
|
}
|
|
111
|
-
}
|
|
101
|
+
}
|
|
102
|
+
// 处理非受控模式下的showClear
|
|
112
103
|
// @en Handling showClear in uncontrolled mode
|
|
113
|
-
|
|
114
|
-
|
|
115
104
|
if (clearShowType === 'value' && value === void 0) {
|
|
116
105
|
toggleClear(Boolean(nowValue));
|
|
117
106
|
}
|
|
118
|
-
|
|
119
107
|
setInputValue(nowValue);
|
|
120
108
|
callback();
|
|
121
109
|
}
|
|
122
|
-
|
|
123
110
|
function handleChange(e) {
|
|
124
111
|
if (needComposition && compositingRef.current) {
|
|
125
112
|
return;
|
|
126
113
|
}
|
|
127
|
-
|
|
128
114
|
var newValue = e.target.value;
|
|
129
115
|
changeValue(newValue, function () {
|
|
130
116
|
onChange && onChange(e, newValue);
|
|
131
117
|
});
|
|
132
118
|
}
|
|
133
|
-
|
|
134
119
|
function handleInput(e) {
|
|
135
120
|
var newValue = e.target.value;
|
|
136
121
|
changeValue(newValue, function () {
|
|
137
122
|
onInput && onInput(e, newValue);
|
|
138
123
|
});
|
|
139
124
|
}
|
|
140
|
-
|
|
141
125
|
function handleKeyDown(e) {
|
|
142
126
|
if (e.keyCode === 13) {
|
|
143
127
|
onPressEnter && onPressEnter(e);
|
|
144
128
|
}
|
|
145
|
-
|
|
146
129
|
onKeyDown && onKeyDown(e);
|
|
147
130
|
}
|
|
148
|
-
|
|
149
131
|
function handleFocus(e) {
|
|
150
132
|
if (preventEventWhenClearing && shouldPreventEvent.current) {
|
|
151
133
|
shouldPreventEvent.current = false;
|
|
152
134
|
return;
|
|
153
135
|
}
|
|
154
|
-
|
|
155
136
|
setIsFocusing(true);
|
|
156
137
|
clearShowType === 'focus' && toggleClear(true);
|
|
157
138
|
onFocus && onFocus(e);
|
|
158
139
|
}
|
|
159
|
-
|
|
160
140
|
function handleBlur(e) {
|
|
161
141
|
if (preventEventWhenClearing && shouldPreventEvent.current) {
|
|
162
142
|
return;
|
|
163
143
|
}
|
|
164
|
-
|
|
165
144
|
setIsFocusing(false);
|
|
166
145
|
clearShowType === 'focus' && toggleClear(false);
|
|
167
146
|
onBlur && onBlur(e);
|
|
168
147
|
}
|
|
169
|
-
|
|
170
148
|
function handleClick(e) {
|
|
171
149
|
// 安卓才会有键盘切换不过来的问题,ios不开启此项,因为blur之后不能再自动focus
|
|
172
150
|
// @en Android will have the problem that the keyboard cannot be switched. iOS does not enable this, because it can no longer automatically focus after blur.
|
|
@@ -178,45 +156,38 @@ export function useInputLogic(props, inputRef) {
|
|
|
178
156
|
} else {
|
|
179
157
|
inputRef.current && inputRef.current.focus();
|
|
180
158
|
}
|
|
181
|
-
|
|
182
159
|
onClick && onClick(e);
|
|
183
160
|
}
|
|
184
|
-
|
|
185
161
|
function handleClear(e) {
|
|
186
162
|
// 不展示清除按钮时不触发事件
|
|
187
163
|
// @en No event fired when clear button is not displayed
|
|
188
164
|
if (!clearable || !showClear) {
|
|
189
165
|
return;
|
|
190
166
|
}
|
|
191
|
-
|
|
192
167
|
changeValue('', function () {
|
|
193
|
-
onClear && onClear(e);
|
|
168
|
+
onClear && onClear(e);
|
|
169
|
+
// 当点击clear前是focus时强制执行focus
|
|
194
170
|
// @en Enforce focus when focus is before clicking clear
|
|
195
|
-
|
|
196
171
|
if (isFocusing) {
|
|
197
172
|
if (preventEventWhenClearing) {
|
|
198
|
-
shouldPreventEvent.current = true;
|
|
173
|
+
shouldPreventEvent.current = true;
|
|
174
|
+
// 一段时间未执行blur或focus则重置,避免对下次事件循环造成影响
|
|
199
175
|
// @en If blur or focus is not executed for a period of time, it will be reset to avoid affecting the next event loop
|
|
200
|
-
|
|
201
176
|
setTimeout(function () {
|
|
202
177
|
shouldPreventEvent.current = false;
|
|
203
178
|
}, 200);
|
|
204
179
|
}
|
|
205
|
-
|
|
206
180
|
nextTick(function () {
|
|
207
181
|
inputRef.current && inputRef.current.focus();
|
|
208
182
|
});
|
|
209
183
|
}
|
|
210
184
|
});
|
|
211
185
|
}
|
|
212
|
-
|
|
213
186
|
function renderPendNode(pend) {
|
|
214
187
|
return typeof pend === 'function' ? pend(isFocusing, actualInputValue) : pend;
|
|
215
188
|
}
|
|
216
|
-
|
|
217
189
|
function renderWrapper(prefixCls, type, children) {
|
|
218
190
|
var _clearEvent;
|
|
219
|
-
|
|
220
191
|
// handleClear必须早于handleBlur执行,pc端仅mousedown事件触发早于blur,移动端touch相关事件均早于blur
|
|
221
192
|
// @en handleClear must be executed earlier than handleBlur
|
|
222
193
|
// @en only the mousedown event on the PC side is triggered earlier than blur, and the touch-related events on the mobile side are all earlier than blur
|
|
@@ -246,7 +217,6 @@ export function useInputLogic(props, inputRef) {
|
|
|
246
217
|
className: prefixCls + "-suffix"
|
|
247
218
|
}, suffix) : null), renderPendNode(append));
|
|
248
219
|
}
|
|
249
|
-
|
|
250
220
|
return {
|
|
251
221
|
inputValue: actualInputValue,
|
|
252
222
|
handleChange: handleChange,
|
package/esm/input/index.js
CHANGED
|
@@ -5,42 +5,39 @@ import { ContextLayout } from '../context-provider';
|
|
|
5
5
|
import { useInputLogic } from './hooks';
|
|
6
6
|
var Input = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
7
7
|
var id = props.id,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
name = props.name,
|
|
9
|
+
maxLength = props.maxLength,
|
|
10
|
+
placeholder = props.placeholder,
|
|
11
|
+
readOnly = props.readOnly,
|
|
12
|
+
onKeyUp = props.onKeyUp,
|
|
13
|
+
onKeyPress = props.onKeyPress,
|
|
14
|
+
_props$type = props.type,
|
|
15
|
+
type = _props$type === void 0 ? 'text' : _props$type,
|
|
16
|
+
disabled = props.disabled,
|
|
17
|
+
pattern = props.pattern,
|
|
18
|
+
inputClass = props.inputClass,
|
|
19
|
+
inputStyle = props.inputStyle,
|
|
20
|
+
_props$nativeProps = props.nativeProps,
|
|
21
|
+
nativeProps = _props$nativeProps === void 0 ? {} : _props$nativeProps,
|
|
22
|
+
_props$ariaLabel = props.ariaLabel,
|
|
23
|
+
ariaLabel = _props$ariaLabel === void 0 ? '' : _props$ariaLabel;
|
|
24
24
|
var inputRef = useRef(null);
|
|
25
|
-
|
|
26
25
|
var _useInputLogic = useInputLogic(props, inputRef),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
inputValue = _useInputLogic.inputValue,
|
|
27
|
+
handleChange = _useInputLogic.handleChange,
|
|
28
|
+
handleInput = _useInputLogic.handleInput,
|
|
29
|
+
handleKeyDown = _useInputLogic.handleKeyDown,
|
|
30
|
+
handleFocus = _useInputLogic.handleFocus,
|
|
31
|
+
handleBlur = _useInputLogic.handleBlur,
|
|
32
|
+
handleClick = _useInputLogic.handleClick,
|
|
33
|
+
renderWrapper = _useInputLogic.renderWrapper,
|
|
34
|
+
wrapRef = _useInputLogic.wrapRef;
|
|
37
35
|
useImperativeHandle(ref, function () {
|
|
38
36
|
return {
|
|
39
37
|
dom: wrapRef.current,
|
|
40
38
|
input: inputRef.current
|
|
41
39
|
};
|
|
42
40
|
});
|
|
43
|
-
|
|
44
41
|
function renderInput(_ref) {
|
|
45
42
|
var prefixCls = _ref.prefixCls;
|
|
46
43
|
var prefix = prefixCls + "-input";
|
|
@@ -69,9 +66,9 @@ var Input = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
69
66
|
"aria-label": ariaLabel
|
|
70
67
|
})));
|
|
71
68
|
}
|
|
72
|
-
|
|
73
69
|
return /*#__PURE__*/React.createElement(ContextLayout, null, renderInput);
|
|
74
70
|
});
|
|
71
|
+
|
|
75
72
|
/**
|
|
76
73
|
* 输入框组件,支持添加前后缀。
|
|
77
74
|
* @en The input box, supports adding prefixes and suffixes.
|
|
@@ -81,5 +78,4 @@ var Input = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
81
78
|
* @name_en Input
|
|
82
79
|
* @displayName Input
|
|
83
80
|
*/
|
|
84
|
-
|
|
85
81
|
export default componentWrapper(Input, 'Input');
|
package/esm/keyboard/index.js
CHANGED
|
@@ -6,31 +6,30 @@ import React, { useRef, forwardRef, useImperativeHandle, useMemo, useCallback, u
|
|
|
6
6
|
import { GlobalContext } from '../context-provider';
|
|
7
7
|
import { IconKeyboard, IconKeyboardDelete } from '../icon';
|
|
8
8
|
import Popup from '../popup';
|
|
9
|
-
export * from './type';
|
|
10
|
-
// @en let keyboard random
|
|
9
|
+
export * from './type';
|
|
11
10
|
|
|
11
|
+
// 键盘乱序
|
|
12
|
+
// @en let keyboard random
|
|
12
13
|
var makeArrayRandom = function makeArrayRandom(targetArray) {
|
|
13
14
|
var randomFn = function randomFn() {
|
|
14
15
|
return Math.random() - 0.5;
|
|
15
16
|
};
|
|
16
|
-
|
|
17
17
|
return targetArray.sort(randomFn);
|
|
18
18
|
};
|
|
19
|
-
|
|
20
19
|
var splitArray = function splitArray(target) {
|
|
21
20
|
return target.reduce(function (acc, cur) {
|
|
22
21
|
if (!acc[acc.length - 1] || acc[acc.length - 1].length >= 3) {
|
|
23
22
|
acc.push([]);
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
acc[acc.length - 1].push(cur);
|
|
27
25
|
return acc;
|
|
28
26
|
}, []);
|
|
29
|
-
};
|
|
30
|
-
// @en Pure numeric characters
|
|
31
|
-
|
|
27
|
+
};
|
|
32
28
|
|
|
29
|
+
// 纯数字类字符
|
|
30
|
+
// @en Pure numeric characters
|
|
33
31
|
var contentArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
|
|
32
|
+
|
|
34
33
|
/**
|
|
35
34
|
* 数字键盘组件
|
|
36
35
|
* @en Keyboard component
|
|
@@ -39,56 +38,49 @@ var contentArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
|
|
|
39
38
|
* @name 数字键盘
|
|
40
39
|
* @name_en Keyboard
|
|
41
40
|
*/
|
|
42
|
-
|
|
43
41
|
var Keyboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
44
42
|
var normalKeyClass = props.normalKeyClass,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
43
|
+
normalKeyStyle = props.normalKeyStyle,
|
|
44
|
+
_props$className = props.className,
|
|
45
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
46
|
+
style = props.style,
|
|
47
|
+
_props$type = props.type,
|
|
48
|
+
type = _props$type === void 0 ? 'number' : _props$type,
|
|
49
|
+
_props$randomOrder = props.randomOrder,
|
|
50
|
+
randomOrder = _props$randomOrder === void 0 ? false : _props$randomOrder,
|
|
51
|
+
title = props.title,
|
|
52
|
+
rightColumns = props.rightColumns,
|
|
53
|
+
confirmClosable = props.confirmClosable,
|
|
54
|
+
confirmButton = props.confirmButton,
|
|
55
|
+
deleteButton = props.deleteButton,
|
|
56
|
+
keyboardButton = props.keyboardButton,
|
|
57
|
+
close = props.close,
|
|
58
|
+
onConfirm = props.onConfirm,
|
|
59
|
+
onDelete = props.onDelete,
|
|
60
|
+
onChange = props.onChange,
|
|
61
|
+
resetProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
65
62
|
var popupRef = useRef(null);
|
|
66
63
|
var keyboardRef = useRef(null);
|
|
67
|
-
|
|
68
64
|
var _useContext = useContext(GlobalContext),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
prefixCls = _useContext.prefixCls,
|
|
66
|
+
_useContext$locale = _useContext.locale,
|
|
67
|
+
locale = _useContext$locale === void 0 ? defaultLocale : _useContext$locale;
|
|
68
|
+
var prefix = prefixCls + "-keyboard";
|
|
69
|
+
// 3x4键盘的按键内容
|
|
74
70
|
// @en 3x4 Keyboard button content
|
|
75
|
-
|
|
76
71
|
var displayData = useMemo(function () {
|
|
77
72
|
var numberArr = randomOrder ? makeArrayRandom(contentArray) : contentArray;
|
|
78
73
|
var lastNum = numberArr.slice(-1)[0];
|
|
79
74
|
var finalData = splitArray(numberArr.slice(0, -1));
|
|
80
|
-
|
|
81
75
|
switch (type) {
|
|
82
76
|
case 'confirm':
|
|
83
77
|
finalData.push([lastNum, '.']);
|
|
84
78
|
break;
|
|
85
|
-
|
|
86
79
|
case 'tool':
|
|
87
80
|
finalData.push(['.', lastNum, {
|
|
88
81
|
type: 'delete'
|
|
89
82
|
}]);
|
|
90
83
|
break;
|
|
91
|
-
|
|
92
84
|
case 'number':
|
|
93
85
|
default:
|
|
94
86
|
finalData.push([{
|
|
@@ -98,37 +90,34 @@ var Keyboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
98
90
|
}]);
|
|
99
91
|
break;
|
|
100
92
|
}
|
|
101
|
-
|
|
102
93
|
return finalData;
|
|
103
|
-
}, [type]);
|
|
104
|
-
// @en Right column
|
|
94
|
+
}, [type]);
|
|
105
95
|
|
|
96
|
+
// 右边一列
|
|
97
|
+
// @en Right column
|
|
106
98
|
var rightColumn = useMemo(function () {
|
|
107
99
|
switch (type) {
|
|
108
100
|
case 'number':
|
|
109
101
|
return [];
|
|
110
|
-
|
|
111
102
|
case 'confirm':
|
|
112
103
|
{
|
|
113
104
|
return [{
|
|
114
105
|
type: 'delete'
|
|
115
106
|
}];
|
|
116
107
|
}
|
|
117
|
-
|
|
118
108
|
case 'tool':
|
|
119
109
|
return ['+', '-', '×', '÷'];
|
|
120
|
-
|
|
121
110
|
default:
|
|
122
111
|
return [];
|
|
123
112
|
}
|
|
124
|
-
}, [type]);
|
|
125
|
-
// @en Display then confirm button when type is confirm
|
|
113
|
+
}, [type]);
|
|
126
114
|
|
|
115
|
+
// 确认按钮需要在type为confirm时展示
|
|
116
|
+
// @en Display then confirm button when type is confirm
|
|
127
117
|
var getConfirmButton = useCallback(function () {
|
|
128
118
|
if (type !== 'confirm') {
|
|
129
119
|
return null;
|
|
130
120
|
}
|
|
131
|
-
|
|
132
121
|
return /*#__PURE__*/React.createElement("div", {
|
|
133
122
|
onClick: function onClick() {
|
|
134
123
|
confirmClosable && close();
|
|
@@ -136,20 +125,19 @@ var Keyboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
136
125
|
},
|
|
137
126
|
className: cls(prefix + "-key", prefix + "-key-confirm")
|
|
138
127
|
}, confirmButton || locale.Keyboard.confirm);
|
|
139
|
-
}, [type]);
|
|
140
|
-
// @en Close keyboard when clicked the blank space
|
|
128
|
+
}, [type]);
|
|
141
129
|
|
|
130
|
+
// 点击空白处关闭键盘
|
|
131
|
+
// @en Close keyboard when clicked the blank space
|
|
142
132
|
useEffect(function () {
|
|
143
133
|
var handlerDocumentClick = function handlerDocumentClick(e) {
|
|
144
134
|
if (!keyboardRef.current) {
|
|
145
135
|
return;
|
|
146
136
|
}
|
|
147
|
-
|
|
148
137
|
if (!keyboardRef.current.contains(e.target) && e.target !== keyboardRef.current) {
|
|
149
138
|
close();
|
|
150
139
|
}
|
|
151
140
|
};
|
|
152
|
-
|
|
153
141
|
document.addEventListener('click', handlerDocumentClick);
|
|
154
142
|
return function () {
|
|
155
143
|
document.removeEventListener('click', handlerDocumentClick);
|
|
@@ -160,35 +148,28 @@ var Keyboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
160
148
|
keyboard: keyboardRef.current
|
|
161
149
|
}, popupRef.current);
|
|
162
150
|
});
|
|
163
|
-
|
|
164
151
|
var handleButtonClick = function handleButtonClick(ele) {
|
|
165
152
|
switch (ele.type) {
|
|
166
153
|
case 'delete':
|
|
167
154
|
onDelete == null ? void 0 : onDelete();
|
|
168
155
|
break;
|
|
169
|
-
|
|
170
156
|
case 'keyboard':
|
|
171
157
|
close();
|
|
172
158
|
break;
|
|
173
|
-
|
|
174
159
|
default:
|
|
175
160
|
onChange == null ? void 0 : onChange(ele.value);
|
|
176
161
|
}
|
|
177
162
|
};
|
|
178
|
-
|
|
179
163
|
var renderButtonContent = function renderButtonContent(ele) {
|
|
180
164
|
switch (ele.type) {
|
|
181
165
|
case 'delete':
|
|
182
166
|
return deleteButton || /*#__PURE__*/React.createElement(IconKeyboardDelete, null);
|
|
183
|
-
|
|
184
167
|
case 'keyboard':
|
|
185
168
|
return keyboardButton || /*#__PURE__*/React.createElement(IconKeyboard, null);
|
|
186
|
-
|
|
187
169
|
default:
|
|
188
170
|
return ele.content;
|
|
189
171
|
}
|
|
190
172
|
};
|
|
191
|
-
|
|
192
173
|
var renderButton = function renderButton(data, key, extraClass) {
|
|
193
174
|
var ele = typeof data === 'string' || typeof data === 'number' ? {
|
|
194
175
|
type: 'content',
|
|
@@ -204,19 +185,16 @@ var Keyboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
204
185
|
style: normalKeyStyle
|
|
205
186
|
}, renderButtonContent(ele));
|
|
206
187
|
};
|
|
207
|
-
|
|
208
188
|
var renderKeyboardRightColumns = function renderKeyboardRightColumns() {
|
|
209
189
|
if (rightColumns) {
|
|
210
190
|
return rightColumns;
|
|
211
191
|
}
|
|
212
|
-
|
|
213
192
|
return rightColumn.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
214
193
|
className: prefix + "-col"
|
|
215
194
|
}, rightColumn.map(function (item, index) {
|
|
216
195
|
return renderButton(item, String(index));
|
|
217
196
|
}), getConfirmButton()) : null;
|
|
218
197
|
};
|
|
219
|
-
|
|
220
198
|
return /*#__PURE__*/React.createElement(Popup, _extends({
|
|
221
199
|
ref: popupRef,
|
|
222
200
|
maskClass: prefix + "-popup",
|
|
@@ -235,7 +213,6 @@ var Keyboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
235
213
|
key: index
|
|
236
214
|
}, item.map(function (e, idx) {
|
|
237
215
|
var _renderButton;
|
|
238
|
-
|
|
239
216
|
return renderButton(e, String(idx), (_renderButton = {}, _renderButton[prefix + "-key-special"] = type === 'confirm' && index === displayData.length - 1 && idx === 0, _renderButton));
|
|
240
217
|
}));
|
|
241
218
|
})), renderKeyboardRightColumns())));
|