@arco-design/mobile-react 2.38.4 → 2.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/hooks.js +59 -141
- package/cjs/_helpers/index.js +2 -18
- package/cjs/_helpers/react-dom.js +0 -14
- package/cjs/_helpers/render.js +5 -21
- package/cjs/action-sheet/index.js +10 -30
- package/cjs/action-sheet/methods.js +0 -2
- package/cjs/action-sheet/style/css/index.js +0 -2
- package/cjs/action-sheet/style/index.js +0 -2
- package/cjs/avatar/group.js +12 -24
- package/cjs/avatar/index.js +53 -79
- package/cjs/avatar/style/css/index.js +0 -2
- package/cjs/avatar/style/index.js +0 -2
- package/cjs/badge/index.js +18 -29
- package/cjs/badge/style/css/index.js +0 -1
- package/cjs/badge/style/index.js +0 -1
- package/cjs/button/hooks.js +15 -20
- package/cjs/button/index.js +46 -67
- package/cjs/button/style/css/index.js +0 -2
- package/cjs/button/style/index.js +0 -2
- package/cjs/carousel/index.js +153 -288
- package/cjs/carousel/style/css/index.js +0 -1
- package/cjs/carousel/style/index.js +0 -1
- package/cjs/cell/arrow.js +0 -3
- package/cjs/cell/cell.js +18 -34
- package/cjs/cell/group.js +9 -21
- package/cjs/cell/index.js +1 -7
- package/cjs/cell/style/css/index.js +0 -1
- package/cjs/cell/style/index.js +0 -1
- package/cjs/checkbox/checkbox.js +31 -57
- package/cjs/checkbox/group.js +24 -38
- package/cjs/checkbox/hooks/index.js +0 -2
- package/cjs/checkbox/hooks/useMergeProps.js +7 -14
- package/cjs/checkbox/index.js +1 -8
- package/cjs/checkbox/style/css/index.js +0 -1
- package/cjs/checkbox/style/index.js +0 -1
- package/cjs/checkbox/type.js +0 -2
- package/cjs/circle-progress/index.js +37 -57
- package/cjs/circle-progress/style/css/index.js +0 -1
- package/cjs/circle-progress/style/index.js +0 -1
- package/cjs/collapse/collapse.js +30 -61
- package/cjs/collapse/group.js +20 -44
- package/cjs/collapse/index.js +0 -9
- package/cjs/collapse/style/css/index.js +0 -1
- package/cjs/collapse/style/index.js +0 -1
- package/cjs/collapse/utils.js +0 -7
- package/cjs/context-provider/index.js +18 -43
- package/cjs/context-provider/style/css/index.js +0 -1
- package/cjs/context-provider/style/index.js +0 -1
- package/cjs/count-down/hooks.js +24 -43
- package/cjs/count-down/index.js +29 -37
- package/cjs/count-down/singleton.js +2 -12
- package/cjs/count-down/style/css/index.js +0 -1
- package/cjs/count-down/style/index.js +0 -1
- package/cjs/count-down/util.js +33 -47
- package/cjs/date-picker/helper.js +7 -14
- package/cjs/date-picker/index.js +66 -167
- package/cjs/date-picker/style/css/index.js +0 -2
- package/cjs/date-picker/style/index.js +0 -2
- package/cjs/dialog/index.js +31 -57
- package/cjs/dialog/methods.js +9 -22
- package/cjs/dialog/style/css/index.js +0 -2
- package/cjs/dialog/style/index.js +0 -2
- package/cjs/divider/index.js +8 -20
- package/cjs/divider/style/css/index.js +0 -1
- package/cjs/divider/style/index.js +0 -1
- package/cjs/dropdown/dropdown.js +74 -113
- package/cjs/dropdown/index.js +1 -8
- package/cjs/dropdown/options.js +12 -28
- package/cjs/dropdown/style/css/index.js +0 -1
- package/cjs/dropdown/style/index.js +0 -1
- package/cjs/dropdown-menu/dropdown-menu.js +49 -84
- package/cjs/dropdown-menu/helper.js +4 -24
- package/cjs/dropdown-menu/index.js +0 -6
- package/cjs/dropdown-menu/style/css/index.js +0 -2
- package/cjs/dropdown-menu/style/index.js +0 -2
- package/cjs/ellipsis/components/js-ellipsis.js +32 -70
- package/cjs/ellipsis/components/native-ellipsis.js +9 -14
- package/cjs/ellipsis/index.js +19 -32
- package/cjs/ellipsis/style/css/index.js +0 -1
- package/cjs/ellipsis/style/index.js +0 -1
- package/cjs/ellipsis/utils/dom.js +0 -8
- package/cjs/ellipsis/utils/is.js +1 -5
- package/cjs/form/form-item-context.js +0 -5
- package/cjs/form/form-item.js +74 -163
- package/cjs/form/index.js +18 -38
- package/cjs/form/linked-container.js +5 -24
- package/cjs/form/style/css/index.js +0 -1
- package/cjs/form/style/index.js +0 -1
- package/cjs/form/type.d.ts +11 -1
- package/cjs/form/type.js +0 -5
- package/cjs/form/useForm.js +10 -79
- package/cjs/form/utils.js +4 -22
- package/cjs/grid/index.js +22 -45
- package/cjs/grid/style/css/index.js +0 -1
- package/cjs/grid/style/index.js +0 -1
- package/cjs/icon/IconAdd/index.js +5 -12
- package/cjs/icon/IconArrowBack/index.js +5 -12
- package/cjs/icon/IconArrowDown/index.js +5 -12
- package/cjs/icon/IconArrowIn/index.js +5 -12
- package/cjs/icon/IconArrowUp/index.js +5 -12
- package/cjs/icon/IconCheck/index.js +5 -12
- package/cjs/icon/IconCheckBold/index.js +5 -12
- package/cjs/icon/IconCircleChecked/index.js +5 -12
- package/cjs/icon/IconCircleDisabled/index.js +5 -12
- package/cjs/icon/IconCircleUnchecked/index.js +5 -12
- package/cjs/icon/IconClear/index.js +5 -12
- package/cjs/icon/IconClose/index.js +5 -12
- package/cjs/icon/IconCloseBold/index.js +5 -12
- package/cjs/icon/IconDelete/index.js +5 -12
- package/cjs/icon/IconDownload/index.js +5 -12
- package/cjs/icon/IconEdit/index.js +5 -12
- package/cjs/icon/IconErrorCircle/index.js +5 -12
- package/cjs/icon/IconEyeInvisible/index.js +5 -12
- package/cjs/icon/IconEyeVisible/index.js +5 -12
- package/cjs/icon/IconEyelashInvisible/index.js +5 -12
- package/cjs/icon/IconFile/index.js +5 -12
- package/cjs/icon/IconGift/index.js +5 -12
- package/cjs/icon/IconHeart/index.js +5 -12
- package/cjs/icon/IconHome/index.js +5 -12
- package/cjs/icon/IconKeyboard/index.js +5 -12
- package/cjs/icon/IconKeyboardDelete/index.js +5 -12
- package/cjs/icon/IconLikeCircle/index.js +5 -12
- package/cjs/icon/IconMinus/index.js +5 -12
- package/cjs/icon/IconMore/index.js +5 -12
- package/cjs/icon/IconNotice/index.js +5 -12
- package/cjs/icon/IconNoticeOff/index.js +5 -12
- package/cjs/icon/IconPicture/index.js +5 -12
- package/cjs/icon/IconPlay/index.js +5 -12
- package/cjs/icon/IconQuestionCircle/index.js +5 -12
- package/cjs/icon/IconRefresh/index.js +5 -12
- package/cjs/icon/IconSad/index.js +5 -12
- package/cjs/icon/IconScan/index.js +5 -12
- package/cjs/icon/IconSearch/index.js +5 -12
- package/cjs/icon/IconSetting/index.js +5 -12
- package/cjs/icon/IconShop/index.js +5 -12
- package/cjs/icon/IconShopping/index.js +5 -12
- package/cjs/icon/IconSmileFill/index.js +5 -12
- package/cjs/icon/IconSound/index.js +5 -12
- package/cjs/icon/IconSquareChecked/index.js +5 -12
- package/cjs/icon/IconSquareDisabled/index.js +5 -12
- package/cjs/icon/IconSquareUnchecked/index.js +5 -12
- package/cjs/icon/IconStar/index.js +5 -12
- package/cjs/icon/IconStarFill/index.js +5 -12
- package/cjs/icon/IconStarHalf/index.js +5 -12
- package/cjs/icon/IconSubway/index.js +5 -12
- package/cjs/icon/IconSuccessCircle/index.js +5 -12
- package/cjs/icon/IconTriDown/index.js +5 -12
- package/cjs/icon/IconTriUp/index.js +5 -12
- package/cjs/icon/IconUpload/index.js +5 -12
- package/cjs/icon/IconUser/index.js +5 -12
- package/cjs/icon/IconUserFill/index.js +5 -12
- package/cjs/icon/IconWarnCircle/index.js +5 -12
- package/cjs/icon/IconWarnCircleFill/index.js +5 -12
- package/cjs/icon/index.js +0 -119
- package/cjs/image/index.js +53 -94
- package/cjs/image/style/css/index.js +0 -2
- package/cjs/image/style/index.js +0 -2
- package/cjs/image-picker/add-icon.js +0 -3
- package/cjs/image-picker/index.js +32 -59
- package/cjs/image-picker/style/css/index.js +0 -3
- package/cjs/image-picker/style/index.js +0 -3
- package/cjs/image-preview/index.js +129 -254
- package/cjs/image-preview/methods.js +5 -18
- package/cjs/image-preview/style/css/index.js +0 -4
- package/cjs/image-preview/style/index.js +0 -4
- package/cjs/index-bar/context.js +0 -2
- package/cjs/index-bar/group.js +16 -35
- package/cjs/index-bar/index.js +55 -87
- package/cjs/index-bar/side-bar.js +15 -34
- package/cjs/index-bar/style/css/index.js +0 -2
- package/cjs/index-bar/style/index.js +0 -2
- package/cjs/index-bar/utils.js +3 -17
- package/cjs/index.js +0 -119
- package/cjs/input/hooks.js +45 -84
- package/cjs/input/index.js +26 -40
- package/cjs/input/style/css/index.js +0 -1
- package/cjs/input/style/index.js +0 -1
- package/cjs/keyboard/index.js +37 -73
- package/cjs/keyboard/style/css/index.js +0 -2
- package/cjs/keyboard/style/index.js +0 -2
- package/cjs/load-more/index.js +33 -65
- package/cjs/load-more/style/css/index.js +0 -1
- package/cjs/load-more/style/index.js +0 -1
- package/cjs/loading/index.js +19 -48
- package/cjs/loading/style/css/index.js +0 -1
- package/cjs/loading/style/index.js +0 -1
- package/cjs/masking/index.js +47 -80
- package/cjs/masking/methods.js +5 -21
- package/cjs/masking/style/css/index.js +0 -2
- package/cjs/masking/style/index.js +0 -2
- package/cjs/nav-bar/back-icon.js +2 -8
- package/cjs/nav-bar/index.js +37 -61
- package/cjs/nav-bar/style/css/index.js +0 -1
- package/cjs/nav-bar/style/index.js +0 -1
- package/cjs/notice-bar/index.js +34 -60
- package/cjs/notice-bar/style/css/index.js +0 -1
- package/cjs/notice-bar/style/index.js +0 -1
- package/cjs/notify/index.js +20 -49
- package/cjs/notify/methods.js +2 -17
- package/cjs/notify/style/css/index.js +0 -1
- package/cjs/notify/style/index.js +0 -1
- package/cjs/pagination/arrow.js +0 -3
- package/cjs/pagination/index.js +27 -58
- package/cjs/pagination/style/css/index.js +0 -1
- package/cjs/pagination/style/index.js +0 -1
- package/cjs/picker/index.js +48 -84
- package/cjs/picker/style/css/index.js +0 -3
- package/cjs/picker/style/index.js +0 -3
- package/cjs/picker-view/components/cascader.js +13 -32
- package/cjs/picker-view/components/multi-picker.js +8 -17
- package/cjs/picker-view/components/picker-cell.js +45 -101
- package/cjs/picker-view/index.js +30 -76
- package/cjs/picker-view/style/css/index.js +0 -1
- package/cjs/picker-view/style/index.js +0 -1
- package/cjs/popover/hooks/index.js +0 -4
- package/cjs/popover/hooks/useEvent.js +25 -49
- package/cjs/popover/hooks/usePosition.js +100 -159
- package/cjs/popover/index.js +1 -8
- package/cjs/popover/menu.js +32 -52
- package/cjs/popover/popover-inner.js +30 -48
- package/cjs/popover/popover.js +69 -101
- package/cjs/popover/style/css/index.js +0 -2
- package/cjs/popover/style/index.js +0 -2
- package/cjs/popup/index.js +22 -39
- package/cjs/popup/methods.js +0 -2
- package/cjs/popup/style/css/index.js +0 -2
- package/cjs/popup/style/index.js +0 -2
- package/cjs/popup-swiper/index.js +50 -92
- package/cjs/popup-swiper/methods.js +0 -2
- package/cjs/popup-swiper/style/css/index.js +0 -2
- package/cjs/popup-swiper/style/index.js +0 -2
- package/cjs/portal/index.js +3 -8
- package/cjs/portal/style/css/index.js +0 -1
- package/cjs/portal/style/index.js +0 -1
- package/cjs/progress/index.js +27 -44
- package/cjs/progress/style/css/index.js +0 -1
- package/cjs/progress/style/index.js +0 -1
- package/cjs/pull-refresh/android-pull-refresh.js +56 -95
- package/cjs/pull-refresh/hooks.js +11 -32
- package/cjs/pull-refresh/index.js +3 -14
- package/cjs/pull-refresh/ios-pull-refresh.js +53 -81
- package/cjs/pull-refresh/model.js +0 -1
- package/cjs/pull-refresh/style/css/index.js +0 -2
- package/cjs/pull-refresh/style/index.js +0 -2
- package/cjs/radio/group.js +20 -34
- package/cjs/radio/index.js +1 -8
- package/cjs/radio/radio.js +0 -10
- package/cjs/radio/style/css/index.js +0 -1
- package/cjs/radio/style/index.js +0 -1
- package/cjs/rate/index.js +28 -54
- package/cjs/rate/style/css/index.js +0 -1
- package/cjs/rate/style/index.js +0 -1
- package/cjs/search-bar/association.js +14 -32
- package/cjs/search-bar/cancel-button.js +8 -16
- package/cjs/search-bar/highlight.js +14 -25
- package/cjs/search-bar/index.js +77 -97
- package/cjs/search-bar/style/css/index.js +0 -1
- package/cjs/search-bar/style/index.js +0 -1
- package/cjs/show-monitor/index.js +40 -108
- package/cjs/show-monitor/style/css/index.js +0 -1
- package/cjs/show-monitor/style/index.js +0 -1
- package/cjs/skeleton/elements.js +47 -84
- package/cjs/skeleton/index.js +18 -36
- package/cjs/skeleton/skeleton-context.js +0 -4
- package/cjs/skeleton/style/css/index.js +0 -2
- package/cjs/skeleton/style/index.js +0 -2
- package/cjs/slider/hooks/index.js +0 -13
- package/cjs/slider/hooks/useSliderEvents.js +27 -59
- package/cjs/slider/hooks/useSliderIcon.js +6 -20
- package/cjs/slider/hooks/useSliderInit.js +32 -52
- package/cjs/slider/hooks/useSliderStyle.js +13 -27
- package/cjs/slider/index.js +47 -73
- package/cjs/slider/marks.js +13 -27
- package/cjs/slider/popover.js +4 -13
- package/cjs/slider/style/css/index.js +0 -2
- package/cjs/slider/style/index.js +0 -2
- package/cjs/slider/thumb.js +11 -22
- package/cjs/stepper/hooks/useButtonClick.js +15 -25
- package/cjs/stepper/hooks/useInputEvent.js +10 -19
- package/cjs/stepper/hooks/useValue.js +9 -15
- package/cjs/stepper/index.js +84 -98
- package/cjs/stepper/style/css/index.js +0 -1
- package/cjs/stepper/style/index.js +0 -1
- package/cjs/steps/index.js +25 -43
- package/cjs/steps/step.js +10 -27
- package/cjs/steps/style/css/index.js +0 -1
- package/cjs/steps/style/index.js +0 -1
- package/cjs/sticky/index.js +40 -74
- package/cjs/sticky/style/css/index.js +0 -1
- package/cjs/sticky/style/index.js +0 -1
- package/cjs/style.js +0 -59
- package/cjs/swipe-action/index.js +40 -92
- package/cjs/swipe-action/item.js +9 -17
- package/cjs/swipe-action/style/css/index.js +0 -1
- package/cjs/swipe-action/style/index.js +0 -1
- package/cjs/swipe-load/index.js +78 -113
- package/cjs/swipe-load/style/css/index.js +0 -1
- package/cjs/swipe-load/style/index.js +0 -1
- package/cjs/switch/index.js +28 -49
- package/cjs/switch/style/css/index.js +0 -1
- package/cjs/switch/style/index.js +0 -1
- package/cjs/tab-bar/index.js +0 -7
- package/cjs/tab-bar/item.js +6 -24
- package/cjs/tab-bar/style/css/index.js +0 -1
- package/cjs/tab-bar/style/index.js +0 -1
- package/cjs/tab-bar/tab-bar.js +16 -32
- package/cjs/tabs/index.js +136 -206
- package/cjs/tabs/style/css/index.js +0 -1
- package/cjs/tabs/style/index.js +0 -1
- package/cjs/tabs/tab-cell-underline.js +28 -76
- package/cjs/tabs/tab-cell.js +73 -128
- package/cjs/tabs/tab-pane.js +53 -103
- package/cjs/tag/index.js +1 -8
- package/cjs/tag/list.js +11 -26
- package/cjs/tag/style/css/index.js +0 -1
- package/cjs/tag/style/index.js +0 -1
- package/cjs/tag/tag.js +20 -32
- package/cjs/textarea/index.js +35 -56
- package/cjs/textarea/style/css/index.js +0 -2
- package/cjs/textarea/style/index.js +0 -2
- package/cjs/toast/index.js +26 -61
- package/cjs/toast/methods.js +2 -16
- package/cjs/toast/style/css/index.js +0 -3
- package/cjs/toast/style/index.js +0 -3
- package/cjs/transition/index.js +17 -29
- package/cjs/transition/style/css/index.js +0 -1
- package/cjs/transition/style/index.js +0 -1
- package/cjs/uploader/index.d.ts +1 -1
- package/cjs/uploader/index.js +28 -49
- package/cjs/uploader/style/css/index.js +0 -3
- package/cjs/uploader/style/index.js +0 -3
- package/cjs/uploader/upload/index.js +0 -4
- package/cjs/uploader/upload/upload.js +9 -45
- package/dist/index.js +3838 -6455
- package/dist/index.min.js +2 -2
- package/esm/_helpers/hooks.js +59 -123
- package/esm/_helpers/index.js +4 -6
- package/esm/_helpers/react-dom.js +0 -11
- package/esm/_helpers/render.js +5 -15
- package/esm/action-sheet/index.js +10 -16
- package/esm/avatar/group.js +12 -16
- package/esm/avatar/index.js +53 -64
- package/esm/badge/index.js +18 -22
- package/esm/button/hooks.js +15 -18
- package/esm/button/index.js +46 -57
- package/esm/carousel/index.js +153 -280
- package/esm/cell/cell.js +18 -25
- package/esm/cell/group.js +9 -11
- package/esm/cell/index.js +1 -1
- package/esm/checkbox/checkbox.js +31 -42
- package/esm/checkbox/group.js +24 -28
- package/esm/checkbox/hooks/useMergeProps.js +7 -9
- package/esm/checkbox/index.js +2 -2
- package/esm/checkbox/type.js +0 -1
- package/esm/circle-progress/index.js +37 -49
- package/esm/collapse/collapse.js +30 -51
- package/esm/collapse/group.js +20 -34
- package/esm/collapse/index.js +1 -1
- package/esm/collapse/utils.js +0 -1
- package/esm/context-provider/index.js +18 -33
- package/esm/count-down/hooks.js +24 -37
- package/esm/count-down/index.js +30 -29
- package/esm/count-down/singleton.js +2 -5
- package/esm/count-down/util.js +33 -42
- package/esm/date-picker/helper.js +7 -9
- package/esm/date-picker/index.js +66 -155
- package/esm/dialog/index.js +31 -42
- package/esm/dialog/methods.js +9 -11
- package/esm/divider/index.js +8 -12
- package/esm/dropdown/dropdown.js +74 -102
- package/esm/dropdown/index.js +1 -1
- package/esm/dropdown/options.js +12 -20
- package/esm/dropdown-menu/dropdown-menu.js +49 -74
- package/esm/dropdown-menu/helper.js +4 -14
- package/esm/dropdown-menu/index.js +1 -1
- package/esm/ellipsis/components/js-ellipsis.js +32 -60
- package/esm/ellipsis/components/native-ellipsis.js +9 -11
- package/esm/ellipsis/index.js +20 -21
- package/esm/ellipsis/utils/dom.js +0 -7
- package/esm/ellipsis/utils/is.js +1 -1
- package/esm/form/form-item.js +74 -147
- package/esm/form/index.js +18 -23
- package/esm/form/linked-container.js +5 -14
- package/esm/form/type.d.ts +11 -1
- package/esm/form/type.js +0 -5
- package/esm/form/useForm.js +10 -74
- package/esm/form/utils.js +4 -11
- package/esm/grid/index.js +22 -38
- package/esm/icon/IconAdd/index.js +5 -6
- package/esm/icon/IconArrowBack/index.js +5 -6
- package/esm/icon/IconArrowDown/index.js +5 -6
- package/esm/icon/IconArrowIn/index.js +5 -6
- package/esm/icon/IconArrowUp/index.js +5 -6
- package/esm/icon/IconCheck/index.js +5 -6
- package/esm/icon/IconCheckBold/index.js +5 -6
- package/esm/icon/IconCircleChecked/index.js +5 -6
- package/esm/icon/IconCircleDisabled/index.js +5 -6
- package/esm/icon/IconCircleUnchecked/index.js +5 -6
- package/esm/icon/IconClear/index.js +5 -6
- package/esm/icon/IconClose/index.js +5 -6
- package/esm/icon/IconCloseBold/index.js +5 -6
- package/esm/icon/IconDelete/index.js +5 -6
- package/esm/icon/IconDownload/index.js +5 -6
- package/esm/icon/IconEdit/index.js +5 -6
- package/esm/icon/IconErrorCircle/index.js +5 -6
- package/esm/icon/IconEyeInvisible/index.js +5 -6
- package/esm/icon/IconEyeVisible/index.js +5 -6
- package/esm/icon/IconEyelashInvisible/index.js +5 -6
- package/esm/icon/IconFile/index.js +5 -6
- package/esm/icon/IconGift/index.js +5 -6
- package/esm/icon/IconHeart/index.js +5 -6
- package/esm/icon/IconHome/index.js +5 -6
- package/esm/icon/IconKeyboard/index.js +5 -6
- package/esm/icon/IconKeyboardDelete/index.js +5 -6
- package/esm/icon/IconLikeCircle/index.js +5 -6
- package/esm/icon/IconMinus/index.js +5 -6
- package/esm/icon/IconMore/index.js +5 -6
- package/esm/icon/IconNotice/index.js +5 -6
- package/esm/icon/IconNoticeOff/index.js +5 -6
- package/esm/icon/IconPicture/index.js +5 -6
- package/esm/icon/IconPlay/index.js +5 -6
- package/esm/icon/IconQuestionCircle/index.js +5 -6
- package/esm/icon/IconRefresh/index.js +5 -6
- package/esm/icon/IconSad/index.js +5 -6
- package/esm/icon/IconScan/index.js +5 -6
- package/esm/icon/IconSearch/index.js +5 -6
- package/esm/icon/IconSetting/index.js +5 -6
- package/esm/icon/IconShop/index.js +5 -6
- package/esm/icon/IconShopping/index.js +5 -6
- package/esm/icon/IconSmileFill/index.js +5 -6
- package/esm/icon/IconSound/index.js +5 -6
- package/esm/icon/IconSquareChecked/index.js +5 -6
- package/esm/icon/IconSquareDisabled/index.js +5 -6
- package/esm/icon/IconSquareUnchecked/index.js +5 -6
- package/esm/icon/IconStar/index.js +5 -6
- package/esm/icon/IconStarFill/index.js +5 -6
- package/esm/icon/IconStarHalf/index.js +5 -6
- package/esm/icon/IconSubway/index.js +5 -6
- package/esm/icon/IconSuccessCircle/index.js +5 -6
- package/esm/icon/IconTriDown/index.js +5 -6
- package/esm/icon/IconTriUp/index.js +5 -6
- package/esm/icon/IconUpload/index.js +5 -6
- package/esm/icon/IconUser/index.js +5 -6
- package/esm/icon/IconUserFill/index.js +5 -6
- package/esm/icon/IconWarnCircle/index.js +5 -6
- package/esm/icon/IconWarnCircleFill/index.js +5 -6
- package/esm/image/index.js +53 -85
- package/esm/image-picker/index.js +32 -42
- package/esm/image-preview/index.js +129 -232
- package/esm/image-preview/methods.js +5 -14
- package/esm/index-bar/group.js +16 -25
- package/esm/index-bar/index.js +55 -74
- package/esm/index-bar/side-bar.js +15 -28
- package/esm/index-bar/utils.js +3 -10
- package/esm/input/hooks.js +45 -75
- package/esm/input/index.js +26 -30
- package/esm/keyboard/index.js +40 -63
- package/esm/load-more/index.js +33 -57
- package/esm/loading/index.js +19 -40
- package/esm/masking/index.js +47 -65
- package/esm/masking/methods.js +5 -16
- package/esm/nav-bar/back-icon.js +2 -4
- package/esm/nav-bar/index.js +37 -52
- package/esm/notice-bar/index.js +34 -53
- package/esm/notify/index.js +20 -33
- package/esm/notify/methods.js +2 -13
- package/esm/pagination/index.js +27 -50
- package/esm/picker/index.js +48 -69
- package/esm/picker-view/components/cascader.js +13 -24
- package/esm/picker-view/components/multi-picker.js +8 -14
- package/esm/picker-view/components/picker-cell.js +45 -93
- package/esm/picker-view/index.js +30 -60
- package/esm/popover/hooks/useEvent.js +26 -41
- package/esm/popover/hooks/usePosition.js +100 -152
- package/esm/popover/index.js +2 -2
- package/esm/popover/menu.js +32 -41
- package/esm/popover/popover-inner.js +30 -39
- package/esm/popover/popover.js +69 -90
- package/esm/popup/index.js +22 -25
- package/esm/popup-swiper/index.js +50 -76
- package/esm/portal/index.js +3 -5
- package/esm/progress/index.js +27 -36
- package/esm/pull-refresh/android-pull-refresh.js +56 -83
- package/esm/pull-refresh/hooks.js +11 -23
- package/esm/pull-refresh/index.js +3 -5
- package/esm/pull-refresh/ios-pull-refresh.js +53 -68
- package/esm/pull-refresh/model.js +0 -1
- package/esm/radio/group.js +20 -24
- package/esm/radio/index.js +2 -2
- package/esm/rate/index.js +28 -43
- package/esm/search-bar/association.js +14 -27
- package/esm/search-bar/cancel-button.js +8 -11
- package/esm/search-bar/highlight.js +14 -20
- package/esm/search-bar/index.js +77 -86
- package/esm/show-monitor/index.js +40 -100
- package/esm/skeleton/elements.js +47 -75
- package/esm/skeleton/index.js +18 -24
- package/esm/slider/hooks/useSliderEvents.js +27 -54
- package/esm/slider/hooks/useSliderIcon.js +6 -13
- package/esm/slider/hooks/useSliderInit.js +32 -46
- package/esm/slider/hooks/useSliderStyle.js +13 -22
- package/esm/slider/index.js +47 -63
- package/esm/slider/marks.js +13 -19
- package/esm/slider/popover.js +4 -6
- package/esm/slider/thumb.js +11 -16
- package/esm/stepper/hooks/useButtonClick.js +15 -24
- package/esm/stepper/hooks/useInputEvent.js +10 -17
- package/esm/stepper/hooks/useValue.js +9 -12
- package/esm/stepper/index.js +84 -84
- package/esm/steps/index.js +25 -30
- package/esm/steps/step.js +10 -19
- package/esm/sticky/index.js +40 -65
- package/esm/swipe-action/index.js +40 -80
- package/esm/swipe-action/item.js +9 -12
- package/esm/swipe-load/index.js +79 -104
- package/esm/switch/index.js +28 -41
- package/esm/tab-bar/index.js +0 -1
- package/esm/tab-bar/item.js +6 -13
- package/esm/tab-bar/tab-bar.js +16 -22
- package/esm/tabs/index.js +137 -194
- package/esm/tabs/tab-cell-underline.js +28 -67
- package/esm/tabs/tab-cell.js +73 -118
- package/esm/tabs/tab-pane.js +53 -95
- package/esm/tag/index.js +2 -2
- package/esm/tag/list.js +11 -16
- package/esm/tag/tag.js +20 -22
- package/esm/textarea/index.js +35 -46
- package/esm/toast/index.js +26 -42
- package/esm/toast/methods.js +2 -12
- package/esm/transition/index.js +17 -20
- package/esm/uploader/index.d.ts +1 -1
- package/esm/uploader/index.js +28 -34
- package/esm/uploader/upload/upload.js +9 -38
- package/esnext/form/form-item.js +12 -7
- package/esnext/form/type.d.ts +11 -1
- package/esnext/uploader/index.d.ts +1 -1
- package/esnext/uploader/index.js +1 -1
- package/esnext/uploader/upload/upload.js +1 -1
- package/package.json +5 -3
- package/tokens/app/arcodesign/default/index.js +0 -2
- package/umd/_helpers/hooks.js +59 -138
- package/umd/_helpers/index.js +2 -9
- package/umd/_helpers/react-dom.js +0 -13
- package/umd/_helpers/render.js +5 -17
- package/umd/action-sheet/index.js +10 -22
- package/umd/action-sheet/methods.js +0 -1
- package/umd/avatar/group.js +12 -20
- package/umd/avatar/index.js +53 -70
- package/umd/badge/index.js +18 -25
- package/umd/button/hooks.js +15 -19
- package/umd/button/index.js +46 -60
- package/umd/carousel/index.js +153 -283
- package/umd/cell/arrow.js +0 -2
- package/umd/cell/cell.js +18 -29
- package/umd/cell/group.js +9 -17
- package/umd/cell/index.js +1 -2
- package/umd/checkbox/checkbox.js +31 -45
- package/umd/checkbox/group.js +24 -34
- package/umd/checkbox/hooks/useMergeProps.js +7 -12
- package/umd/checkbox/index.js +1 -3
- package/umd/checkbox/type.js +0 -2
- package/umd/circle-progress/index.js +37 -52
- package/umd/collapse/collapse.js +30 -55
- package/umd/collapse/group.js +20 -38
- package/umd/collapse/index.js +0 -3
- package/umd/collapse/utils.js +0 -5
- package/umd/context-provider/index.js +18 -38
- package/umd/count-down/hooks.js +24 -39
- package/umd/count-down/index.js +29 -31
- package/umd/count-down/singleton.js +2 -10
- package/umd/count-down/util.js +33 -47
- package/umd/date-picker/helper.js +7 -13
- package/umd/date-picker/index.js +66 -158
- package/umd/dialog/index.js +31 -47
- package/umd/dialog/methods.js +9 -18
- package/umd/divider/index.js +8 -15
- package/umd/dropdown/dropdown.js +74 -106
- package/umd/dropdown/index.js +1 -3
- package/umd/dropdown/options.js +12 -24
- package/umd/dropdown-menu/dropdown-menu.js +49 -78
- package/umd/dropdown-menu/helper.js +4 -22
- package/umd/dropdown-menu/index.js +0 -2
- package/umd/ellipsis/components/js-ellipsis.js +32 -66
- package/umd/ellipsis/components/native-ellipsis.js +9 -12
- package/umd/ellipsis/index.js +19 -24
- package/umd/ellipsis/utils/dom.js +0 -8
- package/umd/ellipsis/utils/is.js +1 -5
- package/umd/form/form-item-context.js +0 -3
- package/umd/form/form-item.js +74 -151
- package/umd/form/index.js +18 -28
- package/umd/form/linked-container.js +5 -19
- package/umd/form/type.d.ts +11 -1
- package/umd/form/type.js +0 -5
- package/umd/form/useForm.js +10 -74
- package/umd/form/utils.js +4 -19
- package/umd/grid/index.js +22 -41
- package/umd/icon/IconAdd/index.js +5 -7
- package/umd/icon/IconArrowBack/index.js +5 -7
- package/umd/icon/IconArrowDown/index.js +5 -7
- package/umd/icon/IconArrowIn/index.js +5 -7
- package/umd/icon/IconArrowUp/index.js +5 -7
- package/umd/icon/IconCheck/index.js +5 -7
- package/umd/icon/IconCheckBold/index.js +5 -7
- package/umd/icon/IconCircleChecked/index.js +5 -7
- package/umd/icon/IconCircleDisabled/index.js +5 -7
- package/umd/icon/IconCircleUnchecked/index.js +5 -7
- package/umd/icon/IconClear/index.js +5 -7
- package/umd/icon/IconClose/index.js +5 -7
- package/umd/icon/IconCloseBold/index.js +5 -7
- package/umd/icon/IconDelete/index.js +5 -7
- package/umd/icon/IconDownload/index.js +5 -7
- package/umd/icon/IconEdit/index.js +5 -7
- package/umd/icon/IconErrorCircle/index.js +5 -7
- package/umd/icon/IconEyeInvisible/index.js +5 -7
- package/umd/icon/IconEyeVisible/index.js +5 -7
- package/umd/icon/IconEyelashInvisible/index.js +5 -7
- package/umd/icon/IconFile/index.js +5 -7
- package/umd/icon/IconGift/index.js +5 -7
- package/umd/icon/IconHeart/index.js +5 -7
- package/umd/icon/IconHome/index.js +5 -7
- package/umd/icon/IconKeyboard/index.js +5 -7
- package/umd/icon/IconKeyboardDelete/index.js +5 -7
- package/umd/icon/IconLikeCircle/index.js +5 -7
- package/umd/icon/IconMinus/index.js +5 -7
- package/umd/icon/IconMore/index.js +5 -7
- package/umd/icon/IconNotice/index.js +5 -7
- package/umd/icon/IconNoticeOff/index.js +5 -7
- package/umd/icon/IconPicture/index.js +5 -7
- package/umd/icon/IconPlay/index.js +5 -7
- package/umd/icon/IconQuestionCircle/index.js +5 -7
- package/umd/icon/IconRefresh/index.js +5 -7
- package/umd/icon/IconSad/index.js +5 -7
- package/umd/icon/IconScan/index.js +5 -7
- package/umd/icon/IconSearch/index.js +5 -7
- package/umd/icon/IconSetting/index.js +5 -7
- package/umd/icon/IconShop/index.js +5 -7
- package/umd/icon/IconShopping/index.js +5 -7
- package/umd/icon/IconSmileFill/index.js +5 -7
- package/umd/icon/IconSound/index.js +5 -7
- package/umd/icon/IconSquareChecked/index.js +5 -7
- package/umd/icon/IconSquareDisabled/index.js +5 -7
- package/umd/icon/IconSquareUnchecked/index.js +5 -7
- package/umd/icon/IconStar/index.js +5 -7
- package/umd/icon/IconStarFill/index.js +5 -7
- package/umd/icon/IconStarHalf/index.js +5 -7
- package/umd/icon/IconSubway/index.js +5 -7
- package/umd/icon/IconSuccessCircle/index.js +5 -7
- package/umd/icon/IconTriDown/index.js +5 -7
- package/umd/icon/IconTriUp/index.js +5 -7
- package/umd/icon/IconUpload/index.js +5 -7
- package/umd/icon/IconUser/index.js +5 -7
- package/umd/icon/IconUserFill/index.js +5 -7
- package/umd/icon/IconWarnCircle/index.js +5 -7
- package/umd/icon/IconWarnCircleFill/index.js +5 -7
- package/umd/icon/index.js +0 -1
- package/umd/image/index.js +53 -88
- package/umd/image-picker/add-icon.js +0 -2
- package/umd/image-picker/index.js +32 -47
- package/umd/image-preview/index.js +129 -239
- package/umd/image-preview/methods.js +5 -15
- package/umd/index-bar/group.js +16 -30
- package/umd/index-bar/index.js +55 -79
- package/umd/index-bar/side-bar.js +15 -32
- package/umd/index-bar/utils.js +3 -16
- package/umd/index.js +0 -1
- package/umd/input/hooks.js +45 -79
- package/umd/input/index.js +26 -35
- package/umd/keyboard/index.js +37 -64
- package/umd/load-more/index.js +33 -60
- package/umd/loading/index.js +19 -43
- package/umd/masking/index.js +47 -72
- package/umd/masking/methods.js +5 -18
- package/umd/nav-bar/back-icon.js +2 -5
- package/umd/nav-bar/index.js +37 -55
- package/umd/notice-bar/index.js +34 -56
- package/umd/notify/index.js +20 -40
- package/umd/notify/methods.js +2 -14
- package/umd/pagination/arrow.js +0 -2
- package/umd/pagination/index.js +27 -53
- package/umd/picker/index.js +48 -73
- package/umd/picker-view/components/cascader.js +13 -28
- package/umd/picker-view/components/multi-picker.js +8 -16
- package/umd/picker-view/components/picker-cell.js +45 -97
- package/umd/picker-view/index.js +30 -63
- package/umd/popover/hooks/useEvent.js +25 -44
- package/umd/popover/hooks/usePosition.js +100 -153
- package/umd/popover/index.js +1 -3
- package/umd/popover/menu.js +32 -45
- package/umd/popover/popover-inner.js +30 -43
- package/umd/popover/popover.js +69 -94
- package/umd/popup/index.js +22 -31
- package/umd/popup/methods.js +0 -1
- package/umd/popup-swiper/index.js +50 -83
- package/umd/popup-swiper/methods.js +0 -1
- package/umd/portal/index.js +3 -6
- package/umd/progress/index.js +27 -39
- package/umd/pull-refresh/android-pull-refresh.js +56 -86
- package/umd/pull-refresh/hooks.js +11 -29
- package/umd/pull-refresh/index.js +3 -7
- package/umd/pull-refresh/ios-pull-refresh.js +53 -72
- package/umd/pull-refresh/model.js +0 -1
- package/umd/radio/group.js +20 -30
- package/umd/radio/index.js +1 -3
- package/umd/radio/radio.js +0 -5
- package/umd/rate/index.js +28 -48
- package/umd/search-bar/association.js +14 -29
- package/umd/search-bar/cancel-button.js +8 -14
- package/umd/search-bar/highlight.js +14 -21
- package/umd/search-bar/index.js +77 -87
- package/umd/show-monitor/index.js +40 -104
- package/umd/skeleton/elements.js +47 -78
- package/umd/skeleton/index.js +18 -28
- package/umd/skeleton/skeleton-context.js +0 -3
- package/umd/slider/hooks/index.js +0 -4
- package/umd/slider/hooks/useSliderEvents.js +27 -55
- package/umd/slider/hooks/useSliderIcon.js +6 -17
- package/umd/slider/hooks/useSliderInit.js +32 -50
- package/umd/slider/hooks/useSliderStyle.js +13 -24
- package/umd/slider/index.js +47 -66
- package/umd/slider/marks.js +13 -22
- package/umd/slider/popover.js +4 -10
- package/umd/slider/thumb.js +11 -18
- package/umd/stepper/hooks/useButtonClick.js +15 -24
- package/umd/stepper/hooks/useInputEvent.js +10 -18
- package/umd/stepper/hooks/useValue.js +9 -13
- package/umd/stepper/index.js +84 -89
- package/umd/steps/index.js +25 -35
- package/umd/steps/step.js +10 -22
- package/umd/sticky/index.js +40 -68
- package/umd/style.js +1 -1
- package/umd/swipe-action/index.js +40 -84
- package/umd/swipe-action/item.js +9 -14
- package/umd/swipe-load/index.js +78 -106
- package/umd/switch/index.js +28 -45
- package/umd/tab-bar/index.js +0 -2
- package/umd/tab-bar/item.js +6 -19
- package/umd/tab-bar/tab-bar.js +16 -27
- package/umd/tabs/index.js +136 -197
- package/umd/tabs/tab-cell-underline.js +28 -71
- package/umd/tabs/tab-cell.js +73 -122
- package/umd/tabs/tab-pane.js +53 -98
- package/umd/tag/index.js +1 -3
- package/umd/tag/list.js +11 -20
- package/umd/tag/tag.js +20 -26
- package/umd/textarea/index.js +35 -51
- package/umd/toast/index.js +26 -49
- package/umd/toast/methods.js +2 -13
- package/umd/transition/index.js +16 -22
- package/umd/uploader/index.d.ts +1 -1
- package/umd/uploader/index.js +28 -39
- package/umd/uploader/upload/upload.js +9 -43
|
@@ -1,105 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
exports.__esModule = true;
|
|
6
5
|
var _exportNames = {
|
|
7
6
|
methodsGenerator: true
|
|
8
7
|
};
|
|
9
8
|
exports.default = void 0;
|
|
10
9
|
exports.methodsGenerator = methodsGenerator;
|
|
11
|
-
|
|
12
10
|
var _extends5 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
15
|
-
|
|
16
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
13
|
var _mobileUtils = require("@arco-design/mobile-utils");
|
|
19
|
-
|
|
20
14
|
var _transformable = _interopRequireDefault(require("@arco-design/transformable"));
|
|
21
|
-
|
|
22
15
|
var _contextProvider = require("../context-provider");
|
|
23
|
-
|
|
24
16
|
var _carousel = _interopRequireDefault(require("../carousel"));
|
|
25
|
-
|
|
26
17
|
var _transition = _interopRequireDefault(require("../transition"));
|
|
27
|
-
|
|
28
18
|
var _image = _interopRequireDefault(require("../image"));
|
|
29
|
-
|
|
30
19
|
var _helpers = require("../_helpers");
|
|
31
|
-
|
|
32
20
|
var _portal = _interopRequireDefault(require("../portal"));
|
|
33
|
-
|
|
34
21
|
var _methods = require("./methods");
|
|
35
|
-
|
|
36
22
|
Object.keys(_methods).forEach(function (key) {
|
|
37
23
|
if (key === "default" || key === "__esModule") return;
|
|
38
24
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
39
25
|
if (key in exports && exports[key] === _methods[key]) return;
|
|
40
26
|
exports[key] = _methods[key];
|
|
41
27
|
});
|
|
42
|
-
|
|
43
28
|
var _loading = _interopRequireDefault(require("../loading"));
|
|
44
|
-
|
|
45
29
|
var _excluded = ["style", "className", "images", "loop", "openIndex", "fit", "noselect", "displayDuration", "spaceBetween", "showLoading", "loadingArea", "errorArea", "showError", "retryTime", "staticLabel", "replaceFallbackWhenLoaded", "scrollBezier", "lazyloadCount", "swipeToClose", "extra", "getMinScale", "getMaxScale", "getDoubleClickScale", "getContainer", "getThumbBounds", "renderIndicator", "onChange", "onAfterChange", "onImageClick", "onImageDoubleClick", "onImageLongTap", "close", "onClose", "onTouchStart", "onTouchMove", "onTouchEnd", "indicatorPos"];
|
|
46
|
-
|
|
47
30
|
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); }
|
|
48
|
-
|
|
49
31
|
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; }
|
|
50
|
-
|
|
51
32
|
var MAX_ZOOM = 5;
|
|
52
33
|
var MIN_ZOOM = 0.7;
|
|
53
34
|
var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
54
35
|
var _imagesStatus$openInd, _imagesStatus$openInd2;
|
|
55
|
-
|
|
56
36
|
var style = props.style,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
37
|
+
className = props.className,
|
|
38
|
+
images = props.images,
|
|
39
|
+
_props$loop = props.loop,
|
|
40
|
+
loop = _props$loop === void 0 ? false : _props$loop,
|
|
41
|
+
openIndex = props.openIndex,
|
|
42
|
+
fit = props.fit,
|
|
43
|
+
_props$noselect = props.noselect,
|
|
44
|
+
noselect = _props$noselect === void 0 ? true : _props$noselect,
|
|
45
|
+
_props$displayDuratio = props.displayDuration,
|
|
46
|
+
displayDuration = _props$displayDuratio === void 0 ? 350 : _props$displayDuratio,
|
|
47
|
+
_props$spaceBetween = props.spaceBetween,
|
|
48
|
+
spaceBetween = _props$spaceBetween === void 0 ? 0 : _props$spaceBetween,
|
|
49
|
+
_props$showLoading = props.showLoading,
|
|
50
|
+
showLoading = _props$showLoading === void 0 ? true : _props$showLoading,
|
|
51
|
+
loadingArea = props.loadingArea,
|
|
52
|
+
errorArea = props.errorArea,
|
|
53
|
+
_props$showError = props.showError,
|
|
54
|
+
showError = _props$showError === void 0 ? true : _props$showError,
|
|
55
|
+
retryTime = props.retryTime,
|
|
56
|
+
staticLabel = props.staticLabel,
|
|
57
|
+
replaceFallbackWhenLoaded = props.replaceFallbackWhenLoaded,
|
|
58
|
+
scrollBezier = props.scrollBezier,
|
|
59
|
+
_props$lazyloadCount = props.lazyloadCount,
|
|
60
|
+
lazyloadCount = _props$lazyloadCount === void 0 ? 1 : _props$lazyloadCount,
|
|
61
|
+
_props$swipeToClose = props.swipeToClose,
|
|
62
|
+
swipeToClose = _props$swipeToClose === void 0 ? true : _props$swipeToClose,
|
|
63
|
+
extra = props.extra,
|
|
64
|
+
getMinScale = props.getMinScale,
|
|
65
|
+
getMaxScale = props.getMaxScale,
|
|
66
|
+
getDoubleClickScale = props.getDoubleClickScale,
|
|
67
|
+
getContainer = props.getContainer,
|
|
68
|
+
getThumbBounds = props.getThumbBounds,
|
|
69
|
+
renderIndicator = props.renderIndicator,
|
|
70
|
+
_onChange = props.onChange,
|
|
71
|
+
_onAfterChange = props.onAfterChange,
|
|
72
|
+
onImageClick = props.onImageClick,
|
|
73
|
+
onImageDoubleClick = props.onImageDoubleClick,
|
|
74
|
+
onImageLongTap = props.onImageLongTap,
|
|
75
|
+
close = props.close,
|
|
76
|
+
onClose = props.onClose,
|
|
77
|
+
onTouchStart = props.onTouchStart,
|
|
78
|
+
onTouchMove = props.onTouchMove,
|
|
79
|
+
onTouchEnd = props.onTouchEnd,
|
|
80
|
+
_props$indicatorPos = props.indicatorPos,
|
|
81
|
+
indicatorPos = _props$indicatorPos === void 0 ? 'start' : _props$indicatorPos,
|
|
82
|
+
otherProps = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
103
83
|
var system = (0, _helpers.useSystem)();
|
|
104
84
|
var domRef = (0, _react.useRef)(null);
|
|
105
85
|
var imagesRef = (0, _react.useRef)([]);
|
|
@@ -118,28 +98,22 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
118
98
|
var lastScaleRef = (0, _react.useRef)(0);
|
|
119
99
|
var closingRef = (0, _react.useRef)(false);
|
|
120
100
|
var isInitialMount = (0, _react.useRef)(false);
|
|
121
|
-
|
|
122
101
|
var _useState = (0, _react.useState)({}),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
102
|
+
showPlaceholders = _useState[0],
|
|
103
|
+
setPlaceholders = _useState[1];
|
|
126
104
|
var _useRefState = (0, _helpers.useRefState)([]),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
105
|
+
imagesStatus = _useRefState[0],
|
|
106
|
+
imagesStatusRef = _useRefState[1],
|
|
107
|
+
setImagesStatus = _useRefState[2];
|
|
131
108
|
var _useState2 = (0, _react.useState)(null),
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
109
|
+
transImageInfo = _useState2[0],
|
|
110
|
+
setTransImageInfo = _useState2[1];
|
|
135
111
|
var openLoaded = (_imagesStatus$openInd = imagesStatus[openIndex]) == null ? void 0 : _imagesStatus$openInd.loaded;
|
|
136
112
|
var openAnimated = (_imagesStatus$openInd2 = imagesStatus[openIndex]) == null ? void 0 : _imagesStatus$openInd2.animated;
|
|
137
113
|
var visible = openIndex >= 0 && openIndex < images.length;
|
|
138
|
-
|
|
139
114
|
var _useWindowSize = (0, _helpers.useWindowSize)(true),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
115
|
+
windowWidth = _useWindowSize.windowWidth,
|
|
116
|
+
windowHeight = _useWindowSize.windowHeight;
|
|
143
117
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
144
118
|
return {
|
|
145
119
|
dom: domRef.current,
|
|
@@ -156,7 +130,6 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
156
130
|
carouselRef.current && carouselRef.current.changeIndex(openIndex, true);
|
|
157
131
|
setImagesStatus(images.map(function (_, index) {
|
|
158
132
|
var _imagesStatusRef$curr;
|
|
159
|
-
|
|
160
133
|
return {
|
|
161
134
|
firstLoaded: ((_imagesStatusRef$curr = imagesStatusRef.current[index]) == null ? void 0 : _imagesStatusRef$curr.firstLoaded) || false,
|
|
162
135
|
animated: index !== openIndex
|
|
@@ -167,18 +140,18 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
167
140
|
// 移除长按事件监听
|
|
168
141
|
// @en Remove long press event listener
|
|
169
142
|
longTimerRef.current && clearTimeout(longTimerRef.current);
|
|
170
|
-
longTapCheckingRef.current = false;
|
|
143
|
+
longTapCheckingRef.current = false;
|
|
144
|
+
// 图片状态重置
|
|
171
145
|
// @en Reset image state
|
|
172
|
-
|
|
173
146
|
setImagesStatus(imagesStatusRef.current.map(function (status) {
|
|
174
147
|
return (0, _extends5.default)({}, status, {
|
|
175
148
|
animated: false,
|
|
176
149
|
loaded: false
|
|
177
150
|
});
|
|
178
151
|
}));
|
|
179
|
-
transformersRef.current = [];
|
|
152
|
+
transformersRef.current = [];
|
|
153
|
+
// 移除过渡图片
|
|
180
154
|
// @en Remove transition image
|
|
181
|
-
|
|
182
155
|
removeChild(transImageRef.current);
|
|
183
156
|
setTransImageInfo(null);
|
|
184
157
|
setPlaceholders({});
|
|
@@ -187,7 +160,6 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
187
160
|
mounted && onClose && onClose();
|
|
188
161
|
}, displayDuration);
|
|
189
162
|
}
|
|
190
|
-
|
|
191
163
|
isInitialMount.current = true;
|
|
192
164
|
}, [visible]);
|
|
193
165
|
(0, _react.useEffect)(function () {
|
|
@@ -219,38 +191,32 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
219
191
|
transformer && transformer.setMaxScale(getImageMaxScale(index));
|
|
220
192
|
});
|
|
221
193
|
}, [getMaxScale]);
|
|
222
|
-
|
|
223
194
|
function removeChild(child) {
|
|
224
195
|
try {
|
|
225
196
|
var _domRef$current, _domRef$current$query, _domRef$current$query2;
|
|
226
|
-
|
|
227
197
|
child && ((_domRef$current = domRef.current) == null ? void 0 : (_domRef$current$query = _domRef$current.querySelectorAll('.carousel-item')) == null ? void 0 : (_domRef$current$query2 = _domRef$current$query[innerIndexRef.current]) == null ? void 0 : _domRef$current$query2.removeChild(child));
|
|
228
198
|
} catch (e) {}
|
|
229
|
-
}
|
|
230
|
-
// @en Monitor the operation of sliding out after sliding to the upper and lower edges, then close the popup
|
|
231
|
-
|
|
199
|
+
}
|
|
232
200
|
|
|
201
|
+
// 监听滑动到上下边缘后还在往外滑动的操作,则关闭弹窗
|
|
202
|
+
// @en Monitor the operation of sliding out after sliding to the upper and lower edges, then close the popup
|
|
233
203
|
function handlePreventCallback(_, dir) {
|
|
234
204
|
if (!isTransforming() && dir === 'y') {
|
|
235
205
|
touchingSideDisRef.current += 1;
|
|
236
206
|
}
|
|
237
207
|
}
|
|
208
|
+
|
|
238
209
|
/**
|
|
239
210
|
* 缩放插件初始化
|
|
240
211
|
* @en Zoom plugin initialization
|
|
241
212
|
*/
|
|
242
|
-
|
|
243
|
-
|
|
244
213
|
function initTransformer(index) {
|
|
245
214
|
var _imagesRef$current$in;
|
|
246
|
-
|
|
247
215
|
var imageDom = (_imagesRef$current$in = imagesRef.current[index]) == null ? void 0 : _imagesRef$current$in.dom;
|
|
248
216
|
var wrapDom = imageDom == null ? void 0 : imageDom.parentElement;
|
|
249
|
-
|
|
250
217
|
if (!imageDom || !wrapDom) {
|
|
251
218
|
return;
|
|
252
219
|
}
|
|
253
|
-
|
|
254
220
|
if (transformersRef.current[index]) {
|
|
255
221
|
transformersRef.current[index].setDom(wrapDom);
|
|
256
222
|
} else {
|
|
@@ -270,16 +236,15 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
270
236
|
},
|
|
271
237
|
onTransform: function onTransform() {
|
|
272
238
|
var _transformersRef$curr, _imagesStatusRef$curr2, _imagesStatusRef$curr3;
|
|
273
|
-
|
|
274
239
|
// 图片放大再缩小,解决ios图片放大后模糊的问题
|
|
275
240
|
// @en The image is zoomed in and then zoomed out to solve the problem of blurring after zooming in on ios images
|
|
276
241
|
var img = imageDomsRef.current[index];
|
|
277
242
|
var trans = ((_transformersRef$curr = transformersRef.current[index]) == null ? void 0 : _transformersRef$curr.getTransform == null ? void 0 : _transformersRef$curr.getTransform()) || {};
|
|
278
243
|
var width = (_imagesStatusRef$curr2 = imagesStatusRef.current[index]) == null ? void 0 : _imagesStatusRef$curr2.originWidth;
|
|
279
244
|
var height = (_imagesStatusRef$curr3 = imagesStatusRef.current[index]) == null ? void 0 : _imagesStatusRef$curr3.originHeight;
|
|
280
|
-
var scale = trans.scale || 1;
|
|
245
|
+
var scale = trans.scale || 1;
|
|
246
|
+
// 判断下只有图片缩放发生改变时重写图片样式
|
|
281
247
|
// @en It is judged that only the image style is rewritten when the zoom of the image changes.
|
|
282
|
-
|
|
283
248
|
if (img && width && height && lastScaleRef.current !== scale) {
|
|
284
249
|
lastScaleRef.current = scale;
|
|
285
250
|
var atCenter = !imageHasOverflow(img) ? ' translateY(-50%)' : '';
|
|
@@ -298,23 +263,18 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
298
263
|
onZoomEnd: function onZoomEnd(_1, _2, pinchStartCenter) {
|
|
299
264
|
setPlaceholders(function (holders) {
|
|
300
265
|
var _extends2;
|
|
301
|
-
|
|
302
266
|
return (0, _extends5.default)({}, holders, (_extends2 = {}, _extends2[index] = false, _extends2));
|
|
303
267
|
});
|
|
304
268
|
var image = imageDomsRef.current[index];
|
|
305
269
|
var transformer = transformersRef.current[index];
|
|
306
|
-
|
|
307
270
|
if (!image || !transformer || transformer.getTransform().scale < 1) {
|
|
308
271
|
return;
|
|
309
272
|
}
|
|
310
|
-
|
|
311
273
|
var imageRect = image.getBoundingClientRect();
|
|
312
|
-
|
|
313
274
|
if (imageRect.width > windowWidth && imageRect.height > windowHeight) {
|
|
314
275
|
if (pinchStartCenter && pinchStartCenter.length) {
|
|
315
276
|
transformer.setCenter.apply(transformer, pinchStartCenter);
|
|
316
277
|
}
|
|
317
|
-
|
|
318
278
|
transformer.setFixedX(false);
|
|
319
279
|
transformer.setFixedY(false);
|
|
320
280
|
} else if (imageRect.height <= windowHeight) {
|
|
@@ -333,165 +293,134 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
333
293
|
maxScale: getImageMaxScale(index)
|
|
334
294
|
});
|
|
335
295
|
}
|
|
336
|
-
|
|
337
296
|
setOriginBoundary(index);
|
|
338
297
|
}
|
|
339
|
-
|
|
340
298
|
function imageHasOverflow(img) {
|
|
341
299
|
return Boolean(img && !img.classList.contains('preview-fit-contain-y'));
|
|
342
300
|
}
|
|
343
|
-
|
|
344
301
|
function setOriginBoundary(index) {
|
|
345
302
|
var imageEle = imagesRef.current[index];
|
|
346
|
-
var imageDom = imageEle == null ? void 0 : imageEle.dom;
|
|
303
|
+
var imageDom = imageEle == null ? void 0 : imageEle.dom;
|
|
304
|
+
// 边界范围变为图片范围和容器范围的并集
|
|
347
305
|
// @en The bounding range becomes the union of the image range and the container range
|
|
348
|
-
|
|
349
306
|
if (imageDom != null && imageDom.parentElement && imageEle != null && imageEle.image) {
|
|
350
|
-
var
|
|
351
|
-
|
|
307
|
+
var rect = imageEle.image.getBoundingClientRect();
|
|
352
308
|
var eleRect = imageDom.parentElement.getBoundingClientRect();
|
|
353
|
-
|
|
354
309
|
if (transformersRef.current[index]) {
|
|
355
310
|
transformersRef.current[index].setBoundary({
|
|
356
|
-
left: Math.min(
|
|
357
|
-
right: Math.max(
|
|
358
|
-
top: Math.min(
|
|
359
|
-
bottom: Math.max(
|
|
311
|
+
left: Math.min(rect.left, eleRect.left),
|
|
312
|
+
right: Math.max(rect.right, eleRect.right),
|
|
313
|
+
top: Math.min(rect.top, eleRect.top),
|
|
314
|
+
bottom: Math.max(rect.bottom, eleRect.bottom)
|
|
360
315
|
}, true);
|
|
361
316
|
}
|
|
362
317
|
}
|
|
363
318
|
}
|
|
319
|
+
|
|
364
320
|
/**
|
|
365
321
|
* 获取最小缩放倍数
|
|
366
322
|
* @en Get the minimum zoom factor
|
|
367
323
|
*/
|
|
368
|
-
|
|
369
|
-
|
|
370
324
|
function getImageMinScale(index) {
|
|
371
325
|
var currentIndex = index === void 0 ? innerIndexRef.current : index;
|
|
372
326
|
var imageDom = imageDomsRef.current[currentIndex];
|
|
373
|
-
|
|
374
327
|
if (!imageDom) {
|
|
375
328
|
return 1;
|
|
376
329
|
}
|
|
377
|
-
|
|
378
330
|
if (getMinScale) {
|
|
379
331
|
return getMinScale(imageDom, currentIndex);
|
|
380
332
|
}
|
|
381
|
-
|
|
382
333
|
return MIN_ZOOM;
|
|
383
334
|
}
|
|
335
|
+
|
|
384
336
|
/**
|
|
385
337
|
* 获取最大缩放倍数
|
|
386
338
|
* @en Get the maximum zoom factor
|
|
387
339
|
*/
|
|
388
|
-
|
|
389
|
-
|
|
390
340
|
function getImageMaxScale(index) {
|
|
391
341
|
var currentIndex = index === void 0 ? innerIndexRef.current : index;
|
|
392
342
|
var imageDom = imageDomsRef.current[currentIndex];
|
|
393
|
-
|
|
394
343
|
if (!imageDom) {
|
|
395
344
|
return 1;
|
|
396
345
|
}
|
|
397
|
-
|
|
398
346
|
if (getMaxScale) {
|
|
399
347
|
return getMaxScale(imageDom, currentIndex);
|
|
400
348
|
}
|
|
401
|
-
|
|
402
349
|
var imageWidth = imageDom.naturalWidth;
|
|
403
350
|
var imageHeight = imageDom.naturalHeight;
|
|
404
351
|
var maxScale = 1;
|
|
405
|
-
|
|
406
352
|
if (imageWidth > imageHeight) {
|
|
407
353
|
maxScale = imageWidth / windowWidth * MAX_ZOOM;
|
|
408
354
|
} else {
|
|
409
355
|
maxScale = Math.max(MAX_ZOOM, imageWidth / windowWidth);
|
|
410
356
|
}
|
|
411
|
-
|
|
412
357
|
return maxScale;
|
|
413
358
|
}
|
|
359
|
+
|
|
414
360
|
/**
|
|
415
361
|
* 计算双击时图片缩放倍数
|
|
416
362
|
* @en Calculate the zoom factor of the image when double-clicking
|
|
417
363
|
*/
|
|
418
|
-
|
|
419
|
-
|
|
420
364
|
function getImageDoubleClickScale(currentScale) {
|
|
421
365
|
var index = innerIndexRef.current;
|
|
422
366
|
var imageDom = imageDomsRef.current[index];
|
|
423
|
-
|
|
424
367
|
if (!imageDom) {
|
|
425
368
|
return 1;
|
|
426
369
|
}
|
|
427
|
-
|
|
428
370
|
var maxScale = getImageMaxScale(index);
|
|
429
|
-
|
|
430
371
|
if (getDoubleClickScale) {
|
|
431
372
|
return getDoubleClickScale(currentScale, maxScale, imageDom, index);
|
|
432
373
|
}
|
|
433
|
-
|
|
434
374
|
var imageWidth = imageDom.naturalWidth;
|
|
435
375
|
var imageHeight = imageDom.naturalHeight;
|
|
436
376
|
var fitScale = imageWidth > imageHeight ? imageWidth / windowWidth * windowHeight / imageHeight : 1;
|
|
437
377
|
var dblScale = 2;
|
|
438
|
-
|
|
439
378
|
if (fitScale >= 2) {
|
|
440
379
|
dblScale = Math.min(maxScale, fitScale);
|
|
441
380
|
}
|
|
442
|
-
|
|
443
381
|
var current = Number(currentScale.toFixed(3));
|
|
444
382
|
var dbl = Number(dblScale.toFixed(3));
|
|
445
383
|
return current >= 1 && current < dbl ? dbl : 1;
|
|
446
384
|
}
|
|
385
|
+
|
|
447
386
|
/**
|
|
448
387
|
* 还原缩放至原始位置
|
|
449
388
|
* @en Revert zoom to original position
|
|
450
389
|
*/
|
|
451
|
-
|
|
452
|
-
|
|
453
390
|
function restoreTransformer(index) {
|
|
454
391
|
var transformer = transformersRef.current[index];
|
|
455
|
-
|
|
456
392
|
if (transformer) {
|
|
457
393
|
transformer.restore();
|
|
458
394
|
}
|
|
459
395
|
}
|
|
396
|
+
|
|
460
397
|
/**
|
|
461
398
|
* 是否正处于缩放状态
|
|
462
399
|
* @en Whether it is zooming
|
|
463
400
|
*/
|
|
464
|
-
|
|
465
|
-
|
|
466
401
|
function isTransforming(index) {
|
|
467
402
|
var _transformersRef$curr2;
|
|
468
|
-
|
|
469
403
|
var currentIndex = index === void 0 ? innerIndexRef.current : index;
|
|
470
404
|
return (_transformersRef$curr2 = transformersRef.current[currentIndex]) == null ? void 0 : _transformersRef$curr2.busy == null ? void 0 : _transformersRef$curr2.busy();
|
|
471
405
|
}
|
|
406
|
+
|
|
472
407
|
/**
|
|
473
408
|
* 是否已经放大过
|
|
474
409
|
* @en Whether is has been zoomed in
|
|
475
410
|
*/
|
|
476
|
-
|
|
477
|
-
|
|
478
411
|
function isTransformed() {
|
|
479
412
|
var _transformersRef$curr3;
|
|
480
|
-
|
|
481
413
|
return (_transformersRef$curr3 = transformersRef.current[innerIndexRef.current]) == null ? void 0 : _transformersRef$curr3.dirty == null ? void 0 : _transformersRef$curr3.dirty();
|
|
482
414
|
}
|
|
483
|
-
|
|
484
415
|
function isTapStop() {
|
|
485
416
|
var _transformersRef$curr4;
|
|
486
|
-
|
|
487
417
|
return (_transformersRef$curr4 = transformersRef.current[innerIndexRef.current]) == null ? void 0 : _transformersRef$curr4.isTapStop == null ? void 0 : _transformersRef$curr4.isTapStop();
|
|
488
418
|
}
|
|
419
|
+
|
|
489
420
|
/**
|
|
490
421
|
* 计算距离左右侧的距离,如果为0说明到边缘了,可以进行正常轮播操作
|
|
491
422
|
* @en Calculate the distance from the left and right sides. If it is 0, it means that the edge is reached, and the normal rotation operation can be performed.
|
|
492
423
|
*/
|
|
493
|
-
|
|
494
|
-
|
|
495
424
|
function transformTouchSide() {
|
|
496
425
|
var transformer = transformersRef.current[innerIndexRef.current];
|
|
497
426
|
var toLeft = transformer == null ? void 0 : transformer.toLeft == null ? void 0 : transformer.toLeft();
|
|
@@ -502,23 +431,20 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
502
431
|
right: !toRight
|
|
503
432
|
};
|
|
504
433
|
}
|
|
505
|
-
|
|
506
434
|
function handleImageWrapTouchStart(e) {
|
|
507
435
|
if (onTouchStart && onTouchStart(e, innerIndexRef.current)) {
|
|
508
436
|
return true;
|
|
509
437
|
}
|
|
510
|
-
|
|
511
438
|
var touches = e.touches;
|
|
512
439
|
touchStartXRef.current = e.touches && e.touches[0] ? e.touches[0].clientX : 0;
|
|
513
440
|
movedRef.current = false;
|
|
514
|
-
dblClickingRef.current = false;
|
|
441
|
+
dblClickingRef.current = false;
|
|
442
|
+
// 单点长按才触发长按
|
|
515
443
|
// @en A single long press triggers a long press
|
|
516
|
-
|
|
517
444
|
if (touches.length === 1) {
|
|
518
445
|
if (!closingRef.current) {
|
|
519
446
|
longTapCheckingRef.current = true;
|
|
520
447
|
}
|
|
521
|
-
|
|
522
448
|
longTimerRef.current = window.setTimeout(function () {
|
|
523
449
|
if (longTapCheckingRef.current) {
|
|
524
450
|
longTapCheckingRef.current = false;
|
|
@@ -529,101 +455,86 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
529
455
|
} else {
|
|
530
456
|
longTapCheckingRef.current = false;
|
|
531
457
|
}
|
|
532
|
-
|
|
533
458
|
if (isTapStop()) {
|
|
534
459
|
movedRef.current = true;
|
|
535
|
-
}
|
|
460
|
+
}
|
|
461
|
+
// 缩放状态下,未到边缘时不触发轮播手势
|
|
536
462
|
// @en In the zoomed state, the carousel gesture is not triggered when the edge is not reached
|
|
537
|
-
|
|
538
|
-
|
|
539
463
|
if (isTransforming()) {
|
|
540
464
|
startTouchingSideRef.current = transformTouchSide().side;
|
|
541
465
|
return !startTouchingSideRef.current;
|
|
542
466
|
}
|
|
543
467
|
}
|
|
544
|
-
|
|
545
468
|
function handleImageWrapTouchMove(e) {
|
|
546
469
|
movedRef.current = true;
|
|
547
470
|
longTapCheckingRef.current = false;
|
|
548
471
|
longTimerRef.current && clearTimeout(longTimerRef.current);
|
|
549
|
-
|
|
550
472
|
if (onTouchMove && onTouchMove(e, innerIndexRef.current)) {
|
|
551
473
|
return true;
|
|
552
474
|
}
|
|
553
|
-
|
|
554
475
|
var evt = e.changedTouches[0];
|
|
555
476
|
var touchMoveX = evt.clientX || 0;
|
|
556
|
-
var posDisX = touchMoveX - touchStartXRef.current;
|
|
477
|
+
var posDisX = touchMoveX - touchStartXRef.current;
|
|
478
|
+
// 缩放状态下,到边缘时如果还在往外滑动,则触发轮播手势
|
|
557
479
|
// @en In the zoomed state, if it is still swiped out when reaching the edge, the carousel gesture is triggered
|
|
558
|
-
|
|
559
480
|
if (isTransforming()) {
|
|
560
481
|
var sideInfo = transformTouchSide();
|
|
561
482
|
return !startTouchingSideRef.current || !(sideInfo.left && posDisX > 0 || sideInfo.right && posDisX < 0);
|
|
562
483
|
}
|
|
563
484
|
}
|
|
564
|
-
|
|
565
485
|
function handleImageWrapTouchEnd(e) {
|
|
566
486
|
if (onTouchEnd && onTouchEnd(e, innerIndexRef.current)) {
|
|
567
487
|
return true;
|
|
568
|
-
}
|
|
488
|
+
}
|
|
489
|
+
// 滑动到上下边缘后还在往外滑动,则关闭弹窗
|
|
569
490
|
// @en After sliding to the upper and lower edges and still sliding outwards, close the popup box
|
|
570
491
|
// needClose为触发touchmove的次数,6和3是相对值,表示判断在往外滑动的敏感度,当未放大时对向外滑动手势更敏感
|
|
571
492
|
// @en needClose is the number of times the touchmove is triggered, 6 and 3 are relative values, indicating the sensitivity of judging the outward sliding, and it is more sensitive to the outward sliding gesture when it is not zoomed in
|
|
572
|
-
|
|
573
|
-
|
|
574
493
|
var needClose = swipeToClose && touchingSideDisRef.current >= (isTransformed() ? 6 : 3);
|
|
575
494
|
touchingSideDisRef.current = 0;
|
|
576
495
|
longTapCheckingRef.current = false;
|
|
577
496
|
longTimerRef.current && clearTimeout(longTimerRef.current);
|
|
578
|
-
|
|
579
497
|
if (needClose) {
|
|
580
498
|
goClose(e);
|
|
581
499
|
return true;
|
|
582
|
-
}
|
|
500
|
+
}
|
|
501
|
+
// 缩放状态下,未到边缘时不触发轮播手势
|
|
583
502
|
// @en In the zoomed state, the carousel gesture is not triggered when the edge is not reached
|
|
584
|
-
|
|
585
|
-
|
|
586
503
|
if (isTransforming() && !transformTouchSide().side) {
|
|
587
504
|
return true;
|
|
588
505
|
}
|
|
589
506
|
}
|
|
590
|
-
|
|
591
507
|
function handleImageClick(e) {
|
|
592
508
|
if (movedRef.current) {
|
|
593
509
|
return;
|
|
594
|
-
}
|
|
510
|
+
}
|
|
511
|
+
// 如果正在触发doubleClick就不触发click
|
|
595
512
|
// @en If doubleClick is being triggered, click will not be triggered
|
|
596
|
-
|
|
597
|
-
|
|
598
513
|
if (!dblClickingRef.current) {
|
|
599
514
|
if (!onImageClick || !onImageClick(innerIndexRef.current, e)) {
|
|
600
515
|
goClose(e);
|
|
601
516
|
}
|
|
602
517
|
}
|
|
603
518
|
}
|
|
604
|
-
|
|
605
519
|
function handleImageDoubleClick(e) {
|
|
606
520
|
if (dblClickingRef.current) {
|
|
607
521
|
// 防止重复触发dblclick
|
|
608
522
|
return;
|
|
609
523
|
}
|
|
610
|
-
|
|
611
524
|
dblClickingRef.current = true;
|
|
612
525
|
var index = innerIndexRef.current;
|
|
613
|
-
onImageDoubleClick && onImageDoubleClick(index, e);
|
|
526
|
+
onImageDoubleClick && onImageDoubleClick(index, e);
|
|
527
|
+
// 双击时根据配置放大或缩小
|
|
614
528
|
// @en Zoom in or out according to configuration when double-clicking
|
|
615
|
-
|
|
616
529
|
var transformer = transformersRef.current[index];
|
|
617
|
-
|
|
618
530
|
if (transformer) {
|
|
619
531
|
var trans = transformer.getTransform();
|
|
620
532
|
var rate = trans.scale || 1;
|
|
621
533
|
var dblScale = getImageDoubleClickScale(rate);
|
|
622
|
-
|
|
623
534
|
if (dblScale === 1) {
|
|
624
|
-
var img = imageDomsRef.current[index];
|
|
535
|
+
var img = imageDomsRef.current[index];
|
|
536
|
+
// 长图双击还原缩放特殊处理,因为transform和scroll不能完全同步,所以先zoomTo到原点再restore
|
|
625
537
|
// @en Double-click the long image to restore zoom special processing, because transform and scroll cannot be completely synchronized, so first zoomTo to the origin and then restore
|
|
626
|
-
|
|
627
538
|
if (imageHasOverflow(img)) {
|
|
628
539
|
transformer.zoomToScreenCenter(1, [windowWidth / 2, windowHeight / 2], {
|
|
629
540
|
duration: 200,
|
|
@@ -643,37 +554,30 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
643
554
|
}
|
|
644
555
|
}
|
|
645
556
|
}
|
|
557
|
+
var handleClick = (0, _helpers.useSingleAndDoubleClick)(handleImageClick, handleImageDoubleClick);
|
|
646
558
|
|
|
647
|
-
|
|
559
|
+
// 当使用 getThumbBounds 时,关闭图片预览有缩小效果
|
|
648
560
|
// @en When using getThumbBounds, closing the image preview has a shrinking effect
|
|
649
|
-
|
|
650
561
|
function animateBeforeClose() {
|
|
651
562
|
var _imagesRef$current$in2;
|
|
652
|
-
|
|
653
563
|
if (isTransformed()) {
|
|
654
564
|
return;
|
|
655
565
|
}
|
|
656
|
-
|
|
657
566
|
var index = innerIndexRef.current;
|
|
658
567
|
var imageDom = (_imagesRef$current$in2 = imagesRef.current[index]) == null ? void 0 : _imagesRef$current$in2.image;
|
|
659
568
|
var thumbBounds = getThumbBounds == null ? void 0 : getThumbBounds(index);
|
|
660
|
-
|
|
661
569
|
if (!imageDom || !thumbBounds || !thumbBounds.width || !thumbBounds.height) {
|
|
662
570
|
return;
|
|
663
|
-
}
|
|
571
|
+
}
|
|
572
|
+
// 小图超过一半在视野外时,不展示缩小效果
|
|
664
573
|
// @en When more than half of the thumbnail is outside the field of view, the zoom effect will not be displayed
|
|
665
|
-
|
|
666
|
-
|
|
667
574
|
if (thumbBounds.top < -1 * thumbBounds.height / 2 || thumbBounds.top > windowHeight - thumbBounds.height / 2 || thumbBounds.left < -1 * thumbBounds.width / 2 || thumbBounds.left > windowWidth - thumbBounds.width / 2) {
|
|
668
575
|
return;
|
|
669
576
|
}
|
|
670
|
-
|
|
671
577
|
var imageDomRect = imageDom.getBoundingClientRect();
|
|
672
|
-
|
|
673
578
|
if (!imageDomRect.width || !imageDomRect.height) {
|
|
674
579
|
return;
|
|
675
580
|
}
|
|
676
|
-
|
|
677
581
|
imageDom.classList.add('closing-animation');
|
|
678
582
|
setImageBounds(imageDom, imageDomRect, imageDomRect);
|
|
679
583
|
imageDom.style.objectPosition = images[index].thumbPosition || 'top center';
|
|
@@ -683,22 +587,19 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
683
587
|
setImageBounds(imageDom, thumbBounds, imageDomRect);
|
|
684
588
|
});
|
|
685
589
|
}
|
|
686
|
-
|
|
687
590
|
function goClose(e) {
|
|
688
591
|
if (closingRef.current) {
|
|
689
592
|
return;
|
|
690
593
|
}
|
|
691
|
-
|
|
692
594
|
closingRef.current = true;
|
|
693
595
|
animateBeforeClose();
|
|
694
596
|
close(e);
|
|
695
597
|
}
|
|
598
|
+
|
|
696
599
|
/**
|
|
697
600
|
* 更改指定图片状态
|
|
698
601
|
* @en Change specified image status
|
|
699
602
|
*/
|
|
700
|
-
|
|
701
|
-
|
|
702
603
|
function setImagesStatusByIndex(index, data) {
|
|
703
604
|
setImagesStatus(function (current) {
|
|
704
605
|
var newStatus = current.slice();
|
|
@@ -706,35 +607,30 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
706
607
|
return newStatus;
|
|
707
608
|
});
|
|
708
609
|
}
|
|
610
|
+
|
|
709
611
|
/**
|
|
710
612
|
* 缩略图放大过渡动画设置
|
|
711
613
|
* @en Set thumbnail zoom transition animation
|
|
712
614
|
*/
|
|
713
|
-
|
|
714
|
-
|
|
715
615
|
function setDisplayAnimation(index) {
|
|
716
616
|
var _imagesStatusRef$curr4, _domRef$current2, _domRef$current2$quer, _domRef$current2$quer2;
|
|
717
|
-
|
|
718
617
|
var firstLoaded = (_imagesStatusRef$curr4 = imagesStatusRef.current[index]) == null ? void 0 : _imagesStatusRef$curr4.firstLoaded;
|
|
719
|
-
var fallbackSrc = replaceFallbackWhenLoaded && firstLoaded ? images[index].src : images[index].fallbackSrc;
|
|
618
|
+
var fallbackSrc = replaceFallbackWhenLoaded && firstLoaded ? images[index].src : images[index].fallbackSrc;
|
|
619
|
+
// 用户设置了getThumbBounds和images的fallbackSrc属性才有放大过渡效果
|
|
720
620
|
// @en Set the fallbackSrc attribute of getThumbBounds and images to have a zoom-in transition effect
|
|
721
|
-
|
|
722
621
|
if (!getThumbBounds || !images[index] || !fallbackSrc) {
|
|
723
622
|
resetAnimation(index);
|
|
724
623
|
return;
|
|
725
|
-
}
|
|
624
|
+
}
|
|
625
|
+
// 获取缩略图的rect,如果没获取到就取消放大过渡效果
|
|
726
626
|
// @en Get the rect of the thumbnail, if it is gotten, cancel the zoom transition effect
|
|
727
|
-
|
|
728
|
-
|
|
729
627
|
var thumbBounds = getThumbBounds(index);
|
|
730
|
-
|
|
731
628
|
if (!thumbBounds || !thumbBounds.width || !thumbBounds.height) {
|
|
732
629
|
resetAnimation(index);
|
|
733
630
|
return;
|
|
734
|
-
}
|
|
631
|
+
}
|
|
632
|
+
// 伪造一个fixed的图做小图放大效果
|
|
735
633
|
// @en Forge a fixed image to make a small image enlargement effect
|
|
736
|
-
|
|
737
|
-
|
|
738
634
|
var transImage = new Image();
|
|
739
635
|
transImageRef.current = transImage;
|
|
740
636
|
transImage.classList.add('image-preview-fake-trans-image');
|
|
@@ -744,25 +640,23 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
744
640
|
transImage.style.opacity = '0';
|
|
745
641
|
transImage.style.transitionDuration = displayDuration + "ms";
|
|
746
642
|
transImage.style.webkitTransitionDuration = displayDuration + "ms";
|
|
747
|
-
(_domRef$current2 = domRef.current) == null ? void 0 : (_domRef$current2$quer = _domRef$current2.querySelectorAll('.carousel-item')) == null ? void 0 : (_domRef$current2$quer2 = _domRef$current2$quer[index]) == null ? void 0 : _domRef$current2$quer2.prepend(transImage);
|
|
643
|
+
(_domRef$current2 = domRef.current) == null ? void 0 : (_domRef$current2$quer = _domRef$current2.querySelectorAll('.carousel-item')) == null ? void 0 : (_domRef$current2$quer2 = _domRef$current2$quer[index]) == null ? void 0 : _domRef$current2$quer2.prepend(transImage);
|
|
644
|
+
// 拿到放大之后的位置rect,没拿到就取消小图放大效果
|
|
748
645
|
// @en Get the zoomed-in position rect, and cancel the zoom-in effect if not getting it
|
|
749
|
-
|
|
750
646
|
getNewImageBounds(index, fallbackSrc, transImage, function (rect) {
|
|
751
647
|
if (!rect || !rect.width || !rect.height) {
|
|
752
648
|
removeChild(transImage);
|
|
753
649
|
resetAnimation(index);
|
|
754
650
|
return;
|
|
755
|
-
}
|
|
651
|
+
}
|
|
652
|
+
// 通过小图rect变换到大图rect加transition做放大效果
|
|
756
653
|
// @en Transform the small image rect to the large image rect and add transition to make a magnification effect
|
|
757
|
-
|
|
758
|
-
|
|
759
654
|
(0, _mobileUtils.nextTick)(function () {
|
|
760
655
|
transImage.style.opacity = '1';
|
|
761
656
|
setImageBounds(transImage, rect, thumbBounds);
|
|
762
657
|
setTimeout(function () {
|
|
763
658
|
setPlaceholders(function (holders) {
|
|
764
659
|
var _extends3;
|
|
765
|
-
|
|
766
660
|
return (0, _extends5.default)({}, holders, (_extends3 = {}, _extends3[index] = true, _extends3));
|
|
767
661
|
});
|
|
768
662
|
}, Math.max(0, displayDuration - 80));
|
|
@@ -773,24 +667,22 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
773
667
|
});
|
|
774
668
|
});
|
|
775
669
|
}
|
|
670
|
+
|
|
776
671
|
/**
|
|
777
672
|
* 取消小图放大过渡效果
|
|
778
673
|
* @en Cancel the thumbnail zoom transition effect
|
|
779
674
|
*/
|
|
780
|
-
|
|
781
|
-
|
|
782
675
|
function resetAnimation(index) {
|
|
783
676
|
setImagesStatusByIndex(index, {
|
|
784
677
|
animated: true
|
|
785
678
|
});
|
|
786
679
|
setTransImageInfo(null);
|
|
787
680
|
}
|
|
681
|
+
|
|
788
682
|
/**
|
|
789
683
|
* 根据rect设置图片的位置
|
|
790
684
|
* @en Set the position of the image according to the rect
|
|
791
685
|
*/
|
|
792
|
-
|
|
793
|
-
|
|
794
686
|
function setImageBounds(image, rect, thumbRect) {
|
|
795
687
|
// 这里为保持原有比例,只设置宽度变化,高度会随宽度等比变化
|
|
796
688
|
image.style.width = thumbRect.width + "px";
|
|
@@ -800,18 +692,16 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
800
692
|
image.style.transformOrigin = 'left top';
|
|
801
693
|
image.style.webkitTransformOrigin = 'left top';
|
|
802
694
|
}
|
|
695
|
+
|
|
803
696
|
/**
|
|
804
697
|
* 计算放大之后的位置rect
|
|
805
698
|
* @en Calculate the position rect after zooming in
|
|
806
699
|
*/
|
|
807
|
-
|
|
808
|
-
|
|
809
700
|
function getNewImageBounds(index, transSrc, transImage, callback) {
|
|
810
701
|
if (!transSrc) {
|
|
811
702
|
callback(null);
|
|
812
703
|
return;
|
|
813
704
|
}
|
|
814
|
-
|
|
815
705
|
setTransImageInfo({
|
|
816
706
|
src: transSrc,
|
|
817
707
|
fit: images[index].fit,
|
|
@@ -827,12 +717,11 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
827
717
|
}
|
|
828
718
|
});
|
|
829
719
|
}
|
|
720
|
+
|
|
830
721
|
/**
|
|
831
722
|
* @en 渲染轮播+图片展示
|
|
832
723
|
* Rendering carousel + displaying image
|
|
833
724
|
*/
|
|
834
|
-
|
|
835
|
-
|
|
836
725
|
function renderContent(carouselProps, allImages, getImageProps) {
|
|
837
726
|
return /*#__PURE__*/_react.default.createElement(_carousel.default, (0, _extends5.default)({
|
|
838
727
|
autoPlay: false,
|
|
@@ -853,29 +742,25 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
853
742
|
boxHeight: windowHeight,
|
|
854
743
|
bottomOverlap: null
|
|
855
744
|
}, getImageProps(image, index))));
|
|
856
|
-
|
|
857
745
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
858
746
|
className: "preview-image-wrap-container",
|
|
859
747
|
key: "outer-" + index
|
|
860
748
|
}, innerNode, image.extraNode);
|
|
861
749
|
}));
|
|
862
750
|
}
|
|
863
|
-
|
|
864
751
|
function getImageClass(index) {
|
|
865
752
|
var _ref = imagesStatus[index] || {},
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
753
|
+
loaded = _ref.loaded,
|
|
754
|
+
animated = _ref.animated;
|
|
869
755
|
return (0, _mobileUtils.cls)('preview-image', {
|
|
870
756
|
'preview-hidden': index === openIndex && (!loaded || !animated)
|
|
871
757
|
});
|
|
872
758
|
}
|
|
759
|
+
|
|
873
760
|
/**
|
|
874
761
|
* 每张图片的样式
|
|
875
762
|
* @en style of each image
|
|
876
763
|
*/
|
|
877
|
-
|
|
878
|
-
|
|
879
764
|
function getImageStyle() {
|
|
880
765
|
// 因为缩放的容器必须是没有transform和transition的纯净元素
|
|
881
766
|
// @en Because the scaled container must be a pure element without transform and transition
|
|
@@ -884,33 +769,31 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
884
769
|
return {
|
|
885
770
|
overflow: 'visible'
|
|
886
771
|
};
|
|
887
|
-
}
|
|
888
|
-
|
|
772
|
+
}
|
|
889
773
|
|
|
774
|
+
// 渲染轮播指引器
|
|
890
775
|
function renderPreviewIndicator(currentIndex, total, lastIndex) {
|
|
891
776
|
if (renderIndicator) {
|
|
892
777
|
return renderIndicator(currentIndex, total, lastIndex);
|
|
893
778
|
}
|
|
894
|
-
|
|
895
779
|
return openLoaded ? /*#__PURE__*/_react.default.createElement(_portal.default, {
|
|
896
780
|
getContainer: getContainer
|
|
897
781
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
898
782
|
className: "image-preview-indicator"
|
|
899
783
|
}, currentIndex + 1, "/", total)) : null;
|
|
900
|
-
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// ios在重设style时图片会消失一下造成闪动,因此在底下垫一张图
|
|
901
787
|
// @en In iOS when resetting the style, the image will disappear and cause flickering, so put a image at the bottom
|
|
902
788
|
// 优先过渡图,其次用原图
|
|
903
789
|
// @en Prioritize the transition image, followed by the original image
|
|
904
|
-
|
|
905
|
-
|
|
906
790
|
function renderImagePlaceholder(src, index, fitCss) {
|
|
907
791
|
var _ref2 = imagesStatus[index] || {},
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
792
|
+
originWidth = _ref2.originWidth,
|
|
793
|
+
originHeight = _ref2.originHeight,
|
|
794
|
+
originLeft = _ref2.originLeft,
|
|
795
|
+
originTop = _ref2.originTop,
|
|
796
|
+
hasOverflow = _ref2.hasOverflow;
|
|
914
797
|
var trans = hasOverflow ? {} : (0, _helpers.getStyleWithVendor)({
|
|
915
798
|
transform: 'translateY(-50%)'
|
|
916
799
|
});
|
|
@@ -928,7 +811,6 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
928
811
|
}, fitObj, trans)
|
|
929
812
|
}) : null;
|
|
930
813
|
}
|
|
931
|
-
|
|
932
814
|
function renderLoadingArea() {
|
|
933
815
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
934
816
|
className: "image-preview-loading-area"
|
|
@@ -938,7 +820,6 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
938
820
|
radius: 7
|
|
939
821
|
}));
|
|
940
822
|
}
|
|
941
|
-
|
|
942
823
|
return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref3) {
|
|
943
824
|
var prefixCls = _ref3.prefixCls;
|
|
944
825
|
return /*#__PURE__*/_react.default.createElement(_portal.default, {
|
|
@@ -1004,20 +885,17 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1004
885
|
originLeft: imageEle.offsetLeft,
|
|
1005
886
|
hasOverflow: imageHasOverflow(imageEle)
|
|
1006
887
|
});
|
|
1007
|
-
|
|
1008
888
|
if (index === openIndex) {
|
|
1009
889
|
initTransformer(index);
|
|
1010
890
|
} else {
|
|
1011
891
|
setPlaceholders(function (holders) {
|
|
1012
892
|
var _extends4;
|
|
1013
|
-
|
|
1014
893
|
return (0, _extends5.default)({}, holders, (_extends4 = {}, _extends4[index] = true, _extends4));
|
|
1015
894
|
});
|
|
1016
895
|
}
|
|
1017
896
|
},
|
|
1018
897
|
onError: function onError() {
|
|
1019
898
|
imageDomsRef.current[index] = null;
|
|
1020
|
-
|
|
1021
899
|
if (index === openIndex) {
|
|
1022
900
|
var transImage = transImageInfo == null ? void 0 : transImageInfo.movingImage;
|
|
1023
901
|
removeChild(transImage);
|
|
@@ -1050,7 +928,6 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1050
928
|
}) : null);
|
|
1051
929
|
});
|
|
1052
930
|
});
|
|
1053
|
-
|
|
1054
931
|
function methodsGenerator(Comp) {
|
|
1055
932
|
return {
|
|
1056
933
|
/**
|
|
@@ -1062,8 +939,8 @@ function methodsGenerator(Comp) {
|
|
|
1062
939
|
open: (0, _methods.open)(Comp)
|
|
1063
940
|
};
|
|
1064
941
|
}
|
|
1065
|
-
|
|
1066
942
|
var ImagePreviewWithGlobalContext = (0, _contextProvider.CompWithGlobalContext)(ImagePreview);
|
|
943
|
+
|
|
1067
944
|
/**
|
|
1068
945
|
* 图片预览组件,支持循环轮播、双指/双击缩放、缩略图放大效果。
|
|
1069
946
|
* @en The image preview, supports circular rotation, two-finger/double-tap zoom, and thumbnail zoom effects.
|
|
@@ -1072,7 +949,5 @@ var ImagePreviewWithGlobalContext = (0, _contextProvider.CompWithGlobalContext)(
|
|
|
1072
949
|
* @name 图片预览
|
|
1073
950
|
* @name_en ImagePreview
|
|
1074
951
|
*/
|
|
1075
|
-
|
|
1076
952
|
var _default = (0, _mobileUtils.componentWrapper)(ImagePreview, methodsGenerator(ImagePreviewWithGlobalContext));
|
|
1077
|
-
|
|
1078
953
|
exports.default = _default;
|