@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
|
@@ -17,55 +17,53 @@ var MAX_ZOOM = 5;
|
|
|
17
17
|
var MIN_ZOOM = 0.7;
|
|
18
18
|
var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
19
19
|
var _imagesStatus$openInd, _imagesStatus$openInd2;
|
|
20
|
-
|
|
21
20
|
var style = props.style,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
21
|
+
className = props.className,
|
|
22
|
+
images = props.images,
|
|
23
|
+
_props$loop = props.loop,
|
|
24
|
+
loop = _props$loop === void 0 ? false : _props$loop,
|
|
25
|
+
openIndex = props.openIndex,
|
|
26
|
+
fit = props.fit,
|
|
27
|
+
_props$noselect = props.noselect,
|
|
28
|
+
noselect = _props$noselect === void 0 ? true : _props$noselect,
|
|
29
|
+
_props$displayDuratio = props.displayDuration,
|
|
30
|
+
displayDuration = _props$displayDuratio === void 0 ? 350 : _props$displayDuratio,
|
|
31
|
+
_props$spaceBetween = props.spaceBetween,
|
|
32
|
+
spaceBetween = _props$spaceBetween === void 0 ? 0 : _props$spaceBetween,
|
|
33
|
+
_props$showLoading = props.showLoading,
|
|
34
|
+
showLoading = _props$showLoading === void 0 ? true : _props$showLoading,
|
|
35
|
+
loadingArea = props.loadingArea,
|
|
36
|
+
errorArea = props.errorArea,
|
|
37
|
+
_props$showError = props.showError,
|
|
38
|
+
showError = _props$showError === void 0 ? true : _props$showError,
|
|
39
|
+
retryTime = props.retryTime,
|
|
40
|
+
staticLabel = props.staticLabel,
|
|
41
|
+
replaceFallbackWhenLoaded = props.replaceFallbackWhenLoaded,
|
|
42
|
+
scrollBezier = props.scrollBezier,
|
|
43
|
+
_props$lazyloadCount = props.lazyloadCount,
|
|
44
|
+
lazyloadCount = _props$lazyloadCount === void 0 ? 1 : _props$lazyloadCount,
|
|
45
|
+
_props$swipeToClose = props.swipeToClose,
|
|
46
|
+
swipeToClose = _props$swipeToClose === void 0 ? true : _props$swipeToClose,
|
|
47
|
+
extra = props.extra,
|
|
48
|
+
getMinScale = props.getMinScale,
|
|
49
|
+
getMaxScale = props.getMaxScale,
|
|
50
|
+
getDoubleClickScale = props.getDoubleClickScale,
|
|
51
|
+
getContainer = props.getContainer,
|
|
52
|
+
getThumbBounds = props.getThumbBounds,
|
|
53
|
+
renderIndicator = props.renderIndicator,
|
|
54
|
+
_onChange = props.onChange,
|
|
55
|
+
_onAfterChange = props.onAfterChange,
|
|
56
|
+
onImageClick = props.onImageClick,
|
|
57
|
+
onImageDoubleClick = props.onImageDoubleClick,
|
|
58
|
+
onImageLongTap = props.onImageLongTap,
|
|
59
|
+
close = props.close,
|
|
60
|
+
onClose = props.onClose,
|
|
61
|
+
onTouchStart = props.onTouchStart,
|
|
62
|
+
onTouchMove = props.onTouchMove,
|
|
63
|
+
onTouchEnd = props.onTouchEnd,
|
|
64
|
+
_props$indicatorPos = props.indicatorPos,
|
|
65
|
+
indicatorPos = _props$indicatorPos === void 0 ? 'start' : _props$indicatorPos,
|
|
66
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
69
67
|
var system = useSystem();
|
|
70
68
|
var domRef = useRef(null);
|
|
71
69
|
var imagesRef = useRef([]);
|
|
@@ -84,28 +82,22 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
84
82
|
var lastScaleRef = useRef(0);
|
|
85
83
|
var closingRef = useRef(false);
|
|
86
84
|
var isInitialMount = useRef(false);
|
|
87
|
-
|
|
88
85
|
var _useState = useState({}),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
showPlaceholders = _useState[0],
|
|
87
|
+
setPlaceholders = _useState[1];
|
|
92
88
|
var _useRefState = useRefState([]),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
imagesStatus = _useRefState[0],
|
|
90
|
+
imagesStatusRef = _useRefState[1],
|
|
91
|
+
setImagesStatus = _useRefState[2];
|
|
97
92
|
var _useState2 = useState(null),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
transImageInfo = _useState2[0],
|
|
94
|
+
setTransImageInfo = _useState2[1];
|
|
101
95
|
var openLoaded = (_imagesStatus$openInd = imagesStatus[openIndex]) == null ? void 0 : _imagesStatus$openInd.loaded;
|
|
102
96
|
var openAnimated = (_imagesStatus$openInd2 = imagesStatus[openIndex]) == null ? void 0 : _imagesStatus$openInd2.animated;
|
|
103
97
|
var visible = openIndex >= 0 && openIndex < images.length;
|
|
104
|
-
|
|
105
98
|
var _useWindowSize = useWindowSize(true),
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
windowWidth = _useWindowSize.windowWidth,
|
|
100
|
+
windowHeight = _useWindowSize.windowHeight;
|
|
109
101
|
useImperativeHandle(ref, function () {
|
|
110
102
|
return {
|
|
111
103
|
dom: domRef.current,
|
|
@@ -122,7 +114,6 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
122
114
|
carouselRef.current && carouselRef.current.changeIndex(openIndex, true);
|
|
123
115
|
setImagesStatus(images.map(function (_, index) {
|
|
124
116
|
var _imagesStatusRef$curr;
|
|
125
|
-
|
|
126
117
|
return {
|
|
127
118
|
firstLoaded: ((_imagesStatusRef$curr = imagesStatusRef.current[index]) == null ? void 0 : _imagesStatusRef$curr.firstLoaded) || false,
|
|
128
119
|
animated: index !== openIndex
|
|
@@ -133,18 +124,18 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
133
124
|
// 移除长按事件监听
|
|
134
125
|
// @en Remove long press event listener
|
|
135
126
|
longTimerRef.current && clearTimeout(longTimerRef.current);
|
|
136
|
-
longTapCheckingRef.current = false;
|
|
127
|
+
longTapCheckingRef.current = false;
|
|
128
|
+
// 图片状态重置
|
|
137
129
|
// @en Reset image state
|
|
138
|
-
|
|
139
130
|
setImagesStatus(imagesStatusRef.current.map(function (status) {
|
|
140
131
|
return _extends({}, status, {
|
|
141
132
|
animated: false,
|
|
142
133
|
loaded: false
|
|
143
134
|
});
|
|
144
135
|
}));
|
|
145
|
-
transformersRef.current = [];
|
|
136
|
+
transformersRef.current = [];
|
|
137
|
+
// 移除过渡图片
|
|
146
138
|
// @en Remove transition image
|
|
147
|
-
|
|
148
139
|
removeChild(transImageRef.current);
|
|
149
140
|
setTransImageInfo(null);
|
|
150
141
|
setPlaceholders({});
|
|
@@ -153,7 +144,6 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
153
144
|
mounted && onClose && onClose();
|
|
154
145
|
}, displayDuration);
|
|
155
146
|
}
|
|
156
|
-
|
|
157
147
|
isInitialMount.current = true;
|
|
158
148
|
}, [visible]);
|
|
159
149
|
useEffect(function () {
|
|
@@ -185,38 +175,32 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
185
175
|
transformer && transformer.setMaxScale(getImageMaxScale(index));
|
|
186
176
|
});
|
|
187
177
|
}, [getMaxScale]);
|
|
188
|
-
|
|
189
178
|
function removeChild(child) {
|
|
190
179
|
try {
|
|
191
180
|
var _domRef$current, _domRef$current$query, _domRef$current$query2;
|
|
192
|
-
|
|
193
181
|
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));
|
|
194
182
|
} catch (e) {}
|
|
195
|
-
}
|
|
196
|
-
// @en Monitor the operation of sliding out after sliding to the upper and lower edges, then close the popup
|
|
197
|
-
|
|
183
|
+
}
|
|
198
184
|
|
|
185
|
+
// 监听滑动到上下边缘后还在往外滑动的操作,则关闭弹窗
|
|
186
|
+
// @en Monitor the operation of sliding out after sliding to the upper and lower edges, then close the popup
|
|
199
187
|
function handlePreventCallback(_, dir) {
|
|
200
188
|
if (!isTransforming() && dir === 'y') {
|
|
201
189
|
touchingSideDisRef.current += 1;
|
|
202
190
|
}
|
|
203
191
|
}
|
|
192
|
+
|
|
204
193
|
/**
|
|
205
194
|
* 缩放插件初始化
|
|
206
195
|
* @en Zoom plugin initialization
|
|
207
196
|
*/
|
|
208
|
-
|
|
209
|
-
|
|
210
197
|
function initTransformer(index) {
|
|
211
198
|
var _imagesRef$current$in;
|
|
212
|
-
|
|
213
199
|
var imageDom = (_imagesRef$current$in = imagesRef.current[index]) == null ? void 0 : _imagesRef$current$in.dom;
|
|
214
200
|
var wrapDom = imageDom == null ? void 0 : imageDom.parentElement;
|
|
215
|
-
|
|
216
201
|
if (!imageDom || !wrapDom) {
|
|
217
202
|
return;
|
|
218
203
|
}
|
|
219
|
-
|
|
220
204
|
if (transformersRef.current[index]) {
|
|
221
205
|
transformersRef.current[index].setDom(wrapDom);
|
|
222
206
|
} else {
|
|
@@ -236,16 +220,15 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
236
220
|
},
|
|
237
221
|
onTransform: function onTransform() {
|
|
238
222
|
var _transformersRef$curr, _imagesStatusRef$curr2, _imagesStatusRef$curr3;
|
|
239
|
-
|
|
240
223
|
// 图片放大再缩小,解决ios图片放大后模糊的问题
|
|
241
224
|
// @en The image is zoomed in and then zoomed out to solve the problem of blurring after zooming in on ios images
|
|
242
225
|
var img = imageDomsRef.current[index];
|
|
243
226
|
var trans = ((_transformersRef$curr = transformersRef.current[index]) == null ? void 0 : _transformersRef$curr.getTransform == null ? void 0 : _transformersRef$curr.getTransform()) || {};
|
|
244
227
|
var width = (_imagesStatusRef$curr2 = imagesStatusRef.current[index]) == null ? void 0 : _imagesStatusRef$curr2.originWidth;
|
|
245
228
|
var height = (_imagesStatusRef$curr3 = imagesStatusRef.current[index]) == null ? void 0 : _imagesStatusRef$curr3.originHeight;
|
|
246
|
-
var scale = trans.scale || 1;
|
|
229
|
+
var scale = trans.scale || 1;
|
|
230
|
+
// 判断下只有图片缩放发生改变时重写图片样式
|
|
247
231
|
// @en It is judged that only the image style is rewritten when the zoom of the image changes.
|
|
248
|
-
|
|
249
232
|
if (img && width && height && lastScaleRef.current !== scale) {
|
|
250
233
|
lastScaleRef.current = scale;
|
|
251
234
|
var atCenter = !imageHasOverflow(img) ? ' translateY(-50%)' : '';
|
|
@@ -264,23 +247,18 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
264
247
|
onZoomEnd: function onZoomEnd(_1, _2, pinchStartCenter) {
|
|
265
248
|
setPlaceholders(function (holders) {
|
|
266
249
|
var _extends2;
|
|
267
|
-
|
|
268
250
|
return _extends({}, holders, (_extends2 = {}, _extends2[index] = false, _extends2));
|
|
269
251
|
});
|
|
270
252
|
var image = imageDomsRef.current[index];
|
|
271
253
|
var transformer = transformersRef.current[index];
|
|
272
|
-
|
|
273
254
|
if (!image || !transformer || transformer.getTransform().scale < 1) {
|
|
274
255
|
return;
|
|
275
256
|
}
|
|
276
|
-
|
|
277
257
|
var imageRect = image.getBoundingClientRect();
|
|
278
|
-
|
|
279
258
|
if (imageRect.width > windowWidth && imageRect.height > windowHeight) {
|
|
280
259
|
if (pinchStartCenter && pinchStartCenter.length) {
|
|
281
260
|
transformer.setCenter.apply(transformer, pinchStartCenter);
|
|
282
261
|
}
|
|
283
|
-
|
|
284
262
|
transformer.setFixedX(false);
|
|
285
263
|
transformer.setFixedY(false);
|
|
286
264
|
} else if (imageRect.height <= windowHeight) {
|
|
@@ -299,165 +277,134 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
299
277
|
maxScale: getImageMaxScale(index)
|
|
300
278
|
});
|
|
301
279
|
}
|
|
302
|
-
|
|
303
280
|
setOriginBoundary(index);
|
|
304
281
|
}
|
|
305
|
-
|
|
306
282
|
function imageHasOverflow(img) {
|
|
307
283
|
return Boolean(img && !img.classList.contains('preview-fit-contain-y'));
|
|
308
284
|
}
|
|
309
|
-
|
|
310
285
|
function setOriginBoundary(index) {
|
|
311
286
|
var imageEle = imagesRef.current[index];
|
|
312
|
-
var imageDom = imageEle == null ? void 0 : imageEle.dom;
|
|
287
|
+
var imageDom = imageEle == null ? void 0 : imageEle.dom;
|
|
288
|
+
// 边界范围变为图片范围和容器范围的并集
|
|
313
289
|
// @en The bounding range becomes the union of the image range and the container range
|
|
314
|
-
|
|
315
290
|
if (imageDom != null && imageDom.parentElement && imageEle != null && imageEle.image) {
|
|
316
|
-
var
|
|
317
|
-
|
|
291
|
+
var rect = imageEle.image.getBoundingClientRect();
|
|
318
292
|
var eleRect = imageDom.parentElement.getBoundingClientRect();
|
|
319
|
-
|
|
320
293
|
if (transformersRef.current[index]) {
|
|
321
294
|
transformersRef.current[index].setBoundary({
|
|
322
|
-
left: Math.min(
|
|
323
|
-
right: Math.max(
|
|
324
|
-
top: Math.min(
|
|
325
|
-
bottom: Math.max(
|
|
295
|
+
left: Math.min(rect.left, eleRect.left),
|
|
296
|
+
right: Math.max(rect.right, eleRect.right),
|
|
297
|
+
top: Math.min(rect.top, eleRect.top),
|
|
298
|
+
bottom: Math.max(rect.bottom, eleRect.bottom)
|
|
326
299
|
}, true);
|
|
327
300
|
}
|
|
328
301
|
}
|
|
329
302
|
}
|
|
303
|
+
|
|
330
304
|
/**
|
|
331
305
|
* 获取最小缩放倍数
|
|
332
306
|
* @en Get the minimum zoom factor
|
|
333
307
|
*/
|
|
334
|
-
|
|
335
|
-
|
|
336
308
|
function getImageMinScale(index) {
|
|
337
309
|
var currentIndex = index === void 0 ? innerIndexRef.current : index;
|
|
338
310
|
var imageDom = imageDomsRef.current[currentIndex];
|
|
339
|
-
|
|
340
311
|
if (!imageDom) {
|
|
341
312
|
return 1;
|
|
342
313
|
}
|
|
343
|
-
|
|
344
314
|
if (getMinScale) {
|
|
345
315
|
return getMinScale(imageDom, currentIndex);
|
|
346
316
|
}
|
|
347
|
-
|
|
348
317
|
return MIN_ZOOM;
|
|
349
318
|
}
|
|
319
|
+
|
|
350
320
|
/**
|
|
351
321
|
* 获取最大缩放倍数
|
|
352
322
|
* @en Get the maximum zoom factor
|
|
353
323
|
*/
|
|
354
|
-
|
|
355
|
-
|
|
356
324
|
function getImageMaxScale(index) {
|
|
357
325
|
var currentIndex = index === void 0 ? innerIndexRef.current : index;
|
|
358
326
|
var imageDom = imageDomsRef.current[currentIndex];
|
|
359
|
-
|
|
360
327
|
if (!imageDom) {
|
|
361
328
|
return 1;
|
|
362
329
|
}
|
|
363
|
-
|
|
364
330
|
if (getMaxScale) {
|
|
365
331
|
return getMaxScale(imageDom, currentIndex);
|
|
366
332
|
}
|
|
367
|
-
|
|
368
333
|
var imageWidth = imageDom.naturalWidth;
|
|
369
334
|
var imageHeight = imageDom.naturalHeight;
|
|
370
335
|
var maxScale = 1;
|
|
371
|
-
|
|
372
336
|
if (imageWidth > imageHeight) {
|
|
373
337
|
maxScale = imageWidth / windowWidth * MAX_ZOOM;
|
|
374
338
|
} else {
|
|
375
339
|
maxScale = Math.max(MAX_ZOOM, imageWidth / windowWidth);
|
|
376
340
|
}
|
|
377
|
-
|
|
378
341
|
return maxScale;
|
|
379
342
|
}
|
|
343
|
+
|
|
380
344
|
/**
|
|
381
345
|
* 计算双击时图片缩放倍数
|
|
382
346
|
* @en Calculate the zoom factor of the image when double-clicking
|
|
383
347
|
*/
|
|
384
|
-
|
|
385
|
-
|
|
386
348
|
function getImageDoubleClickScale(currentScale) {
|
|
387
349
|
var index = innerIndexRef.current;
|
|
388
350
|
var imageDom = imageDomsRef.current[index];
|
|
389
|
-
|
|
390
351
|
if (!imageDom) {
|
|
391
352
|
return 1;
|
|
392
353
|
}
|
|
393
|
-
|
|
394
354
|
var maxScale = getImageMaxScale(index);
|
|
395
|
-
|
|
396
355
|
if (getDoubleClickScale) {
|
|
397
356
|
return getDoubleClickScale(currentScale, maxScale, imageDom, index);
|
|
398
357
|
}
|
|
399
|
-
|
|
400
358
|
var imageWidth = imageDom.naturalWidth;
|
|
401
359
|
var imageHeight = imageDom.naturalHeight;
|
|
402
360
|
var fitScale = imageWidth > imageHeight ? imageWidth / windowWidth * windowHeight / imageHeight : 1;
|
|
403
361
|
var dblScale = 2;
|
|
404
|
-
|
|
405
362
|
if (fitScale >= 2) {
|
|
406
363
|
dblScale = Math.min(maxScale, fitScale);
|
|
407
364
|
}
|
|
408
|
-
|
|
409
365
|
var current = Number(currentScale.toFixed(3));
|
|
410
366
|
var dbl = Number(dblScale.toFixed(3));
|
|
411
367
|
return current >= 1 && current < dbl ? dbl : 1;
|
|
412
368
|
}
|
|
369
|
+
|
|
413
370
|
/**
|
|
414
371
|
* 还原缩放至原始位置
|
|
415
372
|
* @en Revert zoom to original position
|
|
416
373
|
*/
|
|
417
|
-
|
|
418
|
-
|
|
419
374
|
function restoreTransformer(index) {
|
|
420
375
|
var transformer = transformersRef.current[index];
|
|
421
|
-
|
|
422
376
|
if (transformer) {
|
|
423
377
|
transformer.restore();
|
|
424
378
|
}
|
|
425
379
|
}
|
|
380
|
+
|
|
426
381
|
/**
|
|
427
382
|
* 是否正处于缩放状态
|
|
428
383
|
* @en Whether it is zooming
|
|
429
384
|
*/
|
|
430
|
-
|
|
431
|
-
|
|
432
385
|
function isTransforming(index) {
|
|
433
386
|
var _transformersRef$curr2;
|
|
434
|
-
|
|
435
387
|
var currentIndex = index === void 0 ? innerIndexRef.current : index;
|
|
436
388
|
return (_transformersRef$curr2 = transformersRef.current[currentIndex]) == null ? void 0 : _transformersRef$curr2.busy == null ? void 0 : _transformersRef$curr2.busy();
|
|
437
389
|
}
|
|
390
|
+
|
|
438
391
|
/**
|
|
439
392
|
* 是否已经放大过
|
|
440
393
|
* @en Whether is has been zoomed in
|
|
441
394
|
*/
|
|
442
|
-
|
|
443
|
-
|
|
444
395
|
function isTransformed() {
|
|
445
396
|
var _transformersRef$curr3;
|
|
446
|
-
|
|
447
397
|
return (_transformersRef$curr3 = transformersRef.current[innerIndexRef.current]) == null ? void 0 : _transformersRef$curr3.dirty == null ? void 0 : _transformersRef$curr3.dirty();
|
|
448
398
|
}
|
|
449
|
-
|
|
450
399
|
function isTapStop() {
|
|
451
400
|
var _transformersRef$curr4;
|
|
452
|
-
|
|
453
401
|
return (_transformersRef$curr4 = transformersRef.current[innerIndexRef.current]) == null ? void 0 : _transformersRef$curr4.isTapStop == null ? void 0 : _transformersRef$curr4.isTapStop();
|
|
454
402
|
}
|
|
403
|
+
|
|
455
404
|
/**
|
|
456
405
|
* 计算距离左右侧的距离,如果为0说明到边缘了,可以进行正常轮播操作
|
|
457
406
|
* @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.
|
|
458
407
|
*/
|
|
459
|
-
|
|
460
|
-
|
|
461
408
|
function transformTouchSide() {
|
|
462
409
|
var transformer = transformersRef.current[innerIndexRef.current];
|
|
463
410
|
var toLeft = transformer == null ? void 0 : transformer.toLeft == null ? void 0 : transformer.toLeft();
|
|
@@ -468,23 +415,20 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
468
415
|
right: !toRight
|
|
469
416
|
};
|
|
470
417
|
}
|
|
471
|
-
|
|
472
418
|
function handleImageWrapTouchStart(e) {
|
|
473
419
|
if (onTouchStart && onTouchStart(e, innerIndexRef.current)) {
|
|
474
420
|
return true;
|
|
475
421
|
}
|
|
476
|
-
|
|
477
422
|
var touches = e.touches;
|
|
478
423
|
touchStartXRef.current = e.touches && e.touches[0] ? e.touches[0].clientX : 0;
|
|
479
424
|
movedRef.current = false;
|
|
480
|
-
dblClickingRef.current = false;
|
|
425
|
+
dblClickingRef.current = false;
|
|
426
|
+
// 单点长按才触发长按
|
|
481
427
|
// @en A single long press triggers a long press
|
|
482
|
-
|
|
483
428
|
if (touches.length === 1) {
|
|
484
429
|
if (!closingRef.current) {
|
|
485
430
|
longTapCheckingRef.current = true;
|
|
486
431
|
}
|
|
487
|
-
|
|
488
432
|
longTimerRef.current = window.setTimeout(function () {
|
|
489
433
|
if (longTapCheckingRef.current) {
|
|
490
434
|
longTapCheckingRef.current = false;
|
|
@@ -495,101 +439,86 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
495
439
|
} else {
|
|
496
440
|
longTapCheckingRef.current = false;
|
|
497
441
|
}
|
|
498
|
-
|
|
499
442
|
if (isTapStop()) {
|
|
500
443
|
movedRef.current = true;
|
|
501
|
-
}
|
|
444
|
+
}
|
|
445
|
+
// 缩放状态下,未到边缘时不触发轮播手势
|
|
502
446
|
// @en In the zoomed state, the carousel gesture is not triggered when the edge is not reached
|
|
503
|
-
|
|
504
|
-
|
|
505
447
|
if (isTransforming()) {
|
|
506
448
|
startTouchingSideRef.current = transformTouchSide().side;
|
|
507
449
|
return !startTouchingSideRef.current;
|
|
508
450
|
}
|
|
509
451
|
}
|
|
510
|
-
|
|
511
452
|
function handleImageWrapTouchMove(e) {
|
|
512
453
|
movedRef.current = true;
|
|
513
454
|
longTapCheckingRef.current = false;
|
|
514
455
|
longTimerRef.current && clearTimeout(longTimerRef.current);
|
|
515
|
-
|
|
516
456
|
if (onTouchMove && onTouchMove(e, innerIndexRef.current)) {
|
|
517
457
|
return true;
|
|
518
458
|
}
|
|
519
|
-
|
|
520
459
|
var evt = e.changedTouches[0];
|
|
521
460
|
var touchMoveX = evt.clientX || 0;
|
|
522
|
-
var posDisX = touchMoveX - touchStartXRef.current;
|
|
461
|
+
var posDisX = touchMoveX - touchStartXRef.current;
|
|
462
|
+
// 缩放状态下,到边缘时如果还在往外滑动,则触发轮播手势
|
|
523
463
|
// @en In the zoomed state, if it is still swiped out when reaching the edge, the carousel gesture is triggered
|
|
524
|
-
|
|
525
464
|
if (isTransforming()) {
|
|
526
465
|
var sideInfo = transformTouchSide();
|
|
527
466
|
return !startTouchingSideRef.current || !(sideInfo.left && posDisX > 0 || sideInfo.right && posDisX < 0);
|
|
528
467
|
}
|
|
529
468
|
}
|
|
530
|
-
|
|
531
469
|
function handleImageWrapTouchEnd(e) {
|
|
532
470
|
if (onTouchEnd && onTouchEnd(e, innerIndexRef.current)) {
|
|
533
471
|
return true;
|
|
534
|
-
}
|
|
472
|
+
}
|
|
473
|
+
// 滑动到上下边缘后还在往外滑动,则关闭弹窗
|
|
535
474
|
// @en After sliding to the upper and lower edges and still sliding outwards, close the popup box
|
|
536
475
|
// needClose为触发touchmove的次数,6和3是相对值,表示判断在往外滑动的敏感度,当未放大时对向外滑动手势更敏感
|
|
537
476
|
// @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
|
|
538
|
-
|
|
539
|
-
|
|
540
477
|
var needClose = swipeToClose && touchingSideDisRef.current >= (isTransformed() ? 6 : 3);
|
|
541
478
|
touchingSideDisRef.current = 0;
|
|
542
479
|
longTapCheckingRef.current = false;
|
|
543
480
|
longTimerRef.current && clearTimeout(longTimerRef.current);
|
|
544
|
-
|
|
545
481
|
if (needClose) {
|
|
546
482
|
goClose(e);
|
|
547
483
|
return true;
|
|
548
|
-
}
|
|
484
|
+
}
|
|
485
|
+
// 缩放状态下,未到边缘时不触发轮播手势
|
|
549
486
|
// @en In the zoomed state, the carousel gesture is not triggered when the edge is not reached
|
|
550
|
-
|
|
551
|
-
|
|
552
487
|
if (isTransforming() && !transformTouchSide().side) {
|
|
553
488
|
return true;
|
|
554
489
|
}
|
|
555
490
|
}
|
|
556
|
-
|
|
557
491
|
function handleImageClick(e) {
|
|
558
492
|
if (movedRef.current) {
|
|
559
493
|
return;
|
|
560
|
-
}
|
|
494
|
+
}
|
|
495
|
+
// 如果正在触发doubleClick就不触发click
|
|
561
496
|
// @en If doubleClick is being triggered, click will not be triggered
|
|
562
|
-
|
|
563
|
-
|
|
564
497
|
if (!dblClickingRef.current) {
|
|
565
498
|
if (!onImageClick || !onImageClick(innerIndexRef.current, e)) {
|
|
566
499
|
goClose(e);
|
|
567
500
|
}
|
|
568
501
|
}
|
|
569
502
|
}
|
|
570
|
-
|
|
571
503
|
function handleImageDoubleClick(e) {
|
|
572
504
|
if (dblClickingRef.current) {
|
|
573
505
|
// 防止重复触发dblclick
|
|
574
506
|
return;
|
|
575
507
|
}
|
|
576
|
-
|
|
577
508
|
dblClickingRef.current = true;
|
|
578
509
|
var index = innerIndexRef.current;
|
|
579
|
-
onImageDoubleClick && onImageDoubleClick(index, e);
|
|
510
|
+
onImageDoubleClick && onImageDoubleClick(index, e);
|
|
511
|
+
// 双击时根据配置放大或缩小
|
|
580
512
|
// @en Zoom in or out according to configuration when double-clicking
|
|
581
|
-
|
|
582
513
|
var transformer = transformersRef.current[index];
|
|
583
|
-
|
|
584
514
|
if (transformer) {
|
|
585
515
|
var trans = transformer.getTransform();
|
|
586
516
|
var rate = trans.scale || 1;
|
|
587
517
|
var dblScale = getImageDoubleClickScale(rate);
|
|
588
|
-
|
|
589
518
|
if (dblScale === 1) {
|
|
590
|
-
var img = imageDomsRef.current[index];
|
|
519
|
+
var img = imageDomsRef.current[index];
|
|
520
|
+
// 长图双击还原缩放特殊处理,因为transform和scroll不能完全同步,所以先zoomTo到原点再restore
|
|
591
521
|
// @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
|
|
592
|
-
|
|
593
522
|
if (imageHasOverflow(img)) {
|
|
594
523
|
transformer.zoomToScreenCenter(1, [windowWidth / 2, windowHeight / 2], {
|
|
595
524
|
duration: 200,
|
|
@@ -609,37 +538,30 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
609
538
|
}
|
|
610
539
|
}
|
|
611
540
|
}
|
|
541
|
+
var handleClick = useSingleAndDoubleClick(handleImageClick, handleImageDoubleClick);
|
|
612
542
|
|
|
613
|
-
|
|
543
|
+
// 当使用 getThumbBounds 时,关闭图片预览有缩小效果
|
|
614
544
|
// @en When using getThumbBounds, closing the image preview has a shrinking effect
|
|
615
|
-
|
|
616
545
|
function animateBeforeClose() {
|
|
617
546
|
var _imagesRef$current$in2;
|
|
618
|
-
|
|
619
547
|
if (isTransformed()) {
|
|
620
548
|
return;
|
|
621
549
|
}
|
|
622
|
-
|
|
623
550
|
var index = innerIndexRef.current;
|
|
624
551
|
var imageDom = (_imagesRef$current$in2 = imagesRef.current[index]) == null ? void 0 : _imagesRef$current$in2.image;
|
|
625
552
|
var thumbBounds = getThumbBounds == null ? void 0 : getThumbBounds(index);
|
|
626
|
-
|
|
627
553
|
if (!imageDom || !thumbBounds || !thumbBounds.width || !thumbBounds.height) {
|
|
628
554
|
return;
|
|
629
|
-
}
|
|
555
|
+
}
|
|
556
|
+
// 小图超过一半在视野外时,不展示缩小效果
|
|
630
557
|
// @en When more than half of the thumbnail is outside the field of view, the zoom effect will not be displayed
|
|
631
|
-
|
|
632
|
-
|
|
633
558
|
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) {
|
|
634
559
|
return;
|
|
635
560
|
}
|
|
636
|
-
|
|
637
561
|
var imageDomRect = imageDom.getBoundingClientRect();
|
|
638
|
-
|
|
639
562
|
if (!imageDomRect.width || !imageDomRect.height) {
|
|
640
563
|
return;
|
|
641
564
|
}
|
|
642
|
-
|
|
643
565
|
imageDom.classList.add('closing-animation');
|
|
644
566
|
setImageBounds(imageDom, imageDomRect, imageDomRect);
|
|
645
567
|
imageDom.style.objectPosition = images[index].thumbPosition || 'top center';
|
|
@@ -649,22 +571,19 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
649
571
|
setImageBounds(imageDom, thumbBounds, imageDomRect);
|
|
650
572
|
});
|
|
651
573
|
}
|
|
652
|
-
|
|
653
574
|
function goClose(e) {
|
|
654
575
|
if (closingRef.current) {
|
|
655
576
|
return;
|
|
656
577
|
}
|
|
657
|
-
|
|
658
578
|
closingRef.current = true;
|
|
659
579
|
animateBeforeClose();
|
|
660
580
|
close(e);
|
|
661
581
|
}
|
|
582
|
+
|
|
662
583
|
/**
|
|
663
584
|
* 更改指定图片状态
|
|
664
585
|
* @en Change specified image status
|
|
665
586
|
*/
|
|
666
|
-
|
|
667
|
-
|
|
668
587
|
function setImagesStatusByIndex(index, data) {
|
|
669
588
|
setImagesStatus(function (current) {
|
|
670
589
|
var newStatus = current.slice();
|
|
@@ -672,35 +591,30 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
672
591
|
return newStatus;
|
|
673
592
|
});
|
|
674
593
|
}
|
|
594
|
+
|
|
675
595
|
/**
|
|
676
596
|
* 缩略图放大过渡动画设置
|
|
677
597
|
* @en Set thumbnail zoom transition animation
|
|
678
598
|
*/
|
|
679
|
-
|
|
680
|
-
|
|
681
599
|
function setDisplayAnimation(index) {
|
|
682
600
|
var _imagesStatusRef$curr4, _domRef$current2, _domRef$current2$quer, _domRef$current2$quer2;
|
|
683
|
-
|
|
684
601
|
var firstLoaded = (_imagesStatusRef$curr4 = imagesStatusRef.current[index]) == null ? void 0 : _imagesStatusRef$curr4.firstLoaded;
|
|
685
|
-
var fallbackSrc = replaceFallbackWhenLoaded && firstLoaded ? images[index].src : images[index].fallbackSrc;
|
|
602
|
+
var fallbackSrc = replaceFallbackWhenLoaded && firstLoaded ? images[index].src : images[index].fallbackSrc;
|
|
603
|
+
// 用户设置了getThumbBounds和images的fallbackSrc属性才有放大过渡效果
|
|
686
604
|
// @en Set the fallbackSrc attribute of getThumbBounds and images to have a zoom-in transition effect
|
|
687
|
-
|
|
688
605
|
if (!getThumbBounds || !images[index] || !fallbackSrc) {
|
|
689
606
|
resetAnimation(index);
|
|
690
607
|
return;
|
|
691
|
-
}
|
|
608
|
+
}
|
|
609
|
+
// 获取缩略图的rect,如果没获取到就取消放大过渡效果
|
|
692
610
|
// @en Get the rect of the thumbnail, if it is gotten, cancel the zoom transition effect
|
|
693
|
-
|
|
694
|
-
|
|
695
611
|
var thumbBounds = getThumbBounds(index);
|
|
696
|
-
|
|
697
612
|
if (!thumbBounds || !thumbBounds.width || !thumbBounds.height) {
|
|
698
613
|
resetAnimation(index);
|
|
699
614
|
return;
|
|
700
|
-
}
|
|
615
|
+
}
|
|
616
|
+
// 伪造一个fixed的图做小图放大效果
|
|
701
617
|
// @en Forge a fixed image to make a small image enlargement effect
|
|
702
|
-
|
|
703
|
-
|
|
704
618
|
var transImage = new Image();
|
|
705
619
|
transImageRef.current = transImage;
|
|
706
620
|
transImage.classList.add('image-preview-fake-trans-image');
|
|
@@ -710,25 +624,23 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
710
624
|
transImage.style.opacity = '0';
|
|
711
625
|
transImage.style.transitionDuration = displayDuration + "ms";
|
|
712
626
|
transImage.style.webkitTransitionDuration = displayDuration + "ms";
|
|
713
|
-
(_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);
|
|
627
|
+
(_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);
|
|
628
|
+
// 拿到放大之后的位置rect,没拿到就取消小图放大效果
|
|
714
629
|
// @en Get the zoomed-in position rect, and cancel the zoom-in effect if not getting it
|
|
715
|
-
|
|
716
630
|
getNewImageBounds(index, fallbackSrc, transImage, function (rect) {
|
|
717
631
|
if (!rect || !rect.width || !rect.height) {
|
|
718
632
|
removeChild(transImage);
|
|
719
633
|
resetAnimation(index);
|
|
720
634
|
return;
|
|
721
|
-
}
|
|
635
|
+
}
|
|
636
|
+
// 通过小图rect变换到大图rect加transition做放大效果
|
|
722
637
|
// @en Transform the small image rect to the large image rect and add transition to make a magnification effect
|
|
723
|
-
|
|
724
|
-
|
|
725
638
|
nextTick(function () {
|
|
726
639
|
transImage.style.opacity = '1';
|
|
727
640
|
setImageBounds(transImage, rect, thumbBounds);
|
|
728
641
|
setTimeout(function () {
|
|
729
642
|
setPlaceholders(function (holders) {
|
|
730
643
|
var _extends3;
|
|
731
|
-
|
|
732
644
|
return _extends({}, holders, (_extends3 = {}, _extends3[index] = true, _extends3));
|
|
733
645
|
});
|
|
734
646
|
}, Math.max(0, displayDuration - 80));
|
|
@@ -739,24 +651,22 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
739
651
|
});
|
|
740
652
|
});
|
|
741
653
|
}
|
|
654
|
+
|
|
742
655
|
/**
|
|
743
656
|
* 取消小图放大过渡效果
|
|
744
657
|
* @en Cancel the thumbnail zoom transition effect
|
|
745
658
|
*/
|
|
746
|
-
|
|
747
|
-
|
|
748
659
|
function resetAnimation(index) {
|
|
749
660
|
setImagesStatusByIndex(index, {
|
|
750
661
|
animated: true
|
|
751
662
|
});
|
|
752
663
|
setTransImageInfo(null);
|
|
753
664
|
}
|
|
665
|
+
|
|
754
666
|
/**
|
|
755
667
|
* 根据rect设置图片的位置
|
|
756
668
|
* @en Set the position of the image according to the rect
|
|
757
669
|
*/
|
|
758
|
-
|
|
759
|
-
|
|
760
670
|
function setImageBounds(image, rect, thumbRect) {
|
|
761
671
|
// 这里为保持原有比例,只设置宽度变化,高度会随宽度等比变化
|
|
762
672
|
image.style.width = thumbRect.width + "px";
|
|
@@ -766,18 +676,16 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
766
676
|
image.style.transformOrigin = 'left top';
|
|
767
677
|
image.style.webkitTransformOrigin = 'left top';
|
|
768
678
|
}
|
|
679
|
+
|
|
769
680
|
/**
|
|
770
681
|
* 计算放大之后的位置rect
|
|
771
682
|
* @en Calculate the position rect after zooming in
|
|
772
683
|
*/
|
|
773
|
-
|
|
774
|
-
|
|
775
684
|
function getNewImageBounds(index, transSrc, transImage, callback) {
|
|
776
685
|
if (!transSrc) {
|
|
777
686
|
callback(null);
|
|
778
687
|
return;
|
|
779
688
|
}
|
|
780
|
-
|
|
781
689
|
setTransImageInfo({
|
|
782
690
|
src: transSrc,
|
|
783
691
|
fit: images[index].fit,
|
|
@@ -793,12 +701,11 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
793
701
|
}
|
|
794
702
|
});
|
|
795
703
|
}
|
|
704
|
+
|
|
796
705
|
/**
|
|
797
706
|
* @en 渲染轮播+图片展示
|
|
798
707
|
* Rendering carousel + displaying image
|
|
799
708
|
*/
|
|
800
|
-
|
|
801
|
-
|
|
802
709
|
function renderContent(carouselProps, allImages, getImageProps) {
|
|
803
710
|
return /*#__PURE__*/React.createElement(Carousel, _extends({
|
|
804
711
|
autoPlay: false,
|
|
@@ -825,22 +732,19 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
825
732
|
}, innerNode, image.extraNode);
|
|
826
733
|
}));
|
|
827
734
|
}
|
|
828
|
-
|
|
829
735
|
function getImageClass(index) {
|
|
830
736
|
var _ref = imagesStatus[index] || {},
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
737
|
+
loaded = _ref.loaded,
|
|
738
|
+
animated = _ref.animated;
|
|
834
739
|
return cls('preview-image', {
|
|
835
740
|
'preview-hidden': index === openIndex && (!loaded || !animated)
|
|
836
741
|
});
|
|
837
742
|
}
|
|
743
|
+
|
|
838
744
|
/**
|
|
839
745
|
* 每张图片的样式
|
|
840
746
|
* @en style of each image
|
|
841
747
|
*/
|
|
842
|
-
|
|
843
|
-
|
|
844
748
|
function getImageStyle() {
|
|
845
749
|
// 因为缩放的容器必须是没有transform和transition的纯净元素
|
|
846
750
|
// @en Because the scaled container must be a pure element without transform and transition
|
|
@@ -849,33 +753,31 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
849
753
|
return {
|
|
850
754
|
overflow: 'visible'
|
|
851
755
|
};
|
|
852
|
-
}
|
|
853
|
-
|
|
756
|
+
}
|
|
854
757
|
|
|
758
|
+
// 渲染轮播指引器
|
|
855
759
|
function renderPreviewIndicator(currentIndex, total, lastIndex) {
|
|
856
760
|
if (renderIndicator) {
|
|
857
761
|
return renderIndicator(currentIndex, total, lastIndex);
|
|
858
762
|
}
|
|
859
|
-
|
|
860
763
|
return openLoaded ? /*#__PURE__*/React.createElement(Portal, {
|
|
861
764
|
getContainer: getContainer
|
|
862
765
|
}, /*#__PURE__*/React.createElement("div", {
|
|
863
766
|
className: "image-preview-indicator"
|
|
864
767
|
}, currentIndex + 1, "/", total)) : null;
|
|
865
|
-
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// ios在重设style时图片会消失一下造成闪动,因此在底下垫一张图
|
|
866
771
|
// @en In iOS when resetting the style, the image will disappear and cause flickering, so put a image at the bottom
|
|
867
772
|
// 优先过渡图,其次用原图
|
|
868
773
|
// @en Prioritize the transition image, followed by the original image
|
|
869
|
-
|
|
870
|
-
|
|
871
774
|
function renderImagePlaceholder(src, index, fitCss) {
|
|
872
775
|
var _ref2 = imagesStatus[index] || {},
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
776
|
+
originWidth = _ref2.originWidth,
|
|
777
|
+
originHeight = _ref2.originHeight,
|
|
778
|
+
originLeft = _ref2.originLeft,
|
|
779
|
+
originTop = _ref2.originTop,
|
|
780
|
+
hasOverflow = _ref2.hasOverflow;
|
|
879
781
|
var trans = hasOverflow ? {} : getStyleWithVendor({
|
|
880
782
|
transform: 'translateY(-50%)'
|
|
881
783
|
});
|
|
@@ -893,7 +795,6 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
893
795
|
}, fitObj, trans)
|
|
894
796
|
}) : null;
|
|
895
797
|
}
|
|
896
|
-
|
|
897
798
|
function renderLoadingArea() {
|
|
898
799
|
return /*#__PURE__*/React.createElement("div", {
|
|
899
800
|
className: "image-preview-loading-area"
|
|
@@ -903,7 +804,6 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
903
804
|
radius: 7
|
|
904
805
|
}));
|
|
905
806
|
}
|
|
906
|
-
|
|
907
807
|
return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref3) {
|
|
908
808
|
var prefixCls = _ref3.prefixCls;
|
|
909
809
|
return /*#__PURE__*/React.createElement(Portal, {
|
|
@@ -969,20 +869,17 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
969
869
|
originLeft: imageEle.offsetLeft,
|
|
970
870
|
hasOverflow: imageHasOverflow(imageEle)
|
|
971
871
|
});
|
|
972
|
-
|
|
973
872
|
if (index === openIndex) {
|
|
974
873
|
initTransformer(index);
|
|
975
874
|
} else {
|
|
976
875
|
setPlaceholders(function (holders) {
|
|
977
876
|
var _extends4;
|
|
978
|
-
|
|
979
877
|
return _extends({}, holders, (_extends4 = {}, _extends4[index] = true, _extends4));
|
|
980
878
|
});
|
|
981
879
|
}
|
|
982
880
|
},
|
|
983
881
|
onError: function onError() {
|
|
984
882
|
imageDomsRef.current[index] = null;
|
|
985
|
-
|
|
986
883
|
if (index === openIndex) {
|
|
987
884
|
var transImage = transImageInfo == null ? void 0 : transImageInfo.movingImage;
|
|
988
885
|
removeChild(transImage);
|
|
@@ -1027,6 +924,7 @@ export function methodsGenerator(Comp) {
|
|
|
1027
924
|
};
|
|
1028
925
|
}
|
|
1029
926
|
var ImagePreviewWithGlobalContext = CompWithGlobalContext(ImagePreview);
|
|
927
|
+
|
|
1030
928
|
/**
|
|
1031
929
|
* 图片预览组件,支持循环轮播、双指/双击缩放、缩略图放大效果。
|
|
1032
930
|
* @en The image preview, supports circular rotation, two-finger/double-tap zoom, and thumbnail zoom effects.
|
|
@@ -1035,5 +933,4 @@ var ImagePreviewWithGlobalContext = CompWithGlobalContext(ImagePreview);
|
|
|
1035
933
|
* @name 图片预览
|
|
1036
934
|
* @name_en ImagePreview
|
|
1037
935
|
*/
|
|
1038
|
-
|
|
1039
936
|
export default componentWrapper(ImagePreview, methodsGenerator(ImagePreviewWithGlobalContext));
|