@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
@@ -14,26 +14,31 @@
|
|
14
14
|
"use strict";
|
15
15
|
|
16
16
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
17
|
+
|
17
18
|
_exports.__esModule = true;
|
18
19
|
_exports.default = void 0;
|
19
20
|
_react = _interopRequireWildcard(_react);
|
20
21
|
_lodash = _interopRequireDefault(_lodash);
|
22
|
+
|
21
23
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
24
|
+
|
22
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
26
|
+
|
23
27
|
var LISTEN_FLAG = 'data-show-listened';
|
24
28
|
/**
|
25
29
|
* 父 dom 节点集合
|
26
30
|
* @en Parent dom node collection
|
27
31
|
*/
|
32
|
+
|
28
33
|
var wrapperNodeList = [];
|
29
34
|
/**
|
30
35
|
* 同一父节点下监听队列
|
31
36
|
* @en Listening queue under the same parent node
|
32
37
|
*/
|
38
|
+
|
33
39
|
var listeners = {};
|
34
40
|
var onOnceEmittedListeners = {};
|
35
41
|
var throttlingVisibleChange;
|
36
|
-
|
37
42
|
/**
|
38
43
|
* 通过滚动事件监测 children 是否进入视口或离开视口。
|
39
44
|
* @en Use scroll events to monitor whether children enter or leave the viewport.
|
@@ -42,60 +47,67 @@
|
|
42
47
|
* @name 滚动视口监听
|
43
48
|
* @name_en ShowMonitor
|
44
49
|
*/
|
50
|
+
|
45
51
|
var ShowMonitor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
46
52
|
var className = props.className,
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
53
|
+
style = props.style,
|
54
|
+
getScrollContainer = props.getScrollContainer,
|
55
|
+
_props$throttle = props.throttle,
|
56
|
+
throttle = _props$throttle === void 0 ? 300 : _props$throttle,
|
57
|
+
_props$listenResize = props.listenResize,
|
58
|
+
listenResize = _props$listenResize === void 0 ? true : _props$listenResize,
|
59
|
+
_props$listenScroll = props.listenScroll,
|
60
|
+
listenScroll = _props$listenScroll === void 0 ? true : _props$listenScroll,
|
61
|
+
_props$overflow = props.overflow,
|
62
|
+
overflow = _props$overflow === void 0 ? false : _props$overflow,
|
63
|
+
_props$offset = props.offset,
|
64
|
+
offset = _props$offset === void 0 ? 0 : _props$offset,
|
65
|
+
_props$threshold = props.threshold,
|
66
|
+
threshold = _props$threshold === void 0 ? 0 : _props$threshold,
|
67
|
+
_props$once = props.once,
|
68
|
+
once = _props$once === void 0 ? false : _props$once,
|
69
|
+
_props$children = props.children,
|
70
|
+
children = _props$children === void 0 ? null : _props$children,
|
71
|
+
_props$disabled = props.disabled,
|
72
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
73
|
+
onVisibleChange = props.onVisibleChange,
|
74
|
+
onClick = props.onClick;
|
69
75
|
var domRef = (0, _react.useRef)(null);
|
70
76
|
/**
|
71
77
|
* 滚动容器父级元素
|
72
78
|
* @en Scroll container parent element
|
73
79
|
*/
|
80
|
+
|
74
81
|
var scrollPort = (0, _react.useRef)(null);
|
75
82
|
/**
|
76
83
|
* 局部滚动元素父节点
|
77
84
|
* @en Parent node of the local scroll element
|
78
85
|
*/
|
86
|
+
|
79
87
|
var domRefParent = (0, _react.useRef)(null);
|
80
88
|
/**
|
81
89
|
* 当前元素是否在可视区域内
|
82
90
|
* @en Whether the current element is in the visible area
|
83
91
|
*/
|
92
|
+
|
84
93
|
var isVisible = (0, _react.useRef)(false);
|
85
94
|
/**
|
86
95
|
* 保存当前节点信息,类似于 class component 中 this
|
87
96
|
* @en Save current node information, similar to this in class component
|
88
97
|
*/
|
98
|
+
|
89
99
|
var listener = (0, _react.useRef)(null);
|
90
100
|
/**
|
91
101
|
* Intersection Observer 实例化对象
|
92
102
|
* @en Instantiated object of Intersection Observer
|
93
103
|
*/
|
104
|
+
|
94
105
|
var io = (0, _react.useRef)(null);
|
95
106
|
/**
|
96
107
|
* 父容器唯一 key(wrapperNodeList index)
|
97
108
|
* @en The unique key of the parent container (wrapperNodeList index)
|
98
109
|
*/
|
110
|
+
|
99
111
|
var wrapperKey = (0, _react.useRef)(-1);
|
100
112
|
var isChildrenExist = (0, _react.useRef)(Boolean(children));
|
101
113
|
var isSupportNativeApi = (0, _react.useMemo)(function () {
|
@@ -105,6 +117,7 @@
|
|
105
117
|
(0, _react.useImperativeHandle)(ref, function () {
|
106
118
|
return {
|
107
119
|
dom: domRef.current,
|
120
|
+
|
108
121
|
/**
|
109
122
|
* 提供检查元素是否可见的api
|
110
123
|
* @en Provides an api to check whether the element is visible
|
@@ -118,58 +131,70 @@
|
|
118
131
|
threshold: threshold
|
119
132
|
}, true);
|
120
133
|
},
|
134
|
+
|
121
135
|
/**
|
122
136
|
* 重置元素初始可见态为false,并重新对元素可见度发起检测,优先级低于disabled(通常用在对ShowMonitor内部元素变化时发起的重新监听)
|
123
137
|
* @en Reset the initial visible state of the element to false, and re-detect the visibility of the element, the priority is lower than 'disabled'(Usually used to re-listen when elements inside ShowMonitor change)
|
124
138
|
*/
|
125
139
|
flushVisibleStatus: function flushVisibleStatus() {
|
126
140
|
isVisible.current = false;
|
141
|
+
|
127
142
|
if (isSupportNativeApi && io.current && domRef.current) {
|
128
143
|
disabled ? io.current.unobserve(domRef.current) : io.current.observe(domRef.current);
|
129
144
|
} else if (listener.current) {
|
130
145
|
var _key = wrapperKey.current;
|
146
|
+
|
131
147
|
if (once && onOnceEmittedListeners != null && onOnceEmittedListeners[_key]) {
|
132
148
|
onOnceEmittedListeners[_key] = onOnceEmittedListeners[_key].filter(function (emitListener) {
|
133
149
|
return emitListener !== listener.current;
|
134
150
|
});
|
135
151
|
}
|
152
|
+
|
136
153
|
if (!disabled && !listeners[_key].find(function (_listener) {
|
137
154
|
return _listener === listener.current;
|
138
155
|
})) {
|
139
156
|
listeners[_key].push(listener.current);
|
140
157
|
}
|
158
|
+
|
141
159
|
!disabled && _checkVisible(listener.current);
|
142
160
|
}
|
143
161
|
}
|
144
162
|
};
|
145
163
|
});
|
164
|
+
|
146
165
|
function _checkVisible(component, ignoreCheckPreVisibleStatus) {
|
147
166
|
if (ignoreCheckPreVisibleStatus === void 0) {
|
148
167
|
ignoreCheckPreVisibleStatus = false;
|
149
168
|
}
|
169
|
+
|
150
170
|
var node = component.node,
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
171
|
+
compOverflow = component.overflow,
|
172
|
+
compOnce = component.once,
|
173
|
+
onCompVisibleChange = component.onVisibleChange,
|
174
|
+
preVisible = component.isVisible;
|
175
|
+
|
155
176
|
if (!(node instanceof HTMLElement)) {
|
156
177
|
return;
|
157
178
|
}
|
179
|
+
|
158
180
|
var parent = (0, _mobileUtils.scrollParent)(node);
|
159
181
|
/**
|
160
182
|
* 当前元素为非 document 元素,即为局部滚动
|
161
183
|
* @en If the current element is a non-document element, it's local scrolling
|
162
184
|
*/
|
185
|
+
|
163
186
|
var isOverflow = compOverflow && [node.ownerDocument, document, document.documentElement].indexOf(parent) === -1;
|
164
187
|
/**
|
165
188
|
* 检查元素是否可见
|
166
189
|
* @en Check if element is visible
|
167
190
|
*/
|
191
|
+
|
168
192
|
var curVisible = isOverflow ? (0, _mobileUtils.checkOverflowVisible)(component, parent) : (0, _mobileUtils.checkNormalVisible)(component);
|
169
193
|
/**
|
170
194
|
* 忽略前后可见状态判断
|
171
195
|
* @en Ignore the visible state judgment before and after
|
172
196
|
*/
|
197
|
+
|
173
198
|
if (ignoreCheckPreVisibleStatus) {
|
174
199
|
return curVisible;
|
175
200
|
}
|
@@ -177,12 +202,15 @@
|
|
177
202
|
* 当前元素 visible 对比之前发生改变,触发回调函数
|
178
203
|
* @en The current element visible is changed before the comparison, and the callback function is triggered
|
179
204
|
*/
|
205
|
+
|
206
|
+
|
180
207
|
curVisible !== preVisible.current && handleCheckChildrenExist() && onCompVisibleChange(curVisible, node);
|
181
208
|
var key = wrapperKey.current;
|
182
209
|
/**
|
183
210
|
* 监听一次后加入 pendingList 队列,随后被 listeners 过滤掉
|
184
211
|
* @en After listening once, it is added to the pendingList queue, and then filtered out by listeners
|
185
212
|
*/
|
213
|
+
|
186
214
|
if (!onOnceEmittedListeners[key]) {
|
187
215
|
onOnceEmittedListeners[key] = [];
|
188
216
|
}
|
@@ -190,9 +218,12 @@
|
|
190
218
|
* 当前元素不可见 -> 可见,且 once, 触发回调函数
|
191
219
|
* @en The current element is invisible -> visible, and once, triggers the callback function
|
192
220
|
*/
|
221
|
+
|
222
|
+
|
193
223
|
curVisible && !preVisible.current && compOnce && onOnceEmittedListeners[key].push(component);
|
194
224
|
preVisible.current = curVisible;
|
195
225
|
}
|
226
|
+
|
196
227
|
var checkVisibleHandler = (0, _react.useCallback)(function () {
|
197
228
|
var key = wrapperKey.current;
|
198
229
|
var curListeners = listeners[key] || [];
|
@@ -204,29 +235,35 @@
|
|
204
235
|
});
|
205
236
|
onOnceEmittedListeners[key] = [];
|
206
237
|
}, []);
|
238
|
+
|
207
239
|
function handleCheckChildrenExist() {
|
208
240
|
return isChildrenExist.current && domRef.current && domRef.current.children.length;
|
209
241
|
}
|
242
|
+
|
210
243
|
function handleObserverStatusChange(entries) {
|
211
244
|
var _io$current;
|
245
|
+
|
212
246
|
var isIntersecting = entries[0].isIntersecting;
|
213
247
|
/**
|
214
248
|
* 当前元素 visible 对比之前发生改变,触发回调函数
|
215
249
|
* @en Callback when the visible status of current element changes before the comparison
|
216
250
|
*/
|
251
|
+
|
217
252
|
isIntersecting !== isVisible.current && handleCheckChildrenExist() && onVisibleChange(isIntersecting, domRef.current);
|
218
253
|
/**
|
219
254
|
* 当前元素不可见 -> 可见,且 once, 触发回调函数
|
220
255
|
* @en The current element is invisible -> visible, and once, triggers the callback
|
221
256
|
*/
|
257
|
+
|
222
258
|
isIntersecting && !isVisible.current && once && domRef.current && ((_io$current = io.current) == null ? void 0 : _io$current.unobserve(domRef.current));
|
223
259
|
isVisible.current = isIntersecting;
|
224
260
|
}
|
225
|
-
|
226
261
|
/**
|
227
262
|
* 非首次下disabled变化时,重新监听元素
|
228
263
|
* @en Re-listen to the element when it is not the first time that the disabled status changes,
|
229
264
|
*/
|
265
|
+
|
266
|
+
|
230
267
|
(0, _react.useEffect)(function () {
|
231
268
|
if (isSupportNativeApi) {
|
232
269
|
// 非首次下
|
@@ -245,6 +282,7 @@
|
|
245
282
|
var isExist = listeners[wrapperKey.current].findIndex(function (item) {
|
246
283
|
return item.node === domRef.current;
|
247
284
|
});
|
285
|
+
|
248
286
|
if (isExist !== -1) {
|
249
287
|
listeners[wrapperKey.current].splice(0, 1);
|
250
288
|
}
|
@@ -263,6 +301,7 @@
|
|
263
301
|
scrollPort.current = getScrollContainer ? getScrollContainer() : window;
|
264
302
|
if (!scrollPort.current) return;
|
265
303
|
var wrapperNodeIndex = wrapperNodeList.indexOf(scrollPort.current);
|
304
|
+
|
266
305
|
if (wrapperNodeIndex === -1) {
|
267
306
|
// 当前滚动视口元素不在 wrapperNodeList 中, 入队列
|
268
307
|
// @en The current scroll viewport element is not in the wrapperNodeList, push it into the list
|
@@ -273,7 +312,9 @@
|
|
273
312
|
// @en Take the current index as the key
|
274
313
|
wrapperKey.current = wrapperNodeIndex;
|
275
314
|
}
|
315
|
+
|
276
316
|
var curWrapperKey = wrapperKey.current;
|
317
|
+
|
277
318
|
if (isSupportNativeApi) {
|
278
319
|
if (domRef.current) {
|
279
320
|
domRefParent.current = (0, _mobileUtils.scrollParent)(domRef.current);
|
@@ -282,6 +323,7 @@
|
|
282
323
|
var overflowRoot = isHTMLElement ? parent : null;
|
283
324
|
var root = overflow ? overflowRoot : scrollPort.current === window ? null : scrollPort.current;
|
284
325
|
var rootMargin = '';
|
326
|
+
|
285
327
|
if (Array.isArray(offset)) {
|
286
328
|
if (offset.length === 2) {
|
287
329
|
rootMargin = offset[0] + "px 0px " + offset[1] + "px";
|
@@ -294,6 +336,7 @@
|
|
294
336
|
} else {
|
295
337
|
rootMargin = offset + "px";
|
296
338
|
}
|
339
|
+
|
297
340
|
io.current = new IntersectionObserver(handleObserverStatusChange, {
|
298
341
|
root: root,
|
299
342
|
rootMargin: rootMargin,
|
@@ -306,25 +349,29 @@
|
|
306
349
|
// @en Callback after throttling
|
307
350
|
throttlingVisibleChange = checkVisibleHandler;
|
308
351
|
throttle && (throttlingVisibleChange = (0, _lodash.default)(throttlingVisibleChange, throttle));
|
352
|
+
|
309
353
|
if (overflow) {
|
310
354
|
if (domRef.current) {
|
311
355
|
domRefParent.current = (0, _mobileUtils.scrollParent)(domRef.current);
|
312
356
|
var _parent = domRefParent.current;
|
357
|
+
|
313
358
|
if (_parent && _parent instanceof HTMLElement && typeof _parent.getAttribute === 'function') {
|
314
359
|
var listenerCount = 1 + Number(_parent.getAttribute(LISTEN_FLAG));
|
360
|
+
|
315
361
|
if (!listeners[curWrapperKey]) {
|
316
362
|
listeners[curWrapperKey] = [];
|
317
363
|
}
|
364
|
+
|
318
365
|
if (listenerCount === 1) {
|
319
366
|
// listener 数量为1时监听事件(列表中插入 ShowMonitor 时做判断)
|
320
367
|
// @en Listen when the number of listeners is 1 (judging when ShowMonitor is inserted into the list)
|
321
368
|
_parent.addEventListener('scroll', throttlingVisibleChange);
|
322
369
|
}
|
370
|
+
|
323
371
|
_parent.setAttribute(LISTEN_FLAG, String(listenerCount));
|
324
372
|
}
|
325
373
|
}
|
326
|
-
} else if (!listeners[curWrapperKey] || listeners[curWrapperKey].length === 0 ||
|
327
|
-
// 相同curWrapperKey内全部为overflow场景,需要单独注册scroll事件
|
374
|
+
} else if (!listeners[curWrapperKey] || listeners[curWrapperKey].length === 0 || // 相同curWrapperKey内全部为overflow场景,需要单独注册scroll事件
|
328
375
|
// @en It need to register the scroll event separately when all values in the same curWrapperKey are overflow
|
329
376
|
listeners[curWrapperKey] && listeners[curWrapperKey].every(function (it) {
|
330
377
|
return it.overflow;
|
@@ -332,9 +379,11 @@
|
|
332
379
|
if (!listeners[curWrapperKey]) {
|
333
380
|
listeners[curWrapperKey] = [];
|
334
381
|
}
|
382
|
+
|
335
383
|
listenScroll && scrollPort.current.addEventListener('scroll', throttlingVisibleChange);
|
336
384
|
listenResize && scrollPort.current.addEventListener('resize', throttlingVisibleChange);
|
337
385
|
}
|
386
|
+
|
338
387
|
listener.current = {
|
339
388
|
node: domRef.current,
|
340
389
|
isVisible: isVisible,
|
@@ -343,8 +392,8 @@
|
|
343
392
|
offset: offset,
|
344
393
|
threshold: threshold,
|
345
394
|
onVisibleChange: onVisibleChange
|
346
|
-
};
|
347
|
-
|
395
|
+
}; // 将当前 listener 存入 listeners
|
396
|
+
|
348
397
|
!disabled && listeners[curWrapperKey].push(listener.current);
|
349
398
|
(0, _mobileUtils.nextTick)(function () {
|
350
399
|
!disabled && _checkVisible(listener.current);
|
@@ -355,12 +404,15 @@
|
|
355
404
|
return function () {
|
356
405
|
if (isSupportNativeApi) {
|
357
406
|
var _io$current2;
|
407
|
+
|
358
408
|
domRef.current && ((_io$current2 = io.current) == null ? void 0 : _io$current2.unobserve(domRef.current));
|
359
409
|
} else {
|
360
410
|
if (overflow) {
|
361
411
|
var parent = domRefParent.current;
|
412
|
+
|
362
413
|
if (parent && parent instanceof HTMLElement && typeof parent.getAttribute === 'function') {
|
363
414
|
var listenerCount = Number(parent.getAttribute(LISTEN_FLAG) || 0) - 1;
|
415
|
+
|
364
416
|
if (listenerCount === 0) {
|
365
417
|
// 如果监听队列中无节点,解绑事件
|
366
418
|
// @en If there is no node in the listening queue, unbind the event
|
@@ -372,17 +424,20 @@
|
|
372
424
|
}
|
373
425
|
}
|
374
426
|
}
|
427
|
+
|
375
428
|
var _key2 = wrapperKey.current;
|
376
429
|
var curListeners = listeners[_key2];
|
430
|
+
|
377
431
|
if (curListeners) {
|
378
432
|
// 不在监听队列中,移除
|
379
433
|
// @en Not in the listening queue, remove it
|
380
434
|
var index = curListeners.indexOf(listener.current);
|
381
|
-
index !== -1 && curListeners.splice(index, 1);
|
382
|
-
// 监听队列为空,解绑 scroll、resize 事件
|
435
|
+
index !== -1 && curListeners.splice(index, 1); // 监听队列为空,解绑 scroll、resize 事件
|
383
436
|
// @en When the listening queue is empty, unbind scroll and resize events
|
437
|
+
|
384
438
|
if (curListeners.length === 0) {
|
385
439
|
delete listeners[_key2];
|
440
|
+
|
386
441
|
if (scrollPort.current) {
|
387
442
|
scrollPort.current.removeEventListener('scroll', throttlingVisibleChange);
|
388
443
|
scrollPort.current.removeEventListener('resize', throttlingVisibleChange);
|
@@ -44,8 +44,11 @@
|
|
44
44
|
if (key in _exports && _exports[key] === _useSliderEvents[key]) return;
|
45
45
|
_exports[key] = _useSliderEvents[key];
|
46
46
|
});
|
47
|
+
|
47
48
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
49
|
+
|
48
50
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
51
|
+
|
49
52
|
var baseRenderThumb = function baseRenderThumb(prefixCls) {
|
50
53
|
return function () {
|
51
54
|
return /*#__PURE__*/_react.default.createElement("div", {
|
@@ -53,6 +56,7 @@
|
|
53
56
|
});
|
54
57
|
};
|
55
58
|
};
|
59
|
+
|
56
60
|
_exports.baseRenderThumb = baseRenderThumb;
|
57
61
|
// 因为子组件和 hooks 较多, 为了代码整洁和可读性,做了拆分。
|
58
62
|
// 参数通过 context 共享
|
@@ -16,30 +16,36 @@
|
|
16
16
|
_exports.__esModule = true;
|
17
17
|
_exports.useSliderEvents = void 0;
|
18
18
|
var IsTouchingStatus;
|
19
|
+
|
19
20
|
(function (IsTouchingStatus) {
|
20
21
|
IsTouchingStatus[IsTouchingStatus["Idle"] = 0] = "Idle";
|
21
22
|
IsTouchingStatus[IsTouchingStatus["Start"] = 1] = "Start";
|
22
23
|
IsTouchingStatus[IsTouchingStatus["Moving"] = 2] = "Moving";
|
23
24
|
})(IsTouchingStatus || (IsTouchingStatus = {}));
|
25
|
+
|
24
26
|
var useSliderEvents = function useSliderEvents(_ref) {
|
25
27
|
var getLinePosition = _ref.getLinePosition,
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
lineRef = _ref.lineRef,
|
29
|
+
valueGroup = _ref.valueGroup,
|
30
|
+
setValueGroup = _ref.setValueGroup,
|
31
|
+
setCommonIsTouching = _ref.setCommonIsTouching;
|
32
|
+
|
30
33
|
var _useContext = (0, _react.useContext)(_.SliderContext),
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
disabled = _useContext.disabled,
|
35
|
+
step = _useContext.step,
|
36
|
+
min = _useContext.min,
|
37
|
+
max = _useContext.max,
|
38
|
+
type = _useContext.type,
|
39
|
+
draggableTrackOnly = _useContext.draggableTrackOnly;
|
40
|
+
|
37
41
|
var _useState = (0, _react.useState)(IsTouchingStatus.Idle),
|
38
|
-
|
39
|
-
|
42
|
+
isTouching = _useState[0],
|
43
|
+
setIsTouching = _useState[1];
|
44
|
+
|
40
45
|
var _useState2 = (0, _react.useState)(0),
|
41
|
-
|
42
|
-
|
46
|
+
touchStartPosition = _useState2[0],
|
47
|
+
setTouchStartPosition = _useState2[1];
|
48
|
+
|
43
49
|
var linePositionRef = (0, _react.useRef)({
|
44
50
|
length: 0,
|
45
51
|
start: 0
|
@@ -48,112 +54,131 @@
|
|
48
54
|
var validateValue = (0, _react.useCallback)(function (value) {
|
49
55
|
if (value >= min && value <= max) return value;
|
50
56
|
return value <= (min + max) / 2 ? min : max;
|
51
|
-
}, [min, max]);
|
52
|
-
|
53
|
-
// 通过位置获取值
|
57
|
+
}, [min, max]); // 通过位置获取值
|
54
58
|
// @en Get value by position
|
59
|
+
|
55
60
|
var getValueFromPosition = (0, _react.useCallback)(function (touchPosition) {
|
56
61
|
var _linePositionRef$curr = linePositionRef.current,
|
57
|
-
|
58
|
-
|
62
|
+
length = _linePositionRef$curr.length,
|
63
|
+
start = _linePositionRef$curr.start;
|
59
64
|
if (length === 0) return 0;
|
60
65
|
var newWidth = isHorizontal ? touchPosition - start : length - touchPosition + start;
|
66
|
+
|
61
67
|
if (newWidth < 0) {
|
62
68
|
newWidth = 0;
|
63
69
|
} else if (newWidth > length) {
|
64
70
|
newWidth = length;
|
65
71
|
}
|
72
|
+
|
66
73
|
var newRealTimeValue = validateValue(Math.round(newWidth / length * (max - min) / step) * step + min);
|
67
74
|
return newRealTimeValue;
|
68
|
-
}, [isHorizontal, max, min, step]);
|
69
|
-
|
70
|
-
// 设置不同的值,因为可以点击 line ,需要提前计算具体修改的是哪个值。
|
75
|
+
}, [isHorizontal, max, min, step]); // 设置不同的值,因为可以点击 line ,需要提前计算具体修改的是哪个值。
|
71
76
|
// @en Set different values. Because line can be clicked, it needs to calculate which value to modify in advance.
|
77
|
+
|
72
78
|
var setCommonValue = (0, _react.useMemo)(function () {
|
73
79
|
var start = getValueFromPosition(touchStartPosition);
|
80
|
+
|
74
81
|
if (!Array.isArray(valueGroup)) {
|
75
82
|
if (isTouching) {
|
76
83
|
setValueGroup(start);
|
77
84
|
setCommonIsTouching(0);
|
78
85
|
setIsTouching(IsTouchingStatus.Moving);
|
79
86
|
}
|
87
|
+
|
80
88
|
return function (realTimeValue) {
|
81
89
|
setValueGroup(realTimeValue);
|
82
90
|
};
|
83
91
|
} else {
|
84
92
|
var index = Math.abs(valueGroup[0] - start) < Math.abs(valueGroup[1] - start) ? 0 : 1;
|
93
|
+
|
85
94
|
var handleValue = function handleValue(realTimeValue) {
|
86
95
|
setValueGroup(function (passValueGroup) {
|
87
96
|
if (typeof passValueGroup === 'number') {
|
88
97
|
return [passValueGroup, realTimeValue];
|
89
98
|
}
|
99
|
+
|
90
100
|
var newValueGroup = [].concat(passValueGroup);
|
91
101
|
newValueGroup[index] = realTimeValue;
|
92
102
|
return newValueGroup;
|
93
103
|
});
|
94
104
|
};
|
105
|
+
|
95
106
|
if (isTouching) {
|
96
107
|
setCommonIsTouching(index);
|
97
108
|
handleValue(start);
|
98
109
|
setIsTouching(IsTouchingStatus.Moving);
|
99
110
|
}
|
111
|
+
|
100
112
|
return handleValue;
|
101
113
|
}
|
102
114
|
}, [touchStartPosition, getValueFromPosition]);
|
103
115
|
(0, _react.useEffect)(function () {
|
104
116
|
var _lineRef$current;
|
117
|
+
|
105
118
|
if (disabled) return;
|
119
|
+
|
106
120
|
var handleTouchStart = function handleTouchStart(e) {
|
107
121
|
if (draggableTrackOnly && e.target === lineRef.current) return;
|
108
122
|
linePositionRef.current = getLinePosition();
|
109
123
|
var _e$touches$ = e.touches[0],
|
110
|
-
|
111
|
-
|
124
|
+
clientX = _e$touches$.clientX,
|
125
|
+
clientY = _e$touches$.clientY;
|
112
126
|
var touchPosition = isHorizontal ? clientX : clientY;
|
113
127
|
setIsTouching(IsTouchingStatus.Start);
|
114
128
|
setTouchStartPosition(touchPosition);
|
115
129
|
e.stopPropagation();
|
116
130
|
e.preventDefault();
|
117
131
|
};
|
132
|
+
|
118
133
|
(_lineRef$current = lineRef.current) == null ? void 0 : _lineRef$current.addEventListener('touchstart', handleTouchStart);
|
119
134
|
return function () {
|
120
135
|
var _lineRef$current2;
|
136
|
+
|
121
137
|
!disabled && ((_lineRef$current2 = lineRef.current) == null ? void 0 : _lineRef$current2.removeEventListener('touchstart', handleTouchStart));
|
122
138
|
};
|
123
139
|
}, [disabled, isHorizontal, draggableTrackOnly]);
|
124
140
|
(0, _react.useEffect)(function () {
|
125
141
|
var _lineRef$current3;
|
142
|
+
|
126
143
|
if (disabled) return;
|
144
|
+
|
127
145
|
var handleTouchMove = function handleTouchMove(e) {
|
128
146
|
if (isTouching === IsTouchingStatus.Moving) {
|
129
147
|
var _e$touches$2 = e.touches[0],
|
130
|
-
|
131
|
-
|
148
|
+
clientX = _e$touches$2.clientX,
|
149
|
+
clientY = _e$touches$2.clientY;
|
132
150
|
var touchPosition = isHorizontal ? clientX : clientY;
|
133
151
|
setCommonValue(getValueFromPosition(touchPosition));
|
134
152
|
}
|
153
|
+
|
135
154
|
e.stopPropagation();
|
136
155
|
e.cancelable && e.preventDefault();
|
137
156
|
};
|
157
|
+
|
138
158
|
(_lineRef$current3 = lineRef.current) == null ? void 0 : _lineRef$current3.addEventListener('touchmove', handleTouchMove);
|
139
159
|
return function () {
|
140
160
|
var _lineRef$current4;
|
161
|
+
|
141
162
|
!disabled && ((_lineRef$current4 = lineRef.current) == null ? void 0 : _lineRef$current4.removeEventListener('touchmove', handleTouchMove));
|
142
163
|
};
|
143
164
|
}, [disabled, isHorizontal, isTouching]);
|
144
165
|
(0, _react.useEffect)(function () {
|
145
166
|
var _lineRef$current5, _lineRef$current6;
|
167
|
+
|
146
168
|
if (disabled) return;
|
169
|
+
|
147
170
|
var handleTouchEnd = function handleTouchEnd(e) {
|
148
171
|
setIsTouching(IsTouchingStatus.Idle);
|
149
172
|
setCommonIsTouching(-1);
|
150
173
|
e.stopPropagation();
|
151
174
|
e.preventDefault();
|
152
175
|
};
|
176
|
+
|
153
177
|
(_lineRef$current5 = lineRef.current) == null ? void 0 : _lineRef$current5.addEventListener('touchend', handleTouchEnd);
|
154
178
|
(_lineRef$current6 = lineRef.current) == null ? void 0 : _lineRef$current6.addEventListener('touchcancel', handleTouchEnd);
|
155
179
|
return function () {
|
156
180
|
var _lineRef$current7, _lineRef$current8;
|
181
|
+
|
157
182
|
!disabled && ((_lineRef$current7 = lineRef.current) == null ? void 0 : _lineRef$current7.removeEventListener('touchend', handleTouchEnd));
|
158
183
|
!disabled && ((_lineRef$current8 = lineRef.current) == null ? void 0 : _lineRef$current8.removeEventListener('touchcancel', handleTouchEnd));
|
159
184
|
};
|
@@ -162,5 +187,6 @@
|
|
162
187
|
isTouching: isTouching
|
163
188
|
};
|
164
189
|
};
|
190
|
+
|
165
191
|
_exports.useSliderEvents = useSliderEvents;
|
166
192
|
});
|