@arco-design/mobile-react 2.25.3 → 2.26.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 +33 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/hooks.js +124 -43
- package/cjs/_helpers/index.js +13 -2
- package/cjs/_helpers/react-dom.js +12 -0
- package/cjs/_helpers/render.js +12 -0
- package/cjs/action-sheet/index.d.ts +2 -2
- package/cjs/action-sheet/index.js +30 -10
- package/cjs/action-sheet/methods.js +2 -0
- package/cjs/action-sheet/style/css/index.js +2 -0
- package/cjs/action-sheet/style/index.js +2 -0
- package/cjs/avatar/group.js +24 -12
- package/cjs/avatar/index.js +77 -51
- package/cjs/avatar/style/css/index.js +2 -0
- package/cjs/avatar/style/index.js +2 -0
- package/cjs/badge/index.js +29 -18
- package/cjs/badge/style/css/index.js +1 -0
- package/cjs/badge/style/index.js +1 -0
- package/cjs/button/hooks.js +20 -15
- package/cjs/button/index.js +67 -46
- package/cjs/button/style/css/index.js +2 -0
- package/cjs/button/style/index.js +2 -0
- package/cjs/carousel/index.d.ts +6 -0
- package/cjs/carousel/index.js +342 -184
- package/cjs/carousel/style/css/index.css +50 -15
- package/cjs/carousel/style/css/index.js +1 -0
- package/cjs/carousel/style/index.js +1 -0
- package/cjs/carousel/style/index.less +19 -14
- package/cjs/cell/arrow.js +3 -0
- package/cjs/cell/cell.js +23 -14
- package/cjs/cell/demo/style/css/mobile.css +8 -0
- package/cjs/cell/demo/style/mobile.less +2 -2
- package/cjs/cell/group.js +21 -9
- package/cjs/cell/index.js +7 -1
- package/cjs/cell/style/css/index.css +16 -0
- package/cjs/cell/style/css/index.js +1 -0
- package/cjs/cell/style/index.js +1 -0
- package/cjs/cell/style/index.less +6 -4
- package/cjs/checkbox/checkbox.js +57 -31
- package/cjs/checkbox/group.js +38 -24
- package/cjs/checkbox/hooks/index.js +2 -0
- package/cjs/checkbox/hooks/useMergeProps.js +14 -7
- package/cjs/checkbox/index.js +8 -1
- package/cjs/checkbox/style/css/index.js +1 -0
- package/cjs/checkbox/style/index.js +1 -0
- package/cjs/checkbox/type.js +2 -0
- package/cjs/circle-progress/index.js +57 -37
- package/cjs/circle-progress/style/css/index.js +1 -0
- package/cjs/circle-progress/style/index.js +1 -0
- package/cjs/collapse/collapse.js +56 -27
- package/cjs/collapse/group.js +44 -20
- package/cjs/collapse/index.js +9 -0
- package/cjs/collapse/style/css/index.js +1 -0
- package/cjs/collapse/style/index.js +1 -0
- package/cjs/collapse/utils.js +7 -0
- package/cjs/context-provider/index.d.ts +6 -0
- package/cjs/context-provider/index.js +30 -11
- package/cjs/context-provider/style/css/index.js +1 -0
- package/cjs/context-provider/style/index.js +1 -0
- package/cjs/count-down/hooks.js +43 -24
- package/cjs/count-down/index.js +37 -29
- package/cjs/count-down/singleton.js +12 -2
- package/cjs/count-down/style/css/index.js +1 -0
- package/cjs/count-down/style/index.js +1 -0
- package/cjs/count-down/util.js +47 -33
- package/cjs/date-picker/helper.js +14 -7
- package/cjs/date-picker/index.js +106 -42
- package/cjs/date-picker/style/css/index.js +2 -0
- package/cjs/date-picker/style/index.js +2 -0
- package/cjs/dialog/index.d.ts +2 -2
- package/cjs/dialog/index.js +54 -28
- package/cjs/dialog/methods.js +22 -9
- package/cjs/dialog/style/css/index.js +2 -0
- package/cjs/dialog/style/index.js +2 -0
- package/cjs/divider/demo/style/css/mobile.css +7 -0
- package/cjs/divider/demo/style/mobile.less +12 -0
- package/cjs/divider/index.d.ts +49 -0
- package/cjs/divider/index.js +65 -0
- package/cjs/divider/style/css/index.css +69 -0
- package/cjs/divider/style/css/index.d.ts +2 -0
- package/cjs/divider/style/css/index.js +5 -0
- package/cjs/divider/style/index.d.ts +2 -0
- package/cjs/divider/style/index.js +5 -0
- package/cjs/divider/style/index.less +66 -0
- package/cjs/dropdown/dropdown.js +113 -74
- package/cjs/dropdown/index.js +8 -1
- package/cjs/dropdown/options.js +28 -12
- package/cjs/dropdown/style/css/index.js +1 -0
- package/cjs/dropdown/style/index.js +1 -0
- package/cjs/dropdown-menu/dropdown-menu.js +84 -49
- package/cjs/dropdown-menu/helper.js +27 -6
- package/cjs/dropdown-menu/index.js +6 -0
- package/cjs/dropdown-menu/style/css/index.js +2 -0
- package/cjs/dropdown-menu/style/index.js +2 -0
- package/cjs/ellipsis/components/js-ellipsis.js +72 -33
- package/cjs/ellipsis/components/native-ellipsis.js +15 -9
- package/cjs/ellipsis/index.js +32 -19
- package/cjs/ellipsis/style/css/index.js +1 -0
- package/cjs/ellipsis/style/index.js +1 -0
- package/cjs/ellipsis/type.d.ts +3 -3
- package/cjs/ellipsis/utils/dom.js +8 -0
- package/cjs/ellipsis/utils/is.js +5 -1
- package/cjs/form/form-item-context.js +5 -0
- package/cjs/form/form-item.js +124 -42
- package/cjs/form/index.js +35 -17
- package/cjs/form/style/css/index.js +1 -0
- package/cjs/form/style/index.js +1 -0
- package/cjs/form/type.js +3 -0
- package/cjs/form/useForm.js +76 -18
- package/cjs/form/utils.js +10 -3
- package/cjs/grid/index.js +41 -21
- package/cjs/grid/style/css/index.js +1 -0
- package/cjs/grid/style/index.js +1 -0
- package/cjs/icon/IconAdd/index.js +12 -5
- package/cjs/icon/IconArrowBack/index.js +12 -5
- package/cjs/icon/IconArrowDown/index.js +12 -5
- package/cjs/icon/IconArrowIn/index.js +12 -5
- package/cjs/icon/IconArrowUp/index.js +12 -5
- package/cjs/icon/IconCheck/index.js +12 -5
- package/cjs/icon/IconCheckBold/index.js +12 -5
- package/cjs/icon/IconCircleChecked/index.js +12 -5
- package/cjs/icon/IconCircleDisabled/index.js +12 -5
- package/cjs/icon/IconCircleUnchecked/index.js +12 -5
- package/cjs/icon/IconClear/index.js +12 -5
- package/cjs/icon/IconClose/index.js +12 -5
- package/cjs/icon/IconCloseBold/index.js +12 -5
- package/cjs/icon/IconDelete/index.js +12 -5
- package/cjs/icon/IconEdit/index.js +12 -5
- package/cjs/icon/IconErrorCircle/index.js +12 -5
- package/cjs/icon/IconEyeInvisible/index.js +12 -5
- package/cjs/icon/IconEyeVisible/index.js +12 -5
- package/cjs/icon/IconEyelashInvisible/index.js +12 -5
- package/cjs/icon/IconGift/index.js +12 -5
- package/cjs/icon/IconHeart/index.js +12 -5
- package/cjs/icon/IconHome/index.js +12 -5
- package/cjs/icon/IconLikeCircle/index.js +12 -5
- package/cjs/icon/IconMinus/index.js +12 -5
- package/cjs/icon/IconMore/index.js +12 -5
- package/cjs/icon/IconNotice/index.js +12 -5
- package/cjs/icon/IconNoticeOff/index.js +12 -5
- package/cjs/icon/IconPicture/index.js +12 -5
- package/cjs/icon/IconPlay/index.js +12 -5
- package/cjs/icon/IconQuestionCircle/index.js +12 -5
- package/cjs/icon/IconRefresh/index.js +12 -5
- package/cjs/icon/IconSad/index.js +12 -5
- package/cjs/icon/IconScan/index.js +12 -5
- package/cjs/icon/IconSearch/index.js +12 -5
- package/cjs/icon/IconSetting/index.js +12 -5
- package/cjs/icon/IconShop/index.js +12 -5
- package/cjs/icon/IconShopping/index.js +12 -5
- package/cjs/icon/IconSmileFill/index.js +12 -5
- package/cjs/icon/IconSound/index.js +12 -5
- package/cjs/icon/IconSquareChecked/index.js +12 -5
- package/cjs/icon/IconSquareDisabled/index.js +12 -5
- package/cjs/icon/IconSquareUnchecked/index.js +12 -5
- package/cjs/icon/IconStar/index.js +12 -5
- package/cjs/icon/IconStarFill/index.js +12 -5
- package/cjs/icon/IconStarHalf/index.js +12 -5
- package/cjs/icon/IconSubway/index.js +12 -5
- package/cjs/icon/IconSuccessCircle/index.js +12 -5
- package/cjs/icon/IconTriDown/index.js +12 -5
- package/cjs/icon/IconTriUp/index.js +12 -5
- package/cjs/icon/IconUpload/index.js +12 -5
- package/cjs/icon/IconUser/index.js +12 -5
- package/cjs/icon/IconUserFill/index.js +12 -5
- package/cjs/icon/IconWarnCircle/index.js +12 -5
- package/cjs/icon/IconWarnCircleFill/index.js +12 -5
- package/cjs/icon/index.js +111 -0
- package/cjs/image/index.js +92 -56
- package/cjs/image/style/css/index.css +1 -0
- package/cjs/image/style/css/index.js +2 -0
- package/cjs/image/style/index.js +2 -0
- package/cjs/image/style/index.less +1 -0
- package/cjs/image-picker/add-icon.js +3 -0
- package/cjs/image-picker/index.js +96 -52
- package/cjs/image-picker/style/css/index.js +2 -0
- package/cjs/image-picker/style/index.js +2 -0
- package/cjs/image-preview/index.d.ts +2 -2
- package/cjs/image-preview/index.js +239 -119
- package/cjs/image-preview/methods.js +18 -5
- package/cjs/image-preview/style/css/index.js +4 -0
- package/cjs/image-preview/style/index.js +4 -0
- package/cjs/index.d.ts +10 -9
- package/cjs/index.js +132 -19
- package/cjs/input/demo/style/css/mobile.css +5 -1
- package/cjs/input/demo/style/mobile.less +2 -2
- package/cjs/input/hooks.js +104 -42
- package/cjs/input/index.js +40 -26
- package/cjs/input/props.d.ts +6 -0
- package/cjs/input/style/css/index.css +9 -0
- package/cjs/input/style/css/index.js +1 -0
- package/cjs/input/style/index.js +1 -0
- package/cjs/input/style/index.less +2 -2
- package/cjs/load-more/index.js +56 -29
- package/cjs/load-more/style/css/index.js +1 -0
- package/cjs/load-more/style/index.js +1 -0
- package/cjs/loading/index.js +48 -19
- package/cjs/loading/style/css/index.js +1 -0
- package/cjs/loading/style/index.js +1 -0
- package/cjs/masking/index.d.ts +2 -2
- package/cjs/masking/index.js +79 -46
- package/cjs/masking/methods.js +19 -4
- package/cjs/masking/style/css/index.js +2 -0
- package/cjs/masking/style/index.js +2 -0
- package/cjs/nav-bar/back-icon.js +5 -1
- package/cjs/nav-bar/index.js +61 -37
- package/cjs/nav-bar/style/css/index.js +1 -0
- package/cjs/nav-bar/style/index.js +1 -0
- package/cjs/notice-bar/index.js +61 -33
- package/cjs/notice-bar/style/css/index.css +33 -0
- package/cjs/notice-bar/style/css/index.js +1 -0
- package/cjs/notice-bar/style/index.js +1 -0
- package/cjs/notice-bar/style/index.less +16 -3
- package/cjs/notify/index.d.ts +8 -8
- package/cjs/notify/index.js +49 -20
- package/cjs/notify/methods.js +17 -2
- package/cjs/notify/style/css/index.js +1 -0
- package/cjs/notify/style/index.js +1 -0
- package/cjs/pagination/arrow.js +3 -0
- package/cjs/pagination/index.js +58 -27
- package/cjs/pagination/style/css/index.js +1 -0
- package/cjs/pagination/style/index.js +1 -0
- package/cjs/picker/index.js +81 -40
- package/cjs/picker/style/css/index.js +3 -0
- package/cjs/picker/style/index.js +3 -0
- package/cjs/picker-view/components/cascader.js +31 -14
- package/cjs/picker-view/components/multi-picker.js +20 -6
- package/cjs/picker-view/components/picker-cell.js +97 -45
- package/cjs/picker-view/index.js +71 -25
- package/cjs/picker-view/style/css/index.js +1 -0
- package/cjs/picker-view/style/index.js +1 -0
- package/cjs/popover/hooks/index.js +4 -0
- package/cjs/popover/hooks/useEvent.js +49 -25
- package/cjs/popover/hooks/usePosition.js +151 -94
- package/cjs/popover/index.js +8 -1
- package/cjs/popover/menu.js +51 -32
- package/cjs/popover/popover-inner.js +47 -30
- package/cjs/popover/popover.js +101 -69
- package/cjs/popover/style/css/index.js +2 -0
- package/cjs/popover/style/index.js +2 -0
- package/cjs/popup/index.d.ts +2 -2
- package/cjs/popup/index.js +39 -22
- package/cjs/popup/methods.js +2 -0
- package/cjs/popup/style/css/index.js +2 -0
- package/cjs/popup/style/index.js +2 -0
- package/cjs/popup-swiper/index.d.ts +2 -2
- package/cjs/popup-swiper/index.js +80 -38
- package/cjs/popup-swiper/methods.js +2 -0
- package/cjs/popup-swiper/style/css/index.js +2 -0
- package/cjs/popup-swiper/style/index.js +2 -0
- package/cjs/portal/index.js +8 -3
- package/cjs/portal/style/css/index.js +1 -0
- package/cjs/portal/style/index.js +1 -0
- package/cjs/progress/index.js +44 -27
- package/cjs/progress/style/css/index.js +1 -0
- package/cjs/progress/style/index.js +1 -0
- package/cjs/pull-refresh/android-pull-refresh.js +100 -58
- package/cjs/pull-refresh/hooks.js +32 -11
- package/cjs/pull-refresh/index.js +14 -3
- package/cjs/pull-refresh/ios-pull-refresh.js +80 -53
- package/cjs/pull-refresh/model.js +1 -0
- package/cjs/pull-refresh/style/css/index.js +2 -0
- package/cjs/pull-refresh/style/index.js +2 -0
- package/cjs/radio/group.js +34 -20
- package/cjs/radio/index.js +8 -1
- package/cjs/radio/radio.js +10 -0
- package/cjs/radio/style/css/index.js +1 -0
- package/cjs/radio/style/index.js +1 -0
- package/cjs/rate/index.js +50 -24
- package/cjs/rate/style/css/index.js +1 -0
- package/cjs/rate/style/index.js +1 -0
- package/cjs/search-bar/association.js +32 -14
- package/cjs/search-bar/cancel-button.js +16 -8
- package/cjs/search-bar/highlight.js +25 -14
- package/cjs/search-bar/index.js +97 -77
- package/cjs/search-bar/style/css/index.css +1 -0
- package/cjs/search-bar/style/css/index.js +1 -0
- package/cjs/search-bar/style/index.js +1 -0
- package/cjs/search-bar/style/index.less +1 -0
- package/cjs/show-monitor/index.js +93 -34
- package/cjs/show-monitor/style/css/index.js +1 -0
- package/cjs/show-monitor/style/index.js +1 -0
- package/cjs/slider/hooks/index.js +13 -0
- package/cjs/slider/hooks/useSliderEvents.js +55 -26
- package/cjs/slider/hooks/useSliderIcon.js +20 -6
- package/cjs/slider/hooks/useSliderInit.js +52 -32
- package/cjs/slider/hooks/useSliderStyle.js +24 -12
- package/cjs/slider/index.js +72 -46
- package/cjs/slider/marks.js +26 -12
- package/cjs/slider/popover.js +13 -4
- package/cjs/slider/style/css/index.js +2 -0
- package/cjs/slider/style/index.js +2 -0
- package/cjs/slider/thumb.js +23 -8
- package/cjs/stepper/hooks/useButtonClick.js +28 -19
- package/cjs/stepper/hooks/useInputEvent.js +18 -9
- package/cjs/stepper/hooks/useValue.js +14 -9
- package/cjs/stepper/index.js +96 -82
- package/cjs/stepper/style/css/index.js +1 -0
- package/cjs/stepper/style/index.js +1 -0
- package/cjs/steps/index.js +40 -22
- package/cjs/steps/step.js +27 -10
- package/cjs/steps/style/css/index.js +1 -0
- package/cjs/steps/style/index.js +1 -0
- package/cjs/sticky/index.js +65 -36
- package/cjs/sticky/style/css/index.js +1 -0
- package/cjs/sticky/style/index.js +1 -0
- package/cjs/style.d.ts +9 -8
- package/cjs/style.js +64 -8
- package/cjs/swipe-action/index.js +92 -40
- package/cjs/swipe-action/item.js +17 -9
- package/cjs/swipe-action/style/css/index.js +1 -0
- package/cjs/swipe-action/style/index.js +1 -0
- package/cjs/swipe-load/index.js +83 -55
- package/cjs/swipe-load/style/css/index.js +1 -0
- package/cjs/swipe-load/style/index.js +1 -0
- package/cjs/switch/index.js +47 -27
- package/cjs/switch/style/css/index.js +1 -0
- package/cjs/switch/style/index.js +1 -0
- package/cjs/tab-bar/index.js +7 -0
- package/cjs/tab-bar/item.js +24 -6
- package/cjs/tab-bar/style/css/index.js +1 -0
- package/cjs/tab-bar/style/index.js +1 -0
- package/cjs/tab-bar/tab-bar.js +31 -15
- package/cjs/tabs/index.js +195 -129
- package/cjs/tabs/style/css/index.js +1 -0
- package/cjs/tabs/style/index.js +1 -0
- package/cjs/tabs/tab-cell-underline.js +111 -38
- package/cjs/tabs/tab-cell.js +124 -70
- package/cjs/tabs/tab-pane.js +94 -49
- package/cjs/tabs/type.d.ts +18 -2
- package/cjs/tag/index.js +8 -1
- package/cjs/tag/list.js +26 -11
- package/cjs/tag/style/css/index.js +1 -0
- package/cjs/tag/style/index.js +1 -0
- package/cjs/tag/tag.js +32 -20
- package/cjs/textarea/index.js +56 -35
- package/cjs/textarea/style/css/index.js +2 -0
- package/cjs/textarea/style/index.js +2 -0
- package/cjs/toast/index.d.ts +12 -12
- package/cjs/toast/index.js +61 -26
- package/cjs/toast/methods.js +16 -2
- package/cjs/toast/style/css/index.js +3 -0
- package/cjs/toast/style/index.js +3 -0
- package/cjs/transition/index.js +18 -10
- package/cjs/transition/style/css/index.js +1 -0
- package/cjs/transition/style/index.js +1 -0
- package/dist/index.js +21588 -19198
- package/dist/index.min.js +4 -4
- package/dist/style.css +3766 -3629
- package/dist/style.min.css +1 -1
- package/esm/_helpers/hooks.js +103 -42
- package/esm/_helpers/index.js +3 -2
- package/esm/_helpers/react-dom.js +10 -0
- package/esm/_helpers/render.js +7 -0
- package/esm/action-sheet/index.d.ts +2 -2
- package/esm/action-sheet/index.js +16 -10
- package/esm/avatar/group.js +16 -12
- package/esm/avatar/index.js +62 -51
- package/esm/badge/index.js +22 -18
- package/esm/button/hooks.js +18 -15
- package/esm/button/index.js +57 -46
- package/esm/carousel/index.d.ts +6 -0
- package/esm/carousel/index.js +336 -186
- package/esm/carousel/style/css/index.css +50 -15
- package/esm/carousel/style/index.less +19 -14
- package/esm/cell/cell.js +14 -14
- package/esm/cell/demo/style/css/mobile.css +8 -0
- package/esm/cell/demo/style/mobile.less +2 -2
- package/esm/cell/group.js +11 -9
- package/esm/cell/index.js +1 -1
- package/esm/cell/style/css/index.css +16 -0
- package/esm/cell/style/index.less +6 -4
- package/esm/checkbox/checkbox.js +42 -31
- package/esm/checkbox/group.js +28 -24
- package/esm/checkbox/hooks/useMergeProps.js +9 -7
- package/esm/checkbox/index.js +2 -2
- package/esm/checkbox/type.js +1 -0
- package/esm/circle-progress/index.js +49 -37
- package/esm/collapse/collapse.js +46 -27
- package/esm/collapse/group.js +34 -20
- package/esm/collapse/index.js +1 -1
- package/esm/collapse/utils.js +1 -0
- package/esm/context-provider/index.d.ts +6 -0
- package/esm/context-provider/index.js +20 -11
- package/esm/count-down/hooks.js +37 -24
- package/esm/count-down/index.js +29 -30
- package/esm/count-down/singleton.js +5 -2
- package/esm/count-down/util.js +42 -33
- package/esm/date-picker/helper.js +9 -7
- package/esm/date-picker/index.js +93 -42
- package/esm/dialog/index.d.ts +2 -2
- package/esm/dialog/index.js +39 -28
- package/esm/dialog/methods.js +11 -9
- package/esm/divider/demo/style/css/mobile.css +7 -0
- package/esm/divider/demo/style/mobile.less +12 -0
- package/esm/divider/index.d.ts +49 -0
- package/esm/divider/index.js +49 -0
- package/esm/divider/style/css/index.css +69 -0
- package/esm/divider/style/css/index.d.ts +2 -0
- package/esm/divider/style/css/index.js +2 -0
- package/esm/divider/style/index.d.ts +2 -0
- package/esm/divider/style/index.js +2 -0
- package/esm/divider/style/index.less +66 -0
- package/esm/dropdown/dropdown.js +102 -74
- package/esm/dropdown/index.js +1 -1
- package/esm/dropdown/options.js +20 -12
- package/esm/dropdown-menu/dropdown-menu.js +74 -49
- package/esm/dropdown-menu/helper.js +16 -6
- package/esm/dropdown-menu/index.js +1 -1
- package/esm/ellipsis/components/js-ellipsis.js +63 -33
- package/esm/ellipsis/components/native-ellipsis.js +11 -9
- package/esm/ellipsis/index.js +21 -20
- package/esm/ellipsis/type.d.ts +3 -3
- package/esm/ellipsis/utils/dom.js +7 -0
- package/esm/ellipsis/utils/is.js +1 -1
- package/esm/form/form-item.js +110 -42
- package/esm/form/index.js +20 -17
- package/esm/form/type.js +3 -0
- package/esm/form/useForm.js +71 -17
- package/esm/form/utils.js +6 -3
- package/esm/grid/index.js +34 -21
- package/esm/icon/IconAdd/index.js +6 -5
- package/esm/icon/IconArrowBack/index.js +6 -5
- package/esm/icon/IconArrowDown/index.js +6 -5
- package/esm/icon/IconArrowIn/index.js +6 -5
- package/esm/icon/IconArrowUp/index.js +6 -5
- package/esm/icon/IconCheck/index.js +6 -5
- package/esm/icon/IconCheckBold/index.js +6 -5
- package/esm/icon/IconCircleChecked/index.js +6 -5
- package/esm/icon/IconCircleDisabled/index.js +6 -5
- package/esm/icon/IconCircleUnchecked/index.js +6 -5
- package/esm/icon/IconClear/index.js +6 -5
- package/esm/icon/IconClose/index.js +6 -5
- package/esm/icon/IconCloseBold/index.js +6 -5
- package/esm/icon/IconDelete/index.js +6 -5
- package/esm/icon/IconEdit/index.js +6 -5
- package/esm/icon/IconErrorCircle/index.js +6 -5
- package/esm/icon/IconEyeInvisible/index.js +6 -5
- package/esm/icon/IconEyeVisible/index.js +6 -5
- package/esm/icon/IconEyelashInvisible/index.js +6 -5
- package/esm/icon/IconGift/index.js +6 -5
- package/esm/icon/IconHeart/index.js +6 -5
- package/esm/icon/IconHome/index.js +6 -5
- package/esm/icon/IconLikeCircle/index.js +6 -5
- package/esm/icon/IconMinus/index.js +6 -5
- package/esm/icon/IconMore/index.js +6 -5
- package/esm/icon/IconNotice/index.js +6 -5
- package/esm/icon/IconNoticeOff/index.js +6 -5
- package/esm/icon/IconPicture/index.js +6 -5
- package/esm/icon/IconPlay/index.js +6 -5
- package/esm/icon/IconQuestionCircle/index.js +6 -5
- package/esm/icon/IconRefresh/index.js +6 -5
- package/esm/icon/IconSad/index.js +6 -5
- package/esm/icon/IconScan/index.js +6 -5
- package/esm/icon/IconSearch/index.js +6 -5
- package/esm/icon/IconSetting/index.js +6 -5
- package/esm/icon/IconShop/index.js +6 -5
- package/esm/icon/IconShopping/index.js +6 -5
- package/esm/icon/IconSmileFill/index.js +6 -5
- package/esm/icon/IconSound/index.js +6 -5
- package/esm/icon/IconSquareChecked/index.js +6 -5
- package/esm/icon/IconSquareDisabled/index.js +6 -5
- package/esm/icon/IconSquareUnchecked/index.js +6 -5
- package/esm/icon/IconStar/index.js +6 -5
- package/esm/icon/IconStarFill/index.js +6 -5
- package/esm/icon/IconStarHalf/index.js +6 -5
- package/esm/icon/IconSubway/index.js +6 -5
- package/esm/icon/IconSuccessCircle/index.js +6 -5
- package/esm/icon/IconTriDown/index.js +6 -5
- package/esm/icon/IconTriUp/index.js +6 -5
- package/esm/icon/IconUpload/index.js +6 -5
- package/esm/icon/IconUser/index.js +6 -5
- package/esm/icon/IconUserFill/index.js +6 -5
- package/esm/icon/IconWarnCircle/index.js +6 -5
- package/esm/icon/IconWarnCircleFill/index.js +6 -5
- package/esm/image/index.js +84 -57
- package/esm/image/style/css/index.css +1 -0
- package/esm/image/style/index.less +1 -0
- package/esm/image-picker/index.js +80 -52
- package/esm/image-preview/index.d.ts +2 -2
- package/esm/image-preview/index.js +217 -119
- package/esm/image-preview/methods.js +14 -4
- package/esm/index.d.ts +10 -9
- package/esm/index.js +10 -9
- package/esm/input/demo/style/css/mobile.css +5 -1
- package/esm/input/demo/style/mobile.less +2 -2
- package/esm/input/hooks.js +96 -42
- package/esm/input/index.js +30 -26
- package/esm/input/props.d.ts +6 -0
- package/esm/input/style/css/index.css +9 -0
- package/esm/input/style/index.less +2 -2
- package/esm/load-more/index.js +48 -29
- package/esm/loading/index.js +40 -19
- package/esm/masking/index.d.ts +2 -2
- package/esm/masking/index.js +64 -46
- package/esm/masking/methods.js +15 -4
- package/esm/nav-bar/back-icon.js +3 -1
- package/esm/nav-bar/index.js +52 -37
- package/esm/notice-bar/index.js +56 -35
- package/esm/notice-bar/style/css/index.css +33 -0
- package/esm/notice-bar/style/index.less +16 -3
- package/esm/notify/index.d.ts +8 -8
- package/esm/notify/index.js +33 -20
- package/esm/notify/methods.js +13 -2
- package/esm/pagination/index.js +50 -27
- package/esm/picker/index.js +66 -40
- package/esm/picker-view/components/cascader.js +23 -14
- package/esm/picker-view/components/multi-picker.js +16 -6
- package/esm/picker-view/components/picker-cell.js +89 -45
- package/esm/picker-view/index.js +54 -25
- package/esm/popover/hooks/useEvent.js +41 -26
- package/esm/popover/hooks/usePosition.js +144 -94
- package/esm/popover/index.js +2 -2
- package/esm/popover/menu.js +41 -32
- package/esm/popover/popover-inner.js +38 -30
- package/esm/popover/popover.js +90 -69
- package/esm/popup/index.d.ts +2 -2
- package/esm/popup/index.js +25 -22
- package/esm/popup-swiper/index.d.ts +2 -2
- package/esm/popup-swiper/index.js +64 -38
- package/esm/portal/index.js +5 -3
- package/esm/progress/index.js +36 -27
- package/esm/pull-refresh/android-pull-refresh.js +90 -58
- package/esm/pull-refresh/hooks.js +23 -11
- package/esm/pull-refresh/index.js +5 -3
- package/esm/pull-refresh/ios-pull-refresh.js +68 -53
- package/esm/pull-refresh/model.js +1 -0
- package/esm/radio/group.js +24 -20
- package/esm/radio/index.js +2 -2
- package/esm/rate/index.js +39 -24
- package/esm/search-bar/association.js +27 -14
- package/esm/search-bar/cancel-button.js +11 -8
- package/esm/search-bar/highlight.js +20 -14
- package/esm/search-bar/index.js +86 -77
- package/esm/search-bar/style/css/index.css +1 -0
- package/esm/search-bar/style/index.less +1 -0
- package/esm/show-monitor/index.js +85 -34
- package/esm/slider/hooks/useSliderEvents.js +51 -26
- package/esm/slider/hooks/useSliderIcon.js +13 -6
- package/esm/slider/hooks/useSliderInit.js +46 -32
- package/esm/slider/hooks/useSliderStyle.js +20 -12
- package/esm/slider/index.js +62 -46
- package/esm/slider/marks.js +18 -12
- package/esm/slider/popover.js +6 -4
- package/esm/slider/thumb.js +15 -8
- package/esm/stepper/hooks/useButtonClick.js +27 -19
- package/esm/stepper/hooks/useInputEvent.js +16 -9
- package/esm/stepper/hooks/useValue.js +12 -9
- package/esm/stepper/index.js +82 -82
- package/esm/steps/index.js +27 -22
- package/esm/steps/step.js +19 -10
- package/esm/sticky/index.js +56 -36
- package/esm/style.d.ts +9 -8
- package/esm/style.js +9 -8
- package/esm/swipe-action/index.js +80 -40
- package/esm/swipe-action/item.js +12 -9
- package/esm/swipe-load/index.js +75 -56
- package/esm/switch/index.js +39 -27
- package/esm/tab-bar/index.js +1 -0
- package/esm/tab-bar/item.js +13 -6
- package/esm/tab-bar/tab-bar.js +21 -15
- package/esm/tabs/index.js +183 -130
- package/esm/tabs/tab-cell-underline.js +103 -38
- package/esm/tabs/tab-cell.js +114 -70
- package/esm/tabs/tab-pane.js +85 -49
- package/esm/tabs/type.d.ts +18 -2
- package/esm/tag/index.js +2 -2
- package/esm/tag/list.js +16 -11
- package/esm/tag/tag.js +22 -20
- package/esm/textarea/index.js +46 -35
- package/esm/toast/index.d.ts +12 -12
- package/esm/toast/index.js +42 -26
- package/esm/toast/methods.js +12 -2
- package/esm/transition/index.js +12 -10
- package/package.json +3 -3
- package/tokens/app/arcodesign/default/css-variables.less +22 -0
- package/tokens/app/arcodesign/default/index.d.ts +22 -0
- package/tokens/app/arcodesign/default/index.js +25 -1
- package/tokens/app/arcodesign/default/index.json +262 -0
- package/tokens/app/arcodesign/default/index.less +22 -0
- package/tokens/mixin/index.less +19 -1
- package/umd/_helpers/hooks.js +121 -43
- package/umd/_helpers/index.js +6 -2
- package/umd/_helpers/react-dom.js +11 -0
- package/umd/_helpers/render.js +9 -0
- package/umd/action-sheet/index.d.ts +2 -2
- package/umd/action-sheet/index.js +22 -10
- package/umd/action-sheet/methods.js +1 -0
- package/umd/avatar/group.js +20 -12
- package/umd/avatar/index.js +68 -51
- package/umd/badge/index.js +25 -18
- package/umd/button/hooks.js +19 -15
- package/umd/button/index.js +60 -46
- package/umd/carousel/index.d.ts +6 -0
- package/umd/carousel/index.js +337 -184
- package/umd/carousel/style/css/index.css +50 -15
- package/umd/carousel/style/index.less +19 -14
- package/umd/cell/arrow.js +2 -0
- package/umd/cell/cell.js +18 -14
- package/umd/cell/demo/style/css/mobile.css +8 -0
- package/umd/cell/demo/style/mobile.less +2 -2
- package/umd/cell/group.js +17 -9
- package/umd/cell/index.js +2 -1
- package/umd/cell/style/css/index.css +16 -0
- package/umd/cell/style/index.less +6 -4
- package/umd/checkbox/checkbox.js +45 -31
- package/umd/checkbox/group.js +34 -24
- package/umd/checkbox/hooks/useMergeProps.js +12 -7
- package/umd/checkbox/index.js +3 -1
- package/umd/checkbox/type.js +2 -0
- package/umd/circle-progress/index.js +52 -37
- package/umd/collapse/collapse.js +50 -27
- package/umd/collapse/group.js +38 -20
- package/umd/collapse/index.js +3 -0
- package/umd/collapse/utils.js +5 -0
- package/umd/context-provider/index.d.ts +6 -0
- package/umd/context-provider/index.js +25 -11
- package/umd/count-down/hooks.js +39 -24
- package/umd/count-down/index.js +31 -29
- package/umd/count-down/singleton.js +10 -2
- package/umd/count-down/util.js +47 -33
- package/umd/date-picker/helper.js +13 -7
- package/umd/date-picker/index.js +97 -42
- package/umd/dialog/index.d.ts +2 -2
- package/umd/dialog/index.js +44 -28
- package/umd/dialog/methods.js +18 -9
- package/umd/divider/demo/style/css/mobile.css +7 -0
- package/umd/divider/demo/style/mobile.less +12 -0
- package/umd/divider/index.d.ts +49 -0
- package/umd/divider/index.js +71 -0
- package/umd/divider/style/css/index.css +69 -0
- package/umd/divider/style/css/index.d.ts +2 -0
- package/umd/divider/style/css/index.js +15 -0
- package/umd/divider/style/index.d.ts +2 -0
- package/umd/divider/style/index.js +15 -0
- package/umd/divider/style/index.less +66 -0
- package/umd/dropdown/dropdown.js +106 -74
- package/umd/dropdown/index.js +3 -1
- package/umd/dropdown/options.js +24 -12
- package/umd/dropdown-menu/dropdown-menu.js +78 -49
- package/umd/dropdown-menu/helper.js +25 -6
- package/umd/dropdown-menu/index.js +2 -0
- package/umd/ellipsis/components/js-ellipsis.js +69 -33
- package/umd/ellipsis/components/native-ellipsis.js +13 -9
- package/umd/ellipsis/index.js +24 -19
- package/umd/ellipsis/type.d.ts +3 -3
- package/umd/ellipsis/utils/dom.js +8 -0
- package/umd/ellipsis/utils/is.js +5 -1
- package/umd/form/form-item-context.js +3 -0
- package/umd/form/form-item.js +114 -42
- package/umd/form/index.js +25 -17
- package/umd/form/type.js +3 -0
- package/umd/form/useForm.js +72 -18
- package/umd/form/utils.js +10 -3
- package/umd/grid/index.js +37 -21
- package/umd/icon/IconAdd/index.js +7 -5
- package/umd/icon/IconArrowBack/index.js +7 -5
- package/umd/icon/IconArrowDown/index.js +7 -5
- package/umd/icon/IconArrowIn/index.js +7 -5
- package/umd/icon/IconArrowUp/index.js +7 -5
- package/umd/icon/IconCheck/index.js +7 -5
- package/umd/icon/IconCheckBold/index.js +7 -5
- package/umd/icon/IconCircleChecked/index.js +7 -5
- package/umd/icon/IconCircleDisabled/index.js +7 -5
- package/umd/icon/IconCircleUnchecked/index.js +7 -5
- package/umd/icon/IconClear/index.js +7 -5
- package/umd/icon/IconClose/index.js +7 -5
- package/umd/icon/IconCloseBold/index.js +7 -5
- package/umd/icon/IconDelete/index.js +7 -5
- package/umd/icon/IconEdit/index.js +7 -5
- package/umd/icon/IconErrorCircle/index.js +7 -5
- package/umd/icon/IconEyeInvisible/index.js +7 -5
- package/umd/icon/IconEyeVisible/index.js +7 -5
- package/umd/icon/IconEyelashInvisible/index.js +7 -5
- package/umd/icon/IconGift/index.js +7 -5
- package/umd/icon/IconHeart/index.js +7 -5
- package/umd/icon/IconHome/index.js +7 -5
- package/umd/icon/IconLikeCircle/index.js +7 -5
- package/umd/icon/IconMinus/index.js +7 -5
- package/umd/icon/IconMore/index.js +7 -5
- package/umd/icon/IconNotice/index.js +7 -5
- package/umd/icon/IconNoticeOff/index.js +7 -5
- package/umd/icon/IconPicture/index.js +7 -5
- package/umd/icon/IconPlay/index.js +7 -5
- package/umd/icon/IconQuestionCircle/index.js +7 -5
- package/umd/icon/IconRefresh/index.js +7 -5
- package/umd/icon/IconSad/index.js +7 -5
- package/umd/icon/IconScan/index.js +7 -5
- package/umd/icon/IconSearch/index.js +7 -5
- package/umd/icon/IconSetting/index.js +7 -5
- package/umd/icon/IconShop/index.js +7 -5
- package/umd/icon/IconShopping/index.js +7 -5
- package/umd/icon/IconSmileFill/index.js +7 -5
- package/umd/icon/IconSound/index.js +7 -5
- package/umd/icon/IconSquareChecked/index.js +7 -5
- package/umd/icon/IconSquareDisabled/index.js +7 -5
- package/umd/icon/IconSquareUnchecked/index.js +7 -5
- package/umd/icon/IconStar/index.js +7 -5
- package/umd/icon/IconStarFill/index.js +7 -5
- package/umd/icon/IconStarHalf/index.js +7 -5
- package/umd/icon/IconSubway/index.js +7 -5
- package/umd/icon/IconSuccessCircle/index.js +7 -5
- package/umd/icon/IconTriDown/index.js +7 -5
- package/umd/icon/IconTriUp/index.js +7 -5
- package/umd/icon/IconUpload/index.js +7 -5
- package/umd/icon/IconUser/index.js +7 -5
- package/umd/icon/IconUserFill/index.js +7 -5
- package/umd/icon/IconWarnCircle/index.js +7 -5
- package/umd/icon/IconWarnCircleFill/index.js +7 -5
- package/umd/icon/index.js +1 -0
- package/umd/image/index.js +86 -56
- package/umd/image/style/css/index.css +1 -0
- package/umd/image/style/index.less +1 -0
- package/umd/image-picker/add-icon.js +2 -0
- package/umd/image-picker/index.js +85 -52
- package/umd/image-preview/index.d.ts +2 -2
- package/umd/image-preview/index.js +224 -119
- package/umd/image-preview/methods.js +15 -5
- package/umd/index.d.ts +10 -9
- package/umd/index.js +26 -23
- package/umd/input/demo/style/css/mobile.css +5 -1
- package/umd/input/demo/style/mobile.less +2 -2
- package/umd/input/hooks.js +100 -42
- package/umd/input/index.js +35 -26
- package/umd/input/props.d.ts +6 -0
- package/umd/input/style/css/index.css +9 -0
- package/umd/input/style/index.less +2 -2
- package/umd/load-more/index.js +51 -29
- package/umd/loading/index.js +43 -19
- package/umd/masking/index.d.ts +2 -2
- package/umd/masking/index.js +71 -46
- package/umd/masking/methods.js +16 -4
- package/umd/nav-bar/back-icon.js +4 -1
- package/umd/nav-bar/index.js +55 -37
- package/umd/notice-bar/index.js +57 -33
- package/umd/notice-bar/style/css/index.css +33 -0
- package/umd/notice-bar/style/index.less +16 -3
- package/umd/notify/index.d.ts +8 -8
- package/umd/notify/index.js +40 -20
- package/umd/notify/methods.js +14 -2
- package/umd/pagination/arrow.js +2 -0
- package/umd/pagination/index.js +53 -27
- package/umd/picker/index.js +70 -40
- package/umd/picker-view/components/cascader.js +27 -14
- package/umd/picker-view/components/multi-picker.js +19 -6
- package/umd/picker-view/components/picker-cell.js +93 -45
- package/umd/picker-view/index.js +58 -25
- package/umd/popover/hooks/useEvent.js +44 -25
- package/umd/popover/hooks/usePosition.js +145 -94
- package/umd/popover/index.js +3 -1
- package/umd/popover/menu.js +45 -32
- package/umd/popover/popover-inner.js +42 -30
- package/umd/popover/popover.js +94 -69
- package/umd/popup/index.d.ts +2 -2
- package/umd/popup/index.js +31 -22
- package/umd/popup/methods.js +1 -0
- package/umd/popup-swiper/index.d.ts +2 -2
- package/umd/popup-swiper/index.js +71 -38
- package/umd/popup-swiper/methods.js +1 -0
- package/umd/portal/index.js +6 -3
- package/umd/progress/index.js +39 -27
- package/umd/pull-refresh/android-pull-refresh.js +93 -58
- package/umd/pull-refresh/hooks.js +29 -11
- package/umd/pull-refresh/index.js +7 -3
- package/umd/pull-refresh/ios-pull-refresh.js +72 -53
- package/umd/pull-refresh/model.js +1 -0
- package/umd/radio/group.js +30 -20
- package/umd/radio/index.js +3 -1
- package/umd/radio/radio.js +5 -0
- package/umd/rate/index.js +44 -24
- package/umd/search-bar/association.js +29 -14
- package/umd/search-bar/cancel-button.js +14 -8
- package/umd/search-bar/highlight.js +21 -14
- package/umd/search-bar/index.js +87 -77
- package/umd/search-bar/style/css/index.css +1 -0
- package/umd/search-bar/style/index.less +1 -0
- package/umd/show-monitor/index.js +89 -34
- package/umd/slider/hooks/index.js +4 -0
- package/umd/slider/hooks/useSliderEvents.js +52 -26
- package/umd/slider/hooks/useSliderIcon.js +17 -6
- package/umd/slider/hooks/useSliderInit.js +50 -32
- package/umd/slider/hooks/useSliderStyle.js +22 -12
- package/umd/slider/index.js +65 -46
- package/umd/slider/marks.js +21 -12
- package/umd/slider/popover.js +10 -4
- package/umd/slider/thumb.js +18 -8
- package/umd/stepper/hooks/useButtonClick.js +27 -19
- package/umd/stepper/hooks/useInputEvent.js +17 -9
- package/umd/stepper/hooks/useValue.js +13 -9
- package/umd/stepper/index.js +87 -82
- package/umd/steps/index.js +32 -22
- package/umd/steps/step.js +22 -10
- package/umd/sticky/index.js +59 -36
- package/umd/style.d.ts +9 -8
- package/umd/style.js +4 -4
- package/umd/swipe-action/index.js +84 -40
- package/umd/swipe-action/item.js +14 -9
- package/umd/swipe-load/index.js +77 -55
- package/umd/switch/index.js +43 -27
- package/umd/tab-bar/index.js +2 -0
- package/umd/tab-bar/item.js +19 -6
- package/umd/tab-bar/tab-bar.js +26 -15
- package/umd/tabs/index.js +186 -129
- package/umd/tabs/tab-cell-underline.js +107 -38
- package/umd/tabs/tab-cell.js +119 -70
- package/umd/tabs/tab-pane.js +89 -49
- package/umd/tabs/type.d.ts +18 -2
- package/umd/tag/index.js +3 -1
- package/umd/tag/list.js +20 -11
- package/umd/tag/tag.js +26 -20
- package/umd/textarea/index.js +51 -35
- package/umd/toast/index.d.ts +12 -12
- package/umd/toast/index.js +49 -26
- package/umd/toast/methods.js +13 -2
- package/umd/transition/index.js +12 -10
@@ -9,41 +9,45 @@ import { open } from './methods';
|
|
9
9
|
import { getStyleWithVendor, useRefState } from '../_helpers';
|
10
10
|
var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
11
11
|
var _props$className = props.className,
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
12
|
+
className = _props$className === void 0 ? '' : _props$className,
|
13
|
+
visible = props.visible,
|
14
|
+
children = props.children,
|
15
|
+
maskStyle = props.maskStyle,
|
16
|
+
contentStyle = props.contentStyle,
|
17
|
+
_props$direction = props.direction,
|
18
|
+
direction = _props$direction === void 0 ? 'bottom' : _props$direction,
|
19
|
+
_props$percentToClose = props.percentToClose,
|
20
|
+
percentToClose = _props$percentToClose === void 0 ? 0.3 : _props$percentToClose,
|
21
|
+
_props$distanceToClos = props.distanceToClose,
|
22
|
+
distanceToClose = _props$distanceToClos === void 0 ? 10 : _props$distanceToClos,
|
23
|
+
_props$speedToClose = props.speedToClose,
|
24
|
+
speedToClose = _props$speedToClose === void 0 ? 200 : _props$speedToClose,
|
25
|
+
allowSwipeDirections = props.allowSwipeDirections,
|
26
|
+
exitDirection = props.exitDirection,
|
27
|
+
onTouchMove = props.onTouchMove,
|
28
|
+
onTouchStart = props.onTouchStart,
|
29
|
+
onTouchEnd = props.onTouchEnd,
|
30
|
+
_onOpen = props.onOpen,
|
31
|
+
_onClose = props.onClose,
|
32
|
+
close = props.close,
|
33
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
34
|
+
|
34
35
|
var _useState = useState(visible),
|
35
|
-
|
36
|
-
|
36
|
+
opened = _useState[0],
|
37
|
+
setOpened = _useState[1];
|
38
|
+
|
37
39
|
var _useRefState = useRefState({
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
direction: 'X',
|
41
|
+
value: 0
|
42
|
+
}),
|
43
|
+
distance = _useRefState[0],
|
44
|
+
distanceRef = _useRefState[1],
|
45
|
+
setDistance = _useRefState[2];
|
46
|
+
|
44
47
|
var _useState2 = useState(false),
|
45
|
-
|
46
|
-
|
48
|
+
hasTrans = _useState2[0],
|
49
|
+
setHasTrans = _useState2[1];
|
50
|
+
|
47
51
|
var popupRef = useRef(null);
|
48
52
|
var touchStartXRef = useRef(0);
|
49
53
|
var touchStartYRef = useRef(0);
|
@@ -51,6 +55,7 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
51
55
|
var hasTouchStartRef = useRef(false);
|
52
56
|
var getContentSize = useCallback(function (direc) {
|
53
57
|
var _popupRef$current;
|
58
|
+
|
54
59
|
var contentDom = (_popupRef$current = popupRef.current) == null ? void 0 : _popupRef$current.content;
|
55
60
|
var contentWidth = (contentDom == null ? void 0 : contentDom.offsetWidth) || 0;
|
56
61
|
var contentHeight = (contentDom == null ? void 0 : contentDom.offsetHeight) || 0;
|
@@ -59,7 +64,7 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
59
64
|
}, []);
|
60
65
|
var getPercent = useCallback(function (dis) {
|
61
66
|
var direc = dis.direction,
|
62
|
-
|
67
|
+
value = dis.value;
|
63
68
|
var contentSize = getContentSize(direc);
|
64
69
|
return contentSize ? Math.max(0, Math.min(1, Math.abs(value) / contentSize)) : 0;
|
65
70
|
}, []);
|
@@ -71,9 +76,11 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
71
76
|
}, [allowSwipeDirections, direction]);
|
72
77
|
var handleTouchStart = useCallback(function (e) {
|
73
78
|
var _e$touches, _e$touches$, _e$touches2, _e$touches2$;
|
79
|
+
|
74
80
|
if (onTouchStart && onTouchStart(e)) {
|
75
81
|
return;
|
76
82
|
}
|
83
|
+
|
77
84
|
setHasTrans(false);
|
78
85
|
hasTouchStartRef.current = true;
|
79
86
|
touchStartXRef.current = ((_e$touches = e.touches) == null ? void 0 : (_e$touches$ = _e$touches[0]) == null ? void 0 : _e$touches$.clientX) || 0;
|
@@ -84,20 +91,25 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
84
91
|
if (direc === 'X') {
|
85
92
|
return disX > 0 ? 'right' : 'left';
|
86
93
|
}
|
94
|
+
|
87
95
|
return disY > 0 ? 'bottom' : 'top';
|
88
96
|
}, []);
|
89
97
|
var handleTouchMove = useCallback(function (e, prevented, direc) {
|
90
98
|
var _popupRef$current2, _e$changedTouches, _e$changedTouches$, _e$changedTouches2, _e$changedTouches2$;
|
99
|
+
|
91
100
|
if (onTouchMove && onTouchMove(e, prevented, direc)) {
|
92
101
|
return;
|
93
|
-
}
|
94
|
-
|
102
|
+
} // 如果prevented=false说明正在滚动,则专心处理滚动事件而不处理跟手退出
|
103
|
+
|
104
|
+
|
95
105
|
if (!prevented) {
|
96
106
|
hasTouchStartRef.current = false;
|
97
107
|
}
|
108
|
+
|
98
109
|
if (!hasTouchStartRef.current || e.target === ((_popupRef$current2 = popupRef.current) == null ? void 0 : _popupRef$current2.mask)) {
|
99
110
|
return;
|
100
111
|
}
|
112
|
+
|
101
113
|
var touchMoveX = ((_e$changedTouches = e.changedTouches) == null ? void 0 : (_e$changedTouches$ = _e$changedTouches[0]) == null ? void 0 : _e$changedTouches$.clientX) || 0;
|
102
114
|
var touchMoveY = ((_e$changedTouches2 = e.changedTouches) == null ? void 0 : (_e$changedTouches2$ = _e$changedTouches2[0]) == null ? void 0 : _e$changedTouches2$.clientY) || 0;
|
103
115
|
var disX = touchMoveX < 0 ? 0 : touchMoveX - touchStartXRef.current;
|
@@ -107,6 +119,7 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
107
119
|
var disDirection = exitDirection || movingFromDirec;
|
108
120
|
var direcValue = ['top', 'bottom'].includes(disDirection) ? 'Y' : 'X';
|
109
121
|
var direcRatio = ['bottom', 'right'].includes(disDirection) ? 1 : -1;
|
122
|
+
|
110
123
|
switch (movingFromDirec) {
|
111
124
|
case 'top':
|
112
125
|
case 'bottom':
|
@@ -115,6 +128,7 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
115
128
|
value: Math.abs(disY) * direcRatio
|
116
129
|
});
|
117
130
|
break;
|
131
|
+
|
118
132
|
case 'left':
|
119
133
|
case 'right':
|
120
134
|
setDistance({
|
@@ -122,6 +136,7 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
122
136
|
value: Math.abs(disX) * direcRatio
|
123
137
|
});
|
124
138
|
break;
|
139
|
+
|
125
140
|
default:
|
126
141
|
break;
|
127
142
|
}
|
@@ -136,16 +151,19 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
136
151
|
if (onTouchEnd && onTouchEnd(e)) {
|
137
152
|
return;
|
138
153
|
}
|
154
|
+
|
139
155
|
if (!hasTouchStartRef.current) {
|
140
156
|
return;
|
141
157
|
}
|
158
|
+
|
142
159
|
hasTouchStartRef.current = false;
|
143
160
|
var touchEndTime = new Date().getTime();
|
144
161
|
var _distanceRef$current = distanceRef.current,
|
145
|
-
|
146
|
-
|
162
|
+
direc = _distanceRef$current.direction,
|
163
|
+
value = _distanceRef$current.value;
|
147
164
|
var per = getPercent(distanceRef.current);
|
148
165
|
var speed = value / (touchEndTime - touchStartTimeRef.current) * 1000;
|
166
|
+
|
149
167
|
if (per > 0 && per >= percentToClose && Math.abs(value) > distanceToClose || Math.abs(speed) > speedToClose) {
|
150
168
|
setHasTrans(false);
|
151
169
|
close(e);
|
@@ -162,6 +180,7 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
162
180
|
value: 0
|
163
181
|
});
|
164
182
|
}
|
183
|
+
|
165
184
|
touchStartTimeRef.current = 0;
|
166
185
|
}, [onTouchEnd, percentToClose, distanceToClose, speedToClose, close]);
|
167
186
|
useImperativeHandle(ref, function () {
|
@@ -169,15 +188,20 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
169
188
|
});
|
170
189
|
useEffect(function () {
|
171
190
|
var _popupRef$current3;
|
191
|
+
|
172
192
|
var contentDom = (_popupRef$current3 = popupRef.current) == null ? void 0 : _popupRef$current3.content;
|
193
|
+
|
173
194
|
if (opened && contentDom) {
|
174
195
|
contentDom.addEventListener('touchstart', handleTouchStart);
|
175
196
|
contentDom.addEventListener('touchend', handleTouchEnd);
|
176
197
|
contentDom.addEventListener('touchcancel', handleTouchEnd);
|
177
198
|
}
|
199
|
+
|
178
200
|
return function () {
|
179
201
|
var _popupRef$current4;
|
202
|
+
|
180
203
|
var ctDom = (_popupRef$current4 = popupRef.current) == null ? void 0 : _popupRef$current4.content;
|
204
|
+
|
181
205
|
if (opened && ctDom) {
|
182
206
|
ctDom.removeEventListener('touchstart', handleTouchStart);
|
183
207
|
ctDom.removeEventListener('touchend', handleTouchEnd);
|
@@ -185,12 +209,14 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
185
209
|
}
|
186
210
|
};
|
187
211
|
}, [opened, handleTouchStart, handleTouchEnd]);
|
212
|
+
|
188
213
|
function getContentStyle() {
|
189
214
|
var disStyle = getStyleWithVendor({
|
190
215
|
transform: distance.value ? "translate" + distance.direction + "(" + distance.value + "px) translateZ(2px)" : void 0
|
191
216
|
});
|
192
217
|
return _extends({}, contentStyle || {}, disStyle);
|
193
218
|
}
|
219
|
+
|
194
220
|
return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref) {
|
195
221
|
var prefixCls = _ref.prefixCls;
|
196
222
|
return /*#__PURE__*/React.createElement(Popup, _extends({
|
@@ -233,7 +259,6 @@ export function methodsGenerator(Comp) {
|
|
233
259
|
};
|
234
260
|
}
|
235
261
|
var PopupSwiperWithGlobalContext = CompWithGlobalContext(PopupSwiper);
|
236
|
-
|
237
262
|
/**
|
238
263
|
* 基于弹出层(Popup)封装的具有手势关闭功能的弹出层组件,拥有 Popup 组件的其他能力。
|
239
264
|
* @en The popup with gesture closing function based on the popup encapsulation, has other capabilities of the Popup component.
|
@@ -242,4 +267,5 @@ var PopupSwiperWithGlobalContext = CompWithGlobalContext(PopupSwiper);
|
|
242
267
|
* @name 可滑动弹出层
|
243
268
|
* @name_en PopupSwiper
|
244
269
|
*/
|
270
|
+
|
245
271
|
export default componentWrapper(PopupSwiper, methodsGenerator(PopupSwiperWithGlobalContext));
|
package/esm/portal/index.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { useEffect, useState } from 'react';
|
2
2
|
import ReactDOM from 'react-dom';
|
3
|
+
|
3
4
|
/**
|
4
5
|
* React.createPortal的简单封装。
|
5
6
|
* @en Simple wrapper for React.createPortal
|
@@ -10,10 +11,11 @@ import ReactDOM from 'react-dom';
|
|
10
11
|
*/
|
11
12
|
export default function Portal(props) {
|
12
13
|
var _useState = useState(),
|
13
|
-
|
14
|
-
|
14
|
+
container = _useState[0],
|
15
|
+
setContainer = _useState[1];
|
16
|
+
|
15
17
|
var children = props.children,
|
16
|
-
|
18
|
+
getContainer = props.getContainer;
|
17
19
|
useEffect(function () {
|
18
20
|
setContainer(getContainer ? getContainer() : document.body);
|
19
21
|
}, [getContainer]);
|
package/esm/progress/index.js
CHANGED
@@ -3,6 +3,7 @@ import { cls } from '@arco-design/mobile-utils';
|
|
3
3
|
import React, { useRef, forwardRef, useImperativeHandle } from 'react';
|
4
4
|
import { ContextLayout } from '../context-provider';
|
5
5
|
import { getStyleWithVendor, useProgress } from '../_helpers';
|
6
|
+
|
6
7
|
/**
|
7
8
|
* 进度条组件,可根据外界传递进来的百分比进行进度展示
|
8
9
|
* @en Progress bar, which can display progress according to the percentage passed in from the outside
|
@@ -13,46 +14,50 @@ import { getStyleWithVendor, useProgress } from '../_helpers';
|
|
13
14
|
*/
|
14
15
|
var Progress = /*#__PURE__*/forwardRef(function (props, ref) {
|
15
16
|
var _props$mode = props.mode,
|
16
|
-
|
17
|
+
mode = _props$mode === void 0 ? 'base' : _props$mode;
|
17
18
|
var percentage = Math.min(100, Math.max(props.percentage, 0));
|
18
19
|
var top = props.top,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
20
|
+
_props$percentPositio = props.percentPosition,
|
21
|
+
percentPosition = _props$percentPositio === void 0 ? 'right' : _props$percentPositio,
|
22
|
+
_props$className = props.className,
|
23
|
+
className = _props$className === void 0 ? '' : _props$className,
|
24
|
+
style = props.style,
|
25
|
+
_props$showPercent = props.showPercent,
|
26
|
+
showPercent = _props$showPercent === void 0 ? mode === 'base' : _props$showPercent,
|
27
|
+
renderPercent = props.renderPercent,
|
28
|
+
trackColor = props.trackColor,
|
29
|
+
progressColor = props.progressColor,
|
30
|
+
_props$disabled = props.disabled,
|
31
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
32
|
+
trackStroke = props.trackStroke,
|
33
|
+
progressStroke = props.progressStroke,
|
34
|
+
_props$duration = props.duration,
|
35
|
+
duration = _props$duration === void 0 ? 300 : _props$duration,
|
36
|
+
_props$step = props.step,
|
37
|
+
step = _props$step === void 0 ? 1 : _props$step,
|
38
|
+
_props$filleted = props.filleted,
|
39
|
+
filleted = _props$filleted === void 0 ? true : _props$filleted,
|
40
|
+
_props$mountedTransit = props.mountedTransition,
|
41
|
+
mountedTransition = _props$mountedTransit === void 0 ? true : _props$mountedTransit,
|
42
|
+
_props$mountedBezier = props.mountedBezier,
|
43
|
+
mountedBezier = _props$mountedBezier === void 0 ? [0.34, 0.69, 0.1, 1] : _props$mountedBezier;
|
43
44
|
var domRef = useRef(null);
|
45
|
+
|
44
46
|
var _useProgress = useProgress(mountedTransition, percentage, duration, mountedBezier, step),
|
45
|
-
|
46
|
-
|
47
|
+
currentPercentage = _useProgress[0],
|
48
|
+
transitionControl = _useProgress[1];
|
49
|
+
|
47
50
|
useImperativeHandle(ref, function () {
|
48
51
|
return {
|
49
52
|
dom: domRef.current
|
50
53
|
};
|
51
54
|
});
|
55
|
+
|
52
56
|
function renderText(position) {
|
53
57
|
if (!showPercent) {
|
54
58
|
return null;
|
55
59
|
}
|
60
|
+
|
56
61
|
if (position === 'follow') {
|
57
62
|
return renderPercent !== void 0 ? renderPercent(currentPercentage) : /*#__PURE__*/React.createElement("div", {
|
58
63
|
className: cls('text-follow', {
|
@@ -63,6 +68,7 @@ var Progress = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
63
68
|
}
|
64
69
|
}, currentPercentage, "%");
|
65
70
|
}
|
71
|
+
|
66
72
|
if (position === percentPosition) {
|
67
73
|
return /*#__PURE__*/React.createElement("div", {
|
68
74
|
style: {
|
@@ -73,8 +79,10 @@ var Progress = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
73
79
|
})
|
74
80
|
}, renderPercent !== void 0 ? renderPercent(currentPercentage) : currentPercentage + "%");
|
75
81
|
}
|
82
|
+
|
76
83
|
return null;
|
77
84
|
}
|
85
|
+
|
78
86
|
function renderBarProgress(_ref) {
|
79
87
|
var prefixCls = _ref.prefixCls;
|
80
88
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -118,6 +126,7 @@ var Progress = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
118
126
|
className: "wrapper"
|
119
127
|
}, renderText('follow')) : null)), renderText('right'), renderText('innerLeft')));
|
120
128
|
}
|
129
|
+
|
121
130
|
return /*#__PURE__*/React.createElement(ContextLayout, null, renderBarProgress);
|
122
131
|
});
|
123
132
|
export default Progress;
|
@@ -5,88 +5,100 @@ import { GlobalContext } from '../context-provider';
|
|
5
5
|
import { PullRefreshStatus } from './model';
|
6
6
|
import { useCommonState, useAddScrollEvents, useCheckAsStart } from './hooks';
|
7
7
|
import { getStyleWithVendor } from '../_helpers';
|
8
|
+
|
8
9
|
var dampRateCalculate = function dampRateCalculate(val, tipsHeight, dampRate) {
|
9
10
|
return val > tipsHeight ? tipsHeight + (val - tipsHeight) / dampRate : val;
|
10
11
|
};
|
12
|
+
|
11
13
|
export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
12
14
|
var _pullTextConfig;
|
15
|
+
|
13
16
|
var _useContext = useContext(GlobalContext),
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
prefixCls = _useContext.prefixCls,
|
18
|
+
_useContext$locale = _useContext.locale,
|
19
|
+
locale = _useContext$locale === void 0 ? defaultLocale : _useContext$locale;
|
20
|
+
|
17
21
|
var className = props.className,
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
22
|
+
style = props.style,
|
23
|
+
children = props.children,
|
24
|
+
_props$loosingText = props.loosingText,
|
25
|
+
loosingText = _props$loosingText === void 0 ? /*#__PURE__*/React.createElement("div", {
|
26
|
+
className: cls(prefixCls + "-pull-refresh-label-text")
|
27
|
+
}, /*#__PURE__*/React.createElement("span", null, locale.PullRefresh.loosingText)) : _props$loosingText,
|
28
|
+
_props$loadingText = props.loadingText,
|
29
|
+
loadingText = _props$loadingText === void 0 ? /*#__PURE__*/React.createElement("div", {
|
30
|
+
className: cls(prefixCls + "-pull-refresh-label-text")
|
31
|
+
}, /*#__PURE__*/React.createElement(Loading, {
|
32
|
+
type: "circle",
|
33
|
+
radius: 4
|
34
|
+
}), /*#__PURE__*/React.createElement("span", null, locale.PullRefresh.loadingText)) : _props$loadingText,
|
35
|
+
_props$pullingText = props.pullingText,
|
36
|
+
pullingText = _props$pullingText === void 0 ? /*#__PURE__*/React.createElement("div", {
|
37
|
+
className: cls(prefixCls + "-pull-refresh-label-text")
|
38
|
+
}, /*#__PURE__*/React.createElement("span", null, locale.PullRefresh.pullingText)) : _props$pullingText,
|
39
|
+
_props$finishText = props.finishText,
|
40
|
+
finishText = _props$finishText === void 0 ? /*#__PURE__*/React.createElement("div", {
|
41
|
+
className: cls(prefixCls + "-pull-refresh-label-text")
|
42
|
+
}, /*#__PURE__*/React.createElement("span", null, locale.PullRefresh.finishText)) : _props$finishText,
|
43
|
+
initialText = props.initialText,
|
44
|
+
_props$finishDelay = props.finishDelay,
|
45
|
+
finishDelay = _props$finishDelay === void 0 ? 300 : _props$finishDelay,
|
46
|
+
loosingMinHeight = props.loosingMinHeight,
|
47
|
+
_props$dampRate = props.dampRate,
|
48
|
+
dampRate = _props$dampRate === void 0 ? 4 : _props$dampRate,
|
49
|
+
_props$disabled = props.disabled,
|
50
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
51
|
+
_props$useHideAsNeste = props.useHideAsNestedScroll,
|
52
|
+
useHideAsNestedScroll = _props$useHideAsNeste === void 0 ? true : _props$useHideAsNeste,
|
53
|
+
onRefresh = props.onRefresh,
|
54
|
+
_props$allowPullWhenN = props.allowPullWhenNotTop,
|
55
|
+
allowPullWhenNotTop = _props$allowPullWhenN === void 0 ? false : _props$allowPullWhenN;
|
56
|
+
|
52
57
|
var _useState = useState({}),
|
53
|
-
|
54
|
-
|
58
|
+
transition = _useState[0],
|
59
|
+
setTransition = _useState[1];
|
60
|
+
|
55
61
|
var touchRef = useRef(null);
|
56
62
|
var currentTranslateYRef = useRef(0);
|
57
63
|
var onTouching = useRef(false);
|
64
|
+
|
58
65
|
var _useCommonState = useCommonState({
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
66
|
+
loosingMinHeight: loosingMinHeight,
|
67
|
+
onRefresh: onRefresh
|
68
|
+
}),
|
69
|
+
loadingRef = _useCommonState.loadingRef,
|
70
|
+
status = _useCommonState.status,
|
71
|
+
setStatus = _useCommonState.setStatus,
|
72
|
+
labelRef = _useCommonState.labelRef,
|
73
|
+
domRef = _useCommonState.domRef,
|
74
|
+
touching = _useCommonState.touching,
|
75
|
+
setTouching = _useCommonState.setTouching,
|
76
|
+
loosingHeight = _useCommonState.loosingHeight,
|
77
|
+
handleRefresh = _useCommonState.handleRefresh,
|
78
|
+
tipsHeight = _useCommonState.tipsHeight;
|
79
|
+
|
72
80
|
var _useCheckAsStart = useCheckAsStart({
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
81
|
+
domRef: domRef,
|
82
|
+
allowPullWhenNotTop: allowPullWhenNotTop
|
83
|
+
}),
|
84
|
+
ifShouldHandle = _useCheckAsStart.ifShouldHandle;
|
85
|
+
|
77
86
|
var currentLabelStyle = useMemo(function () {
|
78
87
|
var _domRef$current$scrol, _domRef$current;
|
88
|
+
|
79
89
|
return useHideAsNestedScroll && !touching && status === PullRefreshStatus.Pulling && ((_domRef$current$scrol = domRef == null ? void 0 : (_domRef$current = domRef.current) == null ? void 0 : _domRef$current.scrollTop) != null ? _domRef$current$scrol : 0) > 0 ? {
|
80
90
|
opacity: 0
|
81
91
|
} : {};
|
82
92
|
}, [useHideAsNestedScroll, touching]);
|
83
93
|
var pullTextConfig = (_pullTextConfig = {}, _pullTextConfig[PullRefreshStatus.Static] = initialText === void 0 ? pullingText : initialText, _pullTextConfig[PullRefreshStatus.Pulling] = pullingText, _pullTextConfig[PullRefreshStatus.Loosing] = loosingText || pullingText, _pullTextConfig[PullRefreshStatus.Loading] = loadingText, _pullTextConfig[PullRefreshStatus.Finish] = finishText, _pullTextConfig);
|
94
|
+
|
84
95
|
var scroll = function scroll(y, ms, callback) {
|
85
96
|
if (y < 5) {
|
86
97
|
if (y < 0) {
|
87
98
|
currentTranslateYRef.current = 0;
|
88
99
|
return;
|
89
100
|
}
|
101
|
+
|
90
102
|
if (ms === 0) {
|
91
103
|
setTimeout(function () {
|
92
104
|
setTransition({
|
@@ -97,6 +109,7 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
97
109
|
return;
|
98
110
|
}
|
99
111
|
}
|
112
|
+
|
100
113
|
var translateY = dampRateCalculate(y, loosingHeight, dampRate);
|
101
114
|
currentTranslateYRef.current = translateY;
|
102
115
|
setTransition({
|
@@ -107,39 +120,49 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
107
120
|
callback == null ? void 0 : callback();
|
108
121
|
}, ms);
|
109
122
|
};
|
123
|
+
|
110
124
|
var reset = function reset(callback) {
|
111
125
|
if (callback === void 0) {
|
112
126
|
callback = function callback() {};
|
113
127
|
}
|
128
|
+
|
114
129
|
scroll(0, 300, function () {
|
115
130
|
if (domRef.current && domRef.current.scrollTop < 0) {
|
116
131
|
domRef.current.scrollTop = 0;
|
117
132
|
}
|
133
|
+
|
118
134
|
loadingRef.current = false;
|
119
135
|
setStatus(PullRefreshStatus.Static);
|
120
136
|
callback();
|
121
137
|
});
|
122
138
|
};
|
139
|
+
|
123
140
|
var handleTouchStart = useCallback(function (e) {
|
124
141
|
if (disabled || touchRef.current || loadingRef.current || !domRef.current) return;
|
125
142
|
if (!ifShouldHandle()) return;
|
126
143
|
setTouching(true);
|
144
|
+
|
127
145
|
if (domRef.current.scrollTop === 0) {
|
128
146
|
domRef.current.scrollTop = 1;
|
129
147
|
}
|
148
|
+
|
130
149
|
var _e$touches$ = e.touches[0],
|
131
|
-
|
132
|
-
|
150
|
+
pageX = _e$touches$.pageX,
|
151
|
+
pageY = _e$touches$.pageY;
|
152
|
+
|
133
153
|
if (pageX && pageY) {
|
134
154
|
var _domRef$current2;
|
155
|
+
|
135
156
|
touchRef.current = {
|
136
157
|
start: (_domRef$current2 = domRef.current) == null ? void 0 : _domRef$current2.scrollTop,
|
137
158
|
x: pageX,
|
138
159
|
y: pageY
|
139
160
|
};
|
140
161
|
}
|
162
|
+
|
141
163
|
setStatus(PullRefreshStatus.Pulling);
|
142
164
|
}, [disabled, ifShouldHandle]);
|
165
|
+
|
143
166
|
var refresh = function refresh() {
|
144
167
|
return new Promise(function (resolve) {
|
145
168
|
setStatus(PullRefreshStatus.Loading);
|
@@ -158,14 +181,17 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
158
181
|
});
|
159
182
|
});
|
160
183
|
};
|
184
|
+
|
161
185
|
var handleTouchEnd = useCallback(function () {
|
162
186
|
if (currentTranslateYRef.current === 0 && !ifShouldHandle()) {
|
163
187
|
return;
|
164
188
|
}
|
189
|
+
|
165
190
|
onTouching.current = false;
|
166
191
|
setTouching(false);
|
167
192
|
if (disabled || !touchRef.current || loadingRef.current) return;
|
168
193
|
touchRef.current = null;
|
194
|
+
|
169
195
|
if (status === PullRefreshStatus.Loosing) {
|
170
196
|
refresh();
|
171
197
|
} else {
|
@@ -178,12 +204,15 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
178
204
|
if (!touchRef.current) return;
|
179
205
|
var pageY = e.touches[0].pageY;
|
180
206
|
var pullY = pageY - touchRef.current.y - touchRef.current.start;
|
207
|
+
|
181
208
|
if (currentTranslateYRef.current === 0 && domRef.current.scrollTop > 0) {
|
182
209
|
return;
|
183
210
|
}
|
211
|
+
|
184
212
|
if (currentTranslateYRef.current === 0 && pullY < 0) {
|
185
213
|
return;
|
186
214
|
}
|
215
|
+
|
187
216
|
setStatus(function () {
|
188
217
|
return pullY > loosingHeight ? PullRefreshStatus.Loosing : PullRefreshStatus.Pulling;
|
189
218
|
});
|
@@ -193,15 +222,18 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
193
222
|
}, [disabled, loosingHeight]);
|
194
223
|
useEffect(function () {
|
195
224
|
var _domRef$current3;
|
225
|
+
|
196
226
|
var onScroll = function onScroll() {
|
197
227
|
if (onTouching.current && domRef.current && (domRef.current.scrollTop < 0 || currentTranslateYRef.current)) {
|
198
228
|
// 禁止 ios 负 scrollTop 和双层滚动
|
199
229
|
domRef.current.scrollTop = 0;
|
200
230
|
}
|
201
231
|
};
|
232
|
+
|
202
233
|
(_domRef$current3 = domRef.current) == null ? void 0 : _domRef$current3.addEventListener('scroll', onScroll);
|
203
234
|
return function () {
|
204
235
|
var _domRef$current4;
|
236
|
+
|
205
237
|
(_domRef$current4 = domRef.current) == null ? void 0 : _domRef$current4.removeEventListener('scroll', onScroll);
|
206
238
|
};
|
207
239
|
}, []);
|