@arco-design/mobile-react 2.24.2 → 2.25.1
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 +29 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/hooks.js +42 -120
- package/cjs/_helpers/index.js +2 -13
- package/cjs/_helpers/react-dom.js +0 -12
- package/cjs/_helpers/render.js +0 -12
- package/cjs/action-sheet/index.js +10 -30
- package/cjs/action-sheet/methods.js +0 -2
- package/cjs/action-sheet/style/css/index.css +1 -1
- 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 +51 -77
- 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.css +3 -2
- 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/demo/style/css/mobile.css +12 -0
- package/cjs/carousel/demo/style/mobile.less +8 -0
- package/cjs/carousel/index.d.ts +1 -1
- package/cjs/carousel/index.js +159 -275
- 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 +14 -23
- 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.d.ts +6 -1
- package/cjs/checkbox/index.js +6 -11
- 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 +27 -56
- 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 +10 -28
- 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.d.ts +5 -2
- package/cjs/date-picker/index.js +52 -114
- package/cjs/date-picker/style/css/index.js +0 -2
- package/cjs/date-picker/style/index.js +0 -2
- package/cjs/dialog/index.js +28 -54
- package/cjs/dialog/methods.js +9 -22
- package/cjs/dialog/style/css/index.css +2 -1
- package/cjs/dialog/style/css/index.js +0 -2
- package/cjs/dialog/style/index.js +0 -2
- 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 +6 -27
- 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 +33 -72
- package/cjs/ellipsis/components/native-ellipsis.js +9 -15
- 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.d.ts +3 -0
- package/cjs/form/form-item-context.js +12 -0
- package/cjs/form/form-item.d.ts +4 -0
- package/cjs/form/form-item.js +313 -0
- package/cjs/form/index.d.ts +16 -0
- package/cjs/form/index.js +96 -0
- package/cjs/form/style/css/index.css +92 -0
- package/cjs/form/style/css/index.d.ts +2 -0
- package/cjs/form/style/css/index.js +4 -0
- package/cjs/form/style/index.d.ts +2 -0
- package/cjs/form/style/index.js +4 -0
- package/cjs/form/style/index.less +91 -0
- package/cjs/form/type.d.ts +371 -0
- package/cjs/form/type.js +30 -0
- package/cjs/form/useForm.d.ts +18 -0
- package/cjs/form/useForm.js +225 -0
- package/cjs/form/utils.d.ts +6 -0
- package/cjs/form/utils.js +36 -0
- package/cjs/grid/index.js +21 -41
- 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/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/IconGift/index.js +5 -12
- package/cjs/icon/IconHeart/index.js +5 -12
- package/cjs/icon/IconHome/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 -111
- package/cjs/image/index.js +53 -92
- 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.d.ts +5 -2
- package/cjs/image-picker/index.js +62 -103
- package/cjs/image-picker/style/css/index.js +0 -2
- package/cjs/image-picker/style/index.js +0 -2
- package/cjs/image-preview/demo/style/css/mobile.css +10 -0
- package/cjs/image-preview/demo/style/mobile.less +11 -0
- package/cjs/image-preview/index.d.ts +5 -0
- package/cjs/image-preview/index.js +124 -239
- package/cjs/image-preview/methods.js +5 -18
- package/cjs/image-preview/style/css/index.css +1 -0
- package/cjs/image-preview/style/css/index.js +0 -4
- package/cjs/image-preview/style/index.js +0 -4
- package/cjs/image-preview/style/index.less +1 -1
- package/cjs/index.d.ts +7 -6
- package/cjs/index.js +15 -120
- package/cjs/input/hooks.js +42 -75
- package/cjs/input/index.d.ts +5 -2
- package/cjs/input/index.js +36 -47
- package/cjs/input/style/css/index.css +1 -1
- package/cjs/input/style/css/index.js +0 -1
- package/cjs/input/style/index.js +0 -1
- package/cjs/load-more/index.js +29 -56
- 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 +46 -79
- package/cjs/masking/methods.js +4 -19
- package/cjs/masking/style/css/index.js +0 -2
- package/cjs/masking/style/index.js +0 -2
- package/cjs/nav-bar/back-icon.js +1 -5
- package/cjs/nav-bar/index.js +36 -60
- 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 +31 -54
- package/cjs/notice-bar/style/css/index.js +0 -1
- package/cjs/notice-bar/style/index.js +0 -1
- package/cjs/notify/index.d.ts +8 -8
- package/cjs/notify/index.js +20 -49
- package/cjs/notify/methods.js +2 -17
- package/cjs/notify/style/css/index.css +2 -2
- 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.d.ts +5 -2
- package/cjs/picker/index.js +50 -89
- package/cjs/picker/style/css/index.js +0 -3
- package/cjs/picker/style/index.js +0 -3
- package/cjs/picker-view/components/cascader.js +14 -31
- package/cjs/picker-view/components/multi-picker.js +6 -20
- package/cjs/picker-view/components/picker-cell.js +45 -97
- package/cjs/picker-view/index.d.ts +5 -2
- package/cjs/picker-view/index.js +36 -77
- 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 +94 -151
- package/cjs/popover/index.js +1 -8
- package/cjs/popover/menu.js +32 -51
- package/cjs/popover/popover-inner.js +30 -47
- 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 +38 -80
- 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 +58 -100
- package/cjs/pull-refresh/hooks.js +11 -32
- package/cjs/pull-refresh/index.d.ts +9 -3
- package/cjs/pull-refresh/index.js +5 -15
- package/cjs/pull-refresh/ios-pull-refresh.js +53 -80
- 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.d.ts +6 -1
- package/cjs/radio/index.js +5 -10
- 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.d.ts +5 -2
- package/cjs/rate/index.js +34 -57
- 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 +34 -93
- package/cjs/show-monitor/style/css/index.js +0 -1
- package/cjs/show-monitor/style/index.js +0 -1
- package/cjs/slider/hooks/index.js +0 -13
- package/cjs/slider/hooks/useSliderEvents.js +26 -55
- package/cjs/slider/hooks/useSliderIcon.js +6 -20
- package/cjs/slider/hooks/useSliderInit.js +32 -52
- package/cjs/slider/hooks/useSliderStyle.js +12 -24
- package/cjs/slider/index.d.ts +5 -2
- package/cjs/slider/index.js +56 -80
- package/cjs/slider/marks.js +12 -26
- 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 +8 -23
- package/cjs/stepper/hooks/useButtonClick.js +19 -28
- package/cjs/stepper/hooks/useInputEvent.js +9 -18
- package/cjs/stepper/hooks/useValue.js +9 -14
- package/cjs/stepper/index.d.ts +5 -2
- package/cjs/stepper/index.js +92 -103
- package/cjs/stepper/style/css/index.js +0 -1
- package/cjs/stepper/style/index.js +0 -1
- package/cjs/steps/index.js +22 -40
- package/cjs/steps/step.js +10 -27
- package/cjs/steps/style/css/index.css +2 -2
- package/cjs/steps/style/css/index.js +0 -1
- package/cjs/steps/style/index.js +0 -1
- package/cjs/sticky/index.js +37 -66
- package/cjs/sticky/style/css/index.js +0 -1
- package/cjs/sticky/style/index.js +0 -1
- package/cjs/style.d.ts +7 -6
- package/cjs/style.js +7 -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 +55 -83
- package/cjs/swipe-load/style/css/index.js +0 -1
- package/cjs/swipe-load/style/index.js +0 -1
- package/cjs/switch/index.d.ts +5 -2
- package/cjs/switch/index.js +37 -54
- 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 +15 -31
- package/cjs/tabs/index.js +129 -192
- package/cjs/tabs/style/css/index.js +0 -1
- package/cjs/tabs/style/index.js +0 -1
- package/cjs/tabs/tab-cell-underline.js +25 -64
- package/cjs/tabs/tab-cell.js +66 -108
- package/cjs/tabs/tab-pane.js +49 -94
- 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.d.ts +5 -2
- package/cjs/textarea/index.js +45 -63
- package/cjs/textarea/style/css/index.css +1 -1
- package/cjs/textarea/style/css/index.js +0 -2
- package/cjs/textarea/style/index.js +0 -2
- package/cjs/toast/index.d.ts +12 -12
- 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 +10 -18
- package/cjs/transition/style/css/index.js +0 -1
- package/cjs/transition/style/index.js +0 -1
- package/dist/index.js +21030 -20541
- package/dist/index.min.js +12 -3
- package/dist/style.css +823 -741
- package/dist/style.min.css +1 -1
- package/esm/_helpers/hooks.js +41 -99
- package/esm/_helpers/index.js +2 -3
- package/esm/_helpers/react-dom.js +0 -10
- package/esm/_helpers/render.js +0 -7
- package/esm/action-sheet/index.js +10 -16
- package/esm/action-sheet/style/css/index.css +1 -1
- package/esm/avatar/group.js +12 -16
- package/esm/avatar/index.js +51 -62
- package/esm/badge/index.js +18 -22
- package/esm/badge/style/css/index.css +3 -2
- package/esm/button/hooks.js +15 -18
- package/esm/button/index.js +46 -57
- package/esm/carousel/demo/style/css/mobile.css +12 -0
- package/esm/carousel/demo/style/mobile.less +8 -0
- package/esm/carousel/index.d.ts +1 -1
- package/esm/carousel/index.js +159 -267
- package/esm/cell/cell.js +14 -14
- 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.d.ts +6 -1
- package/esm/checkbox/index.js +6 -4
- package/esm/checkbox/type.js +0 -1
- package/esm/circle-progress/index.js +37 -49
- package/esm/collapse/collapse.js +27 -46
- 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 +10 -18
- 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.d.ts +5 -2
- package/esm/date-picker/index.js +53 -103
- package/esm/dialog/index.js +28 -39
- package/esm/dialog/methods.js +9 -11
- package/esm/dialog/style/css/index.css +2 -1
- 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 +6 -16
- package/esm/dropdown-menu/index.js +1 -1
- package/esm/ellipsis/components/js-ellipsis.js +33 -63
- 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-context.d.ts +3 -0
- package/esm/form/form-item-context.js +6 -0
- package/esm/form/form-item.d.ts +4 -0
- package/esm/form/form-item.js +306 -0
- package/esm/form/index.d.ts +16 -0
- package/esm/form/index.js +79 -0
- package/esm/form/style/css/index.css +92 -0
- package/esm/form/style/css/index.d.ts +2 -0
- package/esm/form/style/css/index.js +2 -0
- package/esm/form/style/index.d.ts +2 -0
- package/esm/form/style/index.js +2 -0
- package/esm/form/style/index.less +91 -0
- package/esm/form/type.d.ts +371 -0
- package/esm/form/type.js +24 -0
- package/esm/form/useForm.d.ts +18 -0
- package/esm/form/useForm.js +217 -0
- package/esm/form/utils.d.ts +6 -0
- package/esm/form/utils.js +30 -0
- package/esm/grid/index.js +21 -34
- 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/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/IconGift/index.js +5 -6
- package/esm/icon/IconHeart/index.js +5 -6
- package/esm/icon/IconHome/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 -83
- package/esm/image-picker/index.d.ts +5 -2
- package/esm/image-picker/index.js +63 -90
- package/esm/image-preview/demo/style/css/mobile.css +10 -0
- package/esm/image-preview/demo/style/mobile.less +11 -0
- package/esm/image-preview/index.d.ts +5 -0
- package/esm/image-preview/index.js +124 -218
- package/esm/image-preview/methods.js +4 -14
- package/esm/image-preview/style/css/index.css +1 -0
- package/esm/image-preview/style/index.less +1 -1
- package/esm/index.d.ts +7 -6
- package/esm/index.js +7 -6
- package/esm/input/hooks.js +42 -67
- package/esm/input/index.d.ts +5 -2
- package/esm/input/index.js +37 -40
- package/esm/input/style/css/index.css +1 -1
- package/esm/load-more/index.js +29 -48
- package/esm/loading/index.js +19 -40
- package/esm/masking/index.js +46 -64
- package/esm/masking/methods.js +4 -15
- package/esm/nav-bar/back-icon.js +1 -3
- package/esm/nav-bar/index.js +36 -51
- package/esm/notice-bar/index.js +31 -47
- package/esm/notify/index.d.ts +8 -8
- package/esm/notify/index.js +20 -33
- package/esm/notify/methods.js +2 -13
- package/esm/notify/style/css/index.css +2 -2
- package/esm/pagination/index.js +27 -50
- package/esm/picker/index.d.ts +5 -2
- package/esm/picker/index.js +51 -76
- package/esm/picker-view/components/cascader.js +14 -23
- package/esm/picker-view/components/multi-picker.js +6 -16
- package/esm/picker-view/components/picker-cell.js +45 -89
- package/esm/picker-view/index.d.ts +5 -2
- package/esm/picker-view/index.js +36 -63
- package/esm/popover/hooks/useEvent.js +26 -41
- package/esm/popover/hooks/usePosition.js +94 -144
- package/esm/popover/index.js +2 -2
- package/esm/popover/menu.js +32 -41
- package/esm/popover/popover-inner.js +30 -38
- package/esm/popover/popover.js +69 -90
- package/esm/popup/index.js +22 -25
- package/esm/popup-swiper/index.js +38 -64
- package/esm/portal/index.js +3 -5
- package/esm/progress/index.js +27 -36
- package/esm/pull-refresh/android-pull-refresh.js +58 -90
- package/esm/pull-refresh/hooks.js +11 -23
- package/esm/pull-refresh/index.d.ts +9 -3
- package/esm/pull-refresh/index.js +5 -6
- 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.d.ts +6 -1
- package/esm/radio/index.js +5 -3
- package/esm/rate/index.d.ts +5 -2
- package/esm/rate/index.js +35 -49
- 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 +34 -85
- package/esm/slider/hooks/useSliderEvents.js +26 -51
- package/esm/slider/hooks/useSliderIcon.js +6 -13
- package/esm/slider/hooks/useSliderInit.js +32 -46
- package/esm/slider/hooks/useSliderStyle.js +12 -20
- package/esm/slider/index.d.ts +5 -2
- package/esm/slider/index.js +57 -72
- package/esm/slider/marks.js +12 -18
- package/esm/slider/popover.js +4 -6
- package/esm/slider/thumb.js +8 -15
- package/esm/stepper/hooks/useButtonClick.js +19 -27
- package/esm/stepper/hooks/useInputEvent.js +9 -16
- package/esm/stepper/hooks/useValue.js +9 -12
- package/esm/stepper/index.d.ts +5 -2
- package/esm/stepper/index.js +93 -92
- package/esm/steps/index.js +22 -27
- package/esm/steps/step.js +10 -19
- package/esm/steps/style/css/index.css +2 -2
- package/esm/sticky/index.js +37 -57
- package/esm/style.d.ts +7 -6
- package/esm/style.js +7 -6
- package/esm/swipe-action/index.js +40 -80
- package/esm/swipe-action/item.js +9 -12
- package/esm/swipe-load/index.js +56 -75
- package/esm/switch/index.d.ts +5 -2
- package/esm/switch/index.js +38 -49
- package/esm/tab-bar/index.js +0 -1
- package/esm/tab-bar/item.js +6 -13
- package/esm/tab-bar/tab-bar.js +15 -21
- package/esm/tabs/index.js +130 -180
- package/esm/tabs/tab-cell-underline.js +25 -56
- package/esm/tabs/tab-cell.js +66 -98
- package/esm/tabs/tab-pane.js +49 -85
- 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.d.ts +5 -2
- package/esm/textarea/index.js +46 -56
- package/esm/textarea/style/css/index.css +1 -1
- package/esm/toast/index.d.ts +12 -12
- package/esm/toast/index.js +26 -42
- package/esm/toast/methods.js +2 -12
- package/esm/transition/index.js +10 -12
- package/package.json +3 -4
- package/tokens/app/arcodesign/default/css-variables.less +17 -7
- package/tokens/app/arcodesign/default/index.d.ts +10 -0
- package/tokens/app/arcodesign/default/index.js +18 -10
- package/tokens/app/arcodesign/default/index.json +139 -23
- package/tokens/app/arcodesign/default/index.less +17 -7
- package/umd/_helpers/hooks.js +42 -117
- package/umd/_helpers/index.js +2 -6
- package/umd/_helpers/react-dom.js +0 -11
- package/umd/_helpers/render.js +0 -9
- package/umd/action-sheet/index.js +10 -22
- package/umd/action-sheet/methods.js +0 -1
- package/umd/action-sheet/style/css/index.css +1 -1
- package/umd/avatar/group.js +12 -20
- package/umd/avatar/index.js +51 -68
- package/umd/badge/index.js +18 -25
- package/umd/badge/style/css/index.css +3 -2
- package/umd/button/hooks.js +15 -19
- package/umd/button/index.js +46 -60
- package/umd/carousel/demo/style/css/mobile.css +12 -0
- package/umd/carousel/demo/style/mobile.less +8 -0
- package/umd/carousel/index.d.ts +1 -1
- package/umd/carousel/index.js +159 -270
- package/umd/cell/arrow.js +0 -2
- package/umd/cell/cell.js +14 -18
- 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.d.ts +6 -1
- package/umd/checkbox/index.js +6 -6
- package/umd/checkbox/type.js +0 -2
- package/umd/circle-progress/index.js +37 -52
- package/umd/collapse/collapse.js +27 -50
- 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 +10 -23
- 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.d.ts +5 -2
- package/umd/date-picker/index.js +52 -105
- package/umd/dialog/index.js +28 -44
- package/umd/dialog/methods.js +9 -18
- package/umd/dialog/style/css/index.css +2 -1
- 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 +6 -25
- package/umd/dropdown-menu/index.js +0 -2
- package/umd/ellipsis/components/js-ellipsis.js +33 -69
- package/umd/ellipsis/components/native-ellipsis.js +9 -13
- 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.d.ts +3 -0
- package/umd/form/form-item-context.js +25 -0
- package/umd/form/form-item.d.ts +4 -0
- package/umd/form/form-item.js +322 -0
- package/umd/form/index.d.ts +16 -0
- package/umd/form/index.js +106 -0
- package/umd/form/style/css/index.css +92 -0
- package/umd/form/style/css/index.d.ts +2 -0
- package/umd/form/style/css/index.js +15 -0
- package/umd/form/style/index.d.ts +2 -0
- package/umd/form/style/index.js +15 -0
- package/umd/form/style/index.less +91 -0
- package/umd/form/type.d.ts +371 -0
- package/umd/form/type.js +44 -0
- package/umd/form/useForm.d.ts +18 -0
- package/umd/form/useForm.js +238 -0
- package/umd/form/utils.d.ts +6 -0
- package/umd/form/utils.js +50 -0
- package/umd/grid/index.js +21 -37
- 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/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/IconGift/index.js +5 -7
- package/umd/icon/IconHeart/index.js +5 -7
- package/umd/icon/IconHome/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 -86
- package/umd/image-picker/add-icon.js +0 -2
- package/umd/image-picker/index.d.ts +5 -2
- package/umd/image-picker/index.js +62 -92
- package/umd/image-preview/demo/style/css/mobile.css +10 -0
- package/umd/image-preview/demo/style/mobile.less +11 -0
- package/umd/image-preview/index.d.ts +5 -0
- package/umd/image-preview/index.js +124 -224
- package/umd/image-preview/methods.js +5 -15
- package/umd/image-preview/style/css/index.css +1 -0
- package/umd/image-preview/style/index.less +1 -1
- package/umd/index.d.ts +7 -6
- package/umd/index.js +19 -18
- package/umd/input/hooks.js +42 -71
- package/umd/input/index.d.ts +5 -2
- package/umd/input/index.js +36 -42
- package/umd/input/style/css/index.css +1 -1
- package/umd/load-more/index.js +29 -51
- package/umd/loading/index.js +19 -43
- package/umd/masking/index.js +46 -71
- package/umd/masking/methods.js +4 -16
- package/umd/nav-bar/back-icon.js +1 -4
- package/umd/nav-bar/index.js +36 -54
- package/umd/notice-bar/index.js +31 -50
- package/umd/notify/index.d.ts +8 -8
- package/umd/notify/index.js +20 -40
- package/umd/notify/methods.js +2 -14
- package/umd/notify/style/css/index.css +2 -2
- package/umd/pagination/arrow.js +0 -2
- package/umd/pagination/index.js +27 -53
- package/umd/picker/index.d.ts +5 -2
- package/umd/picker/index.js +50 -78
- package/umd/picker-view/components/cascader.js +14 -27
- package/umd/picker-view/components/multi-picker.js +6 -19
- package/umd/picker-view/components/picker-cell.js +45 -93
- package/umd/picker-view/index.d.ts +5 -2
- package/umd/picker-view/index.js +39 -69
- package/umd/popover/hooks/useEvent.js +25 -44
- package/umd/popover/hooks/usePosition.js +94 -145
- package/umd/popover/index.js +1 -3
- package/umd/popover/menu.js +32 -45
- package/umd/popover/popover-inner.js +30 -42
- 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 +38 -71
- 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 +58 -93
- package/umd/pull-refresh/hooks.js +11 -29
- package/umd/pull-refresh/index.d.ts +9 -3
- package/umd/pull-refresh/index.js +5 -8
- 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.d.ts +6 -1
- package/umd/radio/index.js +5 -5
- package/umd/radio/radio.js +0 -5
- package/umd/rate/index.d.ts +5 -2
- package/umd/rate/index.js +34 -51
- 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 +34 -89
- package/umd/slider/hooks/index.js +0 -4
- package/umd/slider/hooks/useSliderEvents.js +26 -52
- package/umd/slider/hooks/useSliderIcon.js +6 -17
- package/umd/slider/hooks/useSliderInit.js +32 -50
- package/umd/slider/hooks/useSliderStyle.js +12 -22
- package/umd/slider/index.d.ts +5 -2
- package/umd/slider/index.js +56 -73
- package/umd/slider/marks.js +12 -21
- package/umd/slider/popover.js +4 -10
- package/umd/slider/thumb.js +8 -18
- package/umd/stepper/hooks/useButtonClick.js +19 -27
- package/umd/stepper/hooks/useInputEvent.js +9 -17
- package/umd/stepper/hooks/useValue.js +9 -13
- package/umd/stepper/index.d.ts +5 -2
- package/umd/stepper/index.js +92 -94
- package/umd/steps/index.js +22 -32
- package/umd/steps/step.js +10 -22
- package/umd/steps/style/css/index.css +2 -2
- package/umd/sticky/index.js +37 -60
- package/umd/style.d.ts +7 -6
- package/umd/style.js +4 -4
- package/umd/swipe-action/index.js +40 -84
- package/umd/swipe-action/item.js +9 -14
- package/umd/swipe-load/index.js +55 -77
- package/umd/switch/index.d.ts +5 -2
- package/umd/switch/index.js +37 -50
- package/umd/tab-bar/index.js +0 -2
- package/umd/tab-bar/item.js +6 -19
- package/umd/tab-bar/tab-bar.js +15 -26
- package/umd/tabs/index.js +129 -183
- package/umd/tabs/tab-cell-underline.js +25 -60
- package/umd/tabs/tab-cell.js +66 -103
- package/umd/tabs/tab-pane.js +49 -89
- 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.d.ts +5 -2
- package/umd/textarea/index.js +45 -58
- package/umd/textarea/style/css/index.css +1 -1
- package/umd/toast/index.d.ts +12 -12
- package/umd/toast/index.js +26 -49
- package/umd/toast/methods.js +2 -13
- package/umd/transition/index.js +10 -12
@@ -17,54 +17,52 @@ 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
|
-
|
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
|
+
getMinScale = props.getMinScale,
|
48
|
+
getMaxScale = props.getMaxScale,
|
49
|
+
getDoubleClickScale = props.getDoubleClickScale,
|
50
|
+
getContainer = props.getContainer,
|
51
|
+
getThumbBounds = props.getThumbBounds,
|
52
|
+
renderIndicator = props.renderIndicator,
|
53
|
+
_onChange = props.onChange,
|
54
|
+
_onAfterChange = props.onAfterChange,
|
55
|
+
onImageClick = props.onImageClick,
|
56
|
+
onImageDoubleClick = props.onImageDoubleClick,
|
57
|
+
onImageLongTap = props.onImageLongTap,
|
58
|
+
close = props.close,
|
59
|
+
onClose = props.onClose,
|
60
|
+
onTouchStart = props.onTouchStart,
|
61
|
+
onTouchMove = props.onTouchMove,
|
62
|
+
onTouchEnd = props.onTouchEnd,
|
63
|
+
_props$indicatorPos = props.indicatorPos,
|
64
|
+
indicatorPos = _props$indicatorPos === void 0 ? 'start' : _props$indicatorPos,
|
65
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
68
66
|
var system = useSystem();
|
69
67
|
var domRef = useRef(null);
|
70
68
|
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(document.querySelector('.image-preview-fake-trans-image'));
|
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,36 +175,31 @@ 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
|
child && document.body.removeChild(child);
|
192
181
|
} catch (e) {}
|
193
|
-
}
|
194
|
-
// @en Monitor the operation of sliding out after sliding to the upper and lower edges, then close the popup
|
195
|
-
|
182
|
+
}
|
196
183
|
|
184
|
+
// 监听滑动到上下边缘后还在往外滑动的操作,则关闭弹窗
|
185
|
+
// @en Monitor the operation of sliding out after sliding to the upper and lower edges, then close the popup
|
197
186
|
function handlePreventCallback(_, dir) {
|
198
187
|
if (!isTransforming() && dir === 'y') {
|
199
188
|
touchingSideDisRef.current += 1;
|
200
189
|
}
|
201
190
|
}
|
191
|
+
|
202
192
|
/**
|
203
193
|
* 缩放插件初始化
|
204
194
|
* @en Zoom plugin initialization
|
205
195
|
*/
|
206
|
-
|
207
|
-
|
208
196
|
function initTransformer(index) {
|
209
197
|
var _imagesRef$current$in;
|
210
|
-
|
211
198
|
var imageDom = (_imagesRef$current$in = imagesRef.current[index]) == null ? void 0 : _imagesRef$current$in.dom;
|
212
199
|
var wrapDom = imageDom == null ? void 0 : imageDom.parentElement;
|
213
|
-
|
214
200
|
if (!imageDom || !wrapDom) {
|
215
201
|
return;
|
216
202
|
}
|
217
|
-
|
218
203
|
if (transformersRef.current[index]) {
|
219
204
|
transformersRef.current[index].setDom(wrapDom);
|
220
205
|
} else {
|
@@ -233,16 +218,15 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
233
218
|
},
|
234
219
|
onTransform: function onTransform() {
|
235
220
|
var _transformersRef$curr, _imagesStatusRef$curr2, _imagesStatusRef$curr3;
|
236
|
-
|
237
221
|
// 图片放大再缩小,解决ios图片放大后模糊的问题
|
238
222
|
// @en The image is zoomed in and then zoomed out to solve the problem of blurring after zooming in on ios images
|
239
223
|
var img = imageDomsRef.current[index];
|
240
224
|
var trans = ((_transformersRef$curr = transformersRef.current[index]) == null ? void 0 : _transformersRef$curr.getTransform == null ? void 0 : _transformersRef$curr.getTransform()) || {};
|
241
225
|
var width = (_imagesStatusRef$curr2 = imagesStatusRef.current[index]) == null ? void 0 : _imagesStatusRef$curr2.originWidth;
|
242
226
|
var height = (_imagesStatusRef$curr3 = imagesStatusRef.current[index]) == null ? void 0 : _imagesStatusRef$curr3.originHeight;
|
243
|
-
var scale = trans.scale || 1;
|
227
|
+
var scale = trans.scale || 1;
|
228
|
+
// 判断下只有图片缩放发生改变时重写图片样式
|
244
229
|
// @en It is judged that only the image style is rewritten when the zoom of the image changes.
|
245
|
-
|
246
230
|
if (img && width && height && lastScaleRef.current !== scale) {
|
247
231
|
lastScaleRef.current = scale;
|
248
232
|
var atCenter = !imageHasOverflow(img) ? ' translateY(-50%)' : '';
|
@@ -261,23 +245,18 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
261
245
|
onZoomEnd: function onZoomEnd(_1, _2, pinchStartCenter) {
|
262
246
|
setPlaceholders(function (holders) {
|
263
247
|
var _extends2;
|
264
|
-
|
265
248
|
return _extends({}, holders, (_extends2 = {}, _extends2[index] = false, _extends2));
|
266
249
|
});
|
267
250
|
var image = imageDomsRef.current[index];
|
268
251
|
var transformer = transformersRef.current[index];
|
269
|
-
|
270
252
|
if (!image || !transformer || transformer.getTransform().scale < 1) {
|
271
253
|
return;
|
272
254
|
}
|
273
|
-
|
274
255
|
var imageRect = image.getBoundingClientRect();
|
275
|
-
|
276
256
|
if (imageRect.width > windowWidth && imageRect.height > windowHeight) {
|
277
257
|
if (pinchStartCenter && pinchStartCenter.length) {
|
278
258
|
transformer.setCenter.apply(transformer, pinchStartCenter);
|
279
259
|
}
|
280
|
-
|
281
260
|
transformer.setFixedX(false);
|
282
261
|
transformer.setFixedY(false);
|
283
262
|
} else if (imageRect.height <= windowHeight) {
|
@@ -296,24 +275,19 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
296
275
|
maxScale: getImageMaxScale(index)
|
297
276
|
});
|
298
277
|
}
|
299
|
-
|
300
278
|
setOriginBoundary(index);
|
301
279
|
}
|
302
|
-
|
303
280
|
function imageHasOverflow(img) {
|
304
281
|
return Boolean(img && !img.classList.contains('preview-fit-contain-y'));
|
305
282
|
}
|
306
|
-
|
307
283
|
function setOriginBoundary(index) {
|
308
284
|
var imageEle = imagesRef.current[index];
|
309
|
-
var imageDom = imageEle == null ? void 0 : imageEle.dom;
|
285
|
+
var imageDom = imageEle == null ? void 0 : imageEle.dom;
|
286
|
+
// 边界范围变为图片范围和容器范围的并集
|
310
287
|
// @en The bounding range becomes the union of the image range and the container range
|
311
|
-
|
312
288
|
if (imageDom != null && imageDom.parentElement && imageEle != null && imageEle.image) {
|
313
289
|
var _rect = imageEle.image.getBoundingClientRect();
|
314
|
-
|
315
290
|
var eleRect = imageDom.parentElement.getBoundingClientRect();
|
316
|
-
|
317
291
|
if (transformersRef.current[index]) {
|
318
292
|
transformersRef.current[index].setBoundary({
|
319
293
|
left: Math.min(_rect.left, eleRect.left),
|
@@ -324,137 +298,111 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
324
298
|
}
|
325
299
|
}
|
326
300
|
}
|
301
|
+
|
327
302
|
/**
|
328
303
|
* 获取最小缩放倍数
|
329
304
|
* @en Get the minimum zoom factor
|
330
305
|
*/
|
331
|
-
|
332
|
-
|
333
306
|
function getImageMinScale(index) {
|
334
307
|
var currentIndex = index === void 0 ? innerIndexRef.current : index;
|
335
308
|
var imageDom = imageDomsRef.current[currentIndex];
|
336
|
-
|
337
309
|
if (!imageDom) {
|
338
310
|
return 1;
|
339
311
|
}
|
340
|
-
|
341
312
|
if (getMinScale) {
|
342
313
|
return getMinScale(imageDom, currentIndex);
|
343
314
|
}
|
344
|
-
|
345
315
|
return MIN_ZOOM;
|
346
316
|
}
|
317
|
+
|
347
318
|
/**
|
348
319
|
* 获取最大缩放倍数
|
349
320
|
* @en Get the maximum zoom factor
|
350
321
|
*/
|
351
|
-
|
352
|
-
|
353
322
|
function getImageMaxScale(index) {
|
354
323
|
var currentIndex = index === void 0 ? innerIndexRef.current : index;
|
355
324
|
var imageDom = imageDomsRef.current[currentIndex];
|
356
|
-
|
357
325
|
if (!imageDom) {
|
358
326
|
return 1;
|
359
327
|
}
|
360
|
-
|
361
328
|
if (getMaxScale) {
|
362
329
|
return getMaxScale(imageDom, currentIndex);
|
363
330
|
}
|
364
|
-
|
365
331
|
var imageWidth = imageDom.naturalWidth;
|
366
332
|
var imageHeight = imageDom.naturalHeight;
|
367
333
|
var maxScale = 1;
|
368
|
-
|
369
334
|
if (imageWidth > imageHeight) {
|
370
335
|
maxScale = imageWidth / windowWidth * MAX_ZOOM;
|
371
336
|
} else {
|
372
337
|
maxScale = Math.max(MAX_ZOOM, imageWidth / windowWidth);
|
373
338
|
}
|
374
|
-
|
375
339
|
return maxScale;
|
376
340
|
}
|
341
|
+
|
377
342
|
/**
|
378
343
|
* 计算双击时图片缩放倍数
|
379
344
|
* @en Calculate the zoom factor of the image when double-clicking
|
380
345
|
*/
|
381
|
-
|
382
|
-
|
383
346
|
function getImageDoubleClickScale(currentScale) {
|
384
347
|
var index = innerIndexRef.current;
|
385
348
|
var imageDom = imageDomsRef.current[index];
|
386
|
-
|
387
349
|
if (!imageDom) {
|
388
350
|
return 1;
|
389
351
|
}
|
390
|
-
|
391
352
|
var maxScale = getImageMaxScale(index);
|
392
|
-
|
393
353
|
if (getDoubleClickScale) {
|
394
354
|
return getDoubleClickScale(currentScale, maxScale, imageDom, index);
|
395
355
|
}
|
396
|
-
|
397
356
|
var imageWidth = imageDom.naturalWidth;
|
398
357
|
var imageHeight = imageDom.naturalHeight;
|
399
358
|
var fitScale = imageWidth > imageHeight ? imageWidth / windowWidth * windowHeight / imageHeight : 1;
|
400
359
|
var dblScale = 2;
|
401
|
-
|
402
360
|
if (fitScale >= 2) {
|
403
361
|
dblScale = Math.min(maxScale, fitScale);
|
404
362
|
}
|
405
|
-
|
406
363
|
var current = Number(currentScale.toFixed(3));
|
407
364
|
var dbl = Number(dblScale.toFixed(3));
|
408
365
|
return current >= 1 && current < dbl ? dbl : 1;
|
409
366
|
}
|
367
|
+
|
410
368
|
/**
|
411
369
|
* 还原缩放至原始位置
|
412
370
|
* @en Revert zoom to original position
|
413
371
|
*/
|
414
|
-
|
415
|
-
|
416
372
|
function restoreTransformer(index) {
|
417
373
|
var transformer = transformersRef.current[index];
|
418
|
-
|
419
374
|
if (transformer) {
|
420
375
|
transformer.restore();
|
421
376
|
}
|
422
377
|
}
|
378
|
+
|
423
379
|
/**
|
424
380
|
* 是否正处于缩放状态
|
425
381
|
* @en Whether it is zooming
|
426
382
|
*/
|
427
|
-
|
428
|
-
|
429
383
|
function isTransforming(index) {
|
430
384
|
var _transformersRef$curr2;
|
431
|
-
|
432
385
|
var currentIndex = index === void 0 ? innerIndexRef.current : index;
|
433
386
|
return (_transformersRef$curr2 = transformersRef.current[currentIndex]) == null ? void 0 : _transformersRef$curr2.busy == null ? void 0 : _transformersRef$curr2.busy();
|
434
387
|
}
|
388
|
+
|
435
389
|
/**
|
436
390
|
* 是否已经放大过
|
437
391
|
* @en Whether is has been zoomed in
|
438
392
|
*/
|
439
|
-
|
440
|
-
|
441
393
|
function isTransformed() {
|
442
394
|
var _transformersRef$curr3;
|
443
|
-
|
444
395
|
return (_transformersRef$curr3 = transformersRef.current[innerIndexRef.current]) == null ? void 0 : _transformersRef$curr3.dirty == null ? void 0 : _transformersRef$curr3.dirty();
|
445
396
|
}
|
446
|
-
|
447
397
|
function isTapStop() {
|
448
398
|
var _transformersRef$curr4;
|
449
|
-
|
450
399
|
return (_transformersRef$curr4 = transformersRef.current[innerIndexRef.current]) == null ? void 0 : _transformersRef$curr4.isTapStop == null ? void 0 : _transformersRef$curr4.isTapStop();
|
451
400
|
}
|
401
|
+
|
452
402
|
/**
|
453
403
|
* 计算距离左右侧的距离,如果为0说明到边缘了,可以进行正常轮播操作
|
454
404
|
* @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.
|
455
405
|
*/
|
456
|
-
|
457
|
-
|
458
406
|
function transformTouchSide() {
|
459
407
|
var transformer = transformersRef.current[innerIndexRef.current];
|
460
408
|
var toLeft = transformer == null ? void 0 : transformer.toLeft == null ? void 0 : transformer.toLeft();
|
@@ -465,23 +413,20 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
465
413
|
right: !toRight
|
466
414
|
};
|
467
415
|
}
|
468
|
-
|
469
416
|
function handleImageWrapTouchStart(e) {
|
470
417
|
if (onTouchStart && onTouchStart(e, innerIndexRef.current)) {
|
471
418
|
return true;
|
472
419
|
}
|
473
|
-
|
474
420
|
var touches = e.touches;
|
475
421
|
touchStartXRef.current = e.touches && e.touches[0] ? e.touches[0].clientX : 0;
|
476
422
|
movedRef.current = false;
|
477
|
-
dblClickingRef.current = false;
|
423
|
+
dblClickingRef.current = false;
|
424
|
+
// 单点长按才触发长按
|
478
425
|
// @en A single long press triggers a long press
|
479
|
-
|
480
426
|
if (touches.length === 1) {
|
481
427
|
if (!closingRef.current) {
|
482
428
|
longTapCheckingRef.current = true;
|
483
429
|
}
|
484
|
-
|
485
430
|
longTimerRef.current = window.setTimeout(function () {
|
486
431
|
if (longTapCheckingRef.current) {
|
487
432
|
longTapCheckingRef.current = false;
|
@@ -492,72 +437,61 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
492
437
|
} else {
|
493
438
|
longTapCheckingRef.current = false;
|
494
439
|
}
|
495
|
-
|
496
440
|
if (isTapStop()) {
|
497
441
|
movedRef.current = true;
|
498
|
-
}
|
442
|
+
}
|
443
|
+
// 缩放状态下,未到边缘时不触发轮播手势
|
499
444
|
// @en In the zoomed state, the carousel gesture is not triggered when the edge is not reached
|
500
|
-
|
501
|
-
|
502
445
|
if (isTransforming()) {
|
503
446
|
startTouchingSideRef.current = transformTouchSide().side;
|
504
447
|
return !startTouchingSideRef.current;
|
505
448
|
}
|
506
449
|
}
|
507
|
-
|
508
450
|
function handleImageWrapTouchMove(e) {
|
509
451
|
movedRef.current = true;
|
510
452
|
longTapCheckingRef.current = false;
|
511
453
|
longTimerRef.current && clearTimeout(longTimerRef.current);
|
512
|
-
|
513
454
|
if (onTouchMove && onTouchMove(e, innerIndexRef.current)) {
|
514
455
|
return true;
|
515
456
|
}
|
516
|
-
|
517
457
|
var evt = e.changedTouches[0];
|
518
458
|
var touchMoveX = evt.clientX || 0;
|
519
|
-
var posDisX = touchMoveX - touchStartXRef.current;
|
459
|
+
var posDisX = touchMoveX - touchStartXRef.current;
|
460
|
+
// 缩放状态下,到边缘时如果还在往外滑动,则触发轮播手势
|
520
461
|
// @en In the zoomed state, if it is still swiped out when reaching the edge, the carousel gesture is triggered
|
521
|
-
|
522
462
|
if (isTransforming()) {
|
523
463
|
var sideInfo = transformTouchSide();
|
524
464
|
return !startTouchingSideRef.current || !(sideInfo.left && posDisX > 0 || sideInfo.right && posDisX < 0);
|
525
465
|
}
|
526
466
|
}
|
527
|
-
|
528
467
|
function handleImageWrapTouchEnd(e) {
|
529
468
|
if (onTouchEnd && onTouchEnd(e, innerIndexRef.current)) {
|
530
469
|
return true;
|
531
|
-
}
|
470
|
+
}
|
471
|
+
// 滑动到上下边缘后还在往外滑动,则关闭弹窗
|
532
472
|
// @en After sliding to the upper and lower edges and still sliding outwards, close the popup box
|
533
473
|
// needClose为触发touchmove的次数,6和3是相对值,表示判断在往外滑动的敏感度,当未放大时对向外滑动手势更敏感
|
534
474
|
// @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
|
535
|
-
|
536
|
-
|
537
475
|
var needClose = swipeToClose && touchingSideDisRef.current >= (isTransformed() ? 6 : 3);
|
538
476
|
touchingSideDisRef.current = 0;
|
539
477
|
longTapCheckingRef.current = false;
|
540
478
|
longTimerRef.current && clearTimeout(longTimerRef.current);
|
541
|
-
|
542
479
|
if (needClose) {
|
543
480
|
goClose(e);
|
544
481
|
return true;
|
545
|
-
}
|
482
|
+
}
|
483
|
+
// 缩放状态下,未到边缘时不触发轮播手势
|
546
484
|
// @en In the zoomed state, the carousel gesture is not triggered when the edge is not reached
|
547
|
-
|
548
|
-
|
549
485
|
if (isTransforming() && !transformTouchSide().side) {
|
550
486
|
return true;
|
551
487
|
}
|
552
488
|
}
|
553
|
-
|
554
489
|
function handleImageClick(e) {
|
555
490
|
if (movedRef.current) {
|
556
491
|
return;
|
557
|
-
}
|
492
|
+
}
|
493
|
+
// 300ms内再次点击则触发doubleClick,否则触发click
|
558
494
|
// @en Click again within 300ms to trigger doubleClick, otherwise trigger click
|
559
|
-
|
560
|
-
|
561
495
|
dblTimerRef.current = window.setTimeout(function () {
|
562
496
|
if (!dblClickingRef.current) {
|
563
497
|
if (!onImageClick || !onImageClick(innerIndexRef.current, e)) {
|
@@ -566,35 +500,29 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
566
500
|
}
|
567
501
|
}, 300);
|
568
502
|
}
|
569
|
-
|
570
503
|
function handleImageDoubleClick(e) {
|
571
504
|
if (dblClickingRef.current) {
|
572
505
|
// 防止重复触发dblclick
|
573
506
|
return;
|
574
507
|
}
|
575
|
-
|
576
508
|
dblClickingRef.current = true;
|
577
|
-
|
578
509
|
if (dblTimerRef.current) {
|
579
510
|
clearTimeout(dblTimerRef.current);
|
580
511
|
dblTimerRef.current = null;
|
581
512
|
}
|
582
|
-
|
583
513
|
var index = innerIndexRef.current;
|
584
|
-
onImageDoubleClick && onImageDoubleClick(index, e);
|
514
|
+
onImageDoubleClick && onImageDoubleClick(index, e);
|
515
|
+
// 双击时根据配置放大或缩小
|
585
516
|
// @en Zoom in or out according to configuration when double-clicking
|
586
|
-
|
587
517
|
var transformer = transformersRef.current[index];
|
588
|
-
|
589
518
|
if (transformer) {
|
590
519
|
var trans = transformer.getTransform();
|
591
520
|
var rate = trans.scale || 1;
|
592
521
|
var dblScale = getImageDoubleClickScale(rate);
|
593
|
-
|
594
522
|
if (dblScale === 1) {
|
595
|
-
var img = imageDomsRef.current[index];
|
523
|
+
var img = imageDomsRef.current[index];
|
524
|
+
// 长图双击还原缩放特殊处理,因为transform和scroll不能完全同步,所以先zoomTo到原点再restore
|
596
525
|
// @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
|
597
|
-
|
598
526
|
if (imageHasOverflow(img)) {
|
599
527
|
transformer.zoomToScreenCenter(1, [windowWidth / 2, windowHeight / 2], {
|
600
528
|
duration: 200,
|
@@ -614,57 +542,48 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
614
542
|
}
|
615
543
|
}
|
616
544
|
}
|
617
|
-
|
618
545
|
var handleClick = useSingleAndDoubleClick(handleImageClick, handleImageDoubleClick);
|
619
|
-
|
620
546
|
function goClose(e) {
|
621
547
|
if (closingRef.current) {
|
622
548
|
return;
|
623
549
|
}
|
624
|
-
|
625
550
|
closingRef.current = true;
|
626
551
|
close(e);
|
627
552
|
}
|
553
|
+
|
628
554
|
/**
|
629
555
|
* 更改指定图片状态
|
630
556
|
* @en Change specified image status
|
631
557
|
*/
|
632
|
-
|
633
|
-
|
634
558
|
function setImagesStatusByIndex(index, data) {
|
635
559
|
var newStatus = imagesStatusRef.current.slice();
|
636
560
|
newStatus[index] = _extends({}, newStatus[index] || {}, data);
|
637
561
|
setImagesStatus(newStatus);
|
638
562
|
}
|
563
|
+
|
639
564
|
/**
|
640
565
|
* 缩略图放大过渡动画设置
|
641
566
|
* @en Set thumbnail zoom transition animation
|
642
567
|
*/
|
643
|
-
|
644
|
-
|
645
568
|
function setDisplayAnimation(index) {
|
646
569
|
var _imagesStatusRef$curr4;
|
647
|
-
|
648
570
|
var firstLoaded = (_imagesStatusRef$curr4 = imagesStatusRef.current[index]) == null ? void 0 : _imagesStatusRef$curr4.firstLoaded;
|
649
|
-
var fallbackSrc = replaceFallbackWhenLoaded && firstLoaded ? images[index].src : images[index].fallbackSrc;
|
571
|
+
var fallbackSrc = replaceFallbackWhenLoaded && firstLoaded ? images[index].src : images[index].fallbackSrc;
|
572
|
+
// 用户设置了getThumbBounds和images的fallbackSrc属性才有放大过渡效果
|
650
573
|
// @en Set the fallbackSrc attribute of getThumbBounds and images to have a zoom-in transition effect
|
651
|
-
|
652
574
|
if (!getThumbBounds || !images[index] || !fallbackSrc) {
|
653
575
|
resetAnimation(index);
|
654
576
|
return;
|
655
|
-
}
|
577
|
+
}
|
578
|
+
// 获取缩略图的rect,如果没获取到就取消放大过渡效果
|
656
579
|
// @en Get the rect of the thumbnail, if it is gotten, cancel the zoom transition effect
|
657
|
-
|
658
|
-
|
659
580
|
var thumbBounds = getThumbBounds(index);
|
660
|
-
|
661
581
|
if (!thumbBounds || !thumbBounds.width || !thumbBounds.height) {
|
662
582
|
resetAnimation(index);
|
663
583
|
return;
|
664
|
-
}
|
584
|
+
}
|
585
|
+
// 伪造一个fixed的图做小图放大效果
|
665
586
|
// @en Forge a fixed image to make a small image enlargement effect
|
666
|
-
|
667
|
-
|
668
587
|
var transImage = new Image();
|
669
588
|
transImageRef.current = transImage;
|
670
589
|
transImage.classList.add('image-preview-fake-trans-image');
|
@@ -674,25 +593,23 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
674
593
|
transImage.style.opacity = '0';
|
675
594
|
transImage.style.transitionDuration = displayDuration + "ms";
|
676
595
|
transImage.style.webkitTransitionDuration = displayDuration + "ms";
|
677
|
-
document.body.appendChild(transImage);
|
596
|
+
document.body.appendChild(transImage);
|
597
|
+
// 拿到放大之后的位置rect,没拿到就取消小图放大效果
|
678
598
|
// @en Get the zoomed-in position rect, and cancel the zoom-in effect if not getting it
|
679
|
-
|
680
599
|
getNewImageBounds(index, fallbackSrc, transImage, function (rect) {
|
681
600
|
if (!rect || !rect.width || !rect.height) {
|
682
601
|
removeChild(transImage);
|
683
602
|
resetAnimation(index);
|
684
603
|
return;
|
685
|
-
}
|
604
|
+
}
|
605
|
+
// 通过小图rect变换到大图rect加transition做放大效果
|
686
606
|
// @en Transform the small image rect to the large image rect and add transition to make a magnification effect
|
687
|
-
|
688
|
-
|
689
607
|
nextTick(function () {
|
690
608
|
transImage.style.opacity = '1';
|
691
609
|
setImageBounds(transImage, rect, thumbBounds);
|
692
610
|
setTimeout(function () {
|
693
611
|
setPlaceholders(function (holders) {
|
694
612
|
var _extends3;
|
695
|
-
|
696
613
|
return _extends({}, holders, (_extends3 = {}, _extends3[index] = true, _extends3));
|
697
614
|
});
|
698
615
|
}, Math.max(0, displayDuration - 80));
|
@@ -702,24 +619,22 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
702
619
|
});
|
703
620
|
});
|
704
621
|
}
|
622
|
+
|
705
623
|
/**
|
706
624
|
* 取消小图放大过渡效果
|
707
625
|
* @en Cancel the thumbnail zoom transition effect
|
708
626
|
*/
|
709
|
-
|
710
|
-
|
711
627
|
function resetAnimation(index) {
|
712
628
|
setImagesStatusByIndex(index, {
|
713
629
|
animated: true
|
714
630
|
});
|
715
631
|
setTransImageInfo(null);
|
716
632
|
}
|
633
|
+
|
717
634
|
/**
|
718
635
|
* 根据rect设置图片的位置
|
719
636
|
* @en Set the position of the image according to the rect
|
720
637
|
*/
|
721
|
-
|
722
|
-
|
723
638
|
function setImageBounds(image, rect, thumbRect) {
|
724
639
|
// 这里为保持原有比例,只设置宽度变化,高度会随宽度等比变化
|
725
640
|
image.style.width = thumbRect.width + "px";
|
@@ -729,18 +644,16 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
729
644
|
image.style.transformOrigin = 'left top';
|
730
645
|
image.style.webkitTransformOrigin = 'left top';
|
731
646
|
}
|
647
|
+
|
732
648
|
/**
|
733
649
|
* 计算放大之后的位置rect
|
734
650
|
* @en Calculate the position rect after zooming in
|
735
651
|
*/
|
736
|
-
|
737
|
-
|
738
652
|
function getNewImageBounds(index, transSrc, transImage, callback) {
|
739
653
|
if (!transSrc) {
|
740
654
|
callback(null);
|
741
655
|
return;
|
742
656
|
}
|
743
|
-
|
744
657
|
setTransImageInfo({
|
745
658
|
src: transSrc,
|
746
659
|
fit: images[index].fit,
|
@@ -756,19 +669,18 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
756
669
|
}
|
757
670
|
});
|
758
671
|
}
|
672
|
+
|
759
673
|
/**
|
760
674
|
* @en 渲染轮播+图片展示
|
761
675
|
* Rendering carousel + displaying image
|
762
676
|
*/
|
763
|
-
|
764
|
-
|
765
677
|
function renderContent(carouselProps, allImages, getImageProps) {
|
766
678
|
return /*#__PURE__*/React.createElement(Carousel, _extends({
|
767
679
|
autoPlay: false,
|
768
680
|
loop: loop,
|
769
681
|
lazyloadCount: lazyloadCount
|
770
682
|
}, carouselProps), (allImages || []).map(function (image, index) {
|
771
|
-
|
683
|
+
var innerNode = /*#__PURE__*/React.createElement("div", {
|
772
684
|
key: index,
|
773
685
|
className: "preview-image-wrap",
|
774
686
|
style: {
|
@@ -781,24 +693,25 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
781
693
|
boxHeight: windowHeight,
|
782
694
|
bottomOverlap: null
|
783
695
|
}, getImageProps(image, index))));
|
696
|
+
return image.extraNode ? /*#__PURE__*/React.createElement("div", {
|
697
|
+
className: "preview-image-wrap-container",
|
698
|
+
key: "outer-" + index
|
699
|
+
}, innerNode, image.extraNode) : innerNode;
|
784
700
|
}));
|
785
701
|
}
|
786
|
-
|
787
702
|
function getImageClass(index) {
|
788
703
|
var _ref = imagesStatus[index] || {},
|
789
|
-
|
790
|
-
|
791
|
-
|
704
|
+
loaded = _ref.loaded,
|
705
|
+
animated = _ref.animated;
|
792
706
|
return cls('preview-image', {
|
793
707
|
'preview-hidden': index === openIndex && (!loaded || !animated)
|
794
708
|
});
|
795
709
|
}
|
710
|
+
|
796
711
|
/**
|
797
712
|
* 每张图片的样式
|
798
713
|
* @en style of each image
|
799
714
|
*/
|
800
|
-
|
801
|
-
|
802
715
|
function getImageStyle() {
|
803
716
|
// 因为缩放的容器必须是没有transform和transition的纯净元素
|
804
717
|
// @en Because the scaled container must be a pure element without transform and transition
|
@@ -807,31 +720,29 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
807
720
|
return {
|
808
721
|
overflow: 'visible'
|
809
722
|
};
|
810
|
-
}
|
811
|
-
|
723
|
+
}
|
812
724
|
|
725
|
+
// 渲染轮播指引器
|
813
726
|
function renderPreviewIndicator(currentIndex, total, lastIndex) {
|
814
727
|
if (renderIndicator) {
|
815
728
|
return renderIndicator(currentIndex, total, lastIndex);
|
816
729
|
}
|
817
|
-
|
818
730
|
return openLoaded ? /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement("div", {
|
819
731
|
className: "image-preview-indicator"
|
820
732
|
}, currentIndex + 1, "/", total)) : null;
|
821
|
-
}
|
733
|
+
}
|
734
|
+
|
735
|
+
// ios在重设style时图片会消失一下造成闪动,因此在底下垫一张图
|
822
736
|
// @en In iOS when resetting the style, the image will disappear and cause flickering, so put a image at the bottom
|
823
737
|
// 优先过渡图,其次用原图
|
824
738
|
// @en Prioritize the transition image, followed by the original image
|
825
|
-
|
826
|
-
|
827
739
|
function renderImagePlaceholder(src, index) {
|
828
740
|
var _ref2 = imagesStatus[index] || {},
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
741
|
+
originWidth = _ref2.originWidth,
|
742
|
+
originHeight = _ref2.originHeight,
|
743
|
+
originLeft = _ref2.originLeft,
|
744
|
+
originTop = _ref2.originTop,
|
745
|
+
hasOverflow = _ref2.hasOverflow;
|
835
746
|
var trans = hasOverflow ? {} : getStyleWithVendor({
|
836
747
|
transform: 'translateY(-50%)'
|
837
748
|
});
|
@@ -846,7 +757,6 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
846
757
|
}, trans)
|
847
758
|
}) : null;
|
848
759
|
}
|
849
|
-
|
850
760
|
function renderLoadingArea(index) {
|
851
761
|
// loadingArea提出来,放到过渡图上层
|
852
762
|
// @en The loadingArea is extracted and placed on the upper layer of the transition image
|
@@ -858,7 +768,6 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
858
768
|
radius: 7
|
859
769
|
}))) : loadingArea;
|
860
770
|
}
|
861
|
-
|
862
771
|
return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref3) {
|
863
772
|
var prefixCls = _ref3.prefixCls;
|
864
773
|
return /*#__PURE__*/React.createElement(Portal, {
|
@@ -923,20 +832,17 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
923
832
|
originLeft: imageEle.offsetLeft,
|
924
833
|
hasOverflow: imageHasOverflow(imageEle)
|
925
834
|
});
|
926
|
-
|
927
835
|
if (index === openIndex) {
|
928
836
|
initTransformer(index);
|
929
837
|
} else {
|
930
838
|
setPlaceholders(function (holders) {
|
931
839
|
var _extends4;
|
932
|
-
|
933
840
|
return _extends({}, holders, (_extends4 = {}, _extends4[index] = true, _extends4));
|
934
841
|
});
|
935
842
|
}
|
936
843
|
},
|
937
844
|
onError: function onError() {
|
938
845
|
imageDomsRef.current[index] = null;
|
939
|
-
|
940
846
|
if (index === openIndex) {
|
941
847
|
var transImage = transImageInfo == null ? void 0 : transImageInfo.movingImage;
|
942
848
|
removeChild(transImage);
|
@@ -981,6 +887,7 @@ export function methodsGenerator(Comp) {
|
|
981
887
|
};
|
982
888
|
}
|
983
889
|
var ImagePreviewWithGlobalContext = CompWithGlobalContext(ImagePreview);
|
890
|
+
|
984
891
|
/**
|
985
892
|
* 图片预览组件,支持循环轮播、双指/双击缩放、缩略图放大效果。
|
986
893
|
* @en The image preview, supports circular rotation, two-finger/double-tap zoom, and thumbnail zoom effects.
|
@@ -989,5 +896,4 @@ var ImagePreviewWithGlobalContext = CompWithGlobalContext(ImagePreview);
|
|
989
896
|
* @name 图片预览
|
990
897
|
* @name_en ImagePreview
|
991
898
|
*/
|
992
|
-
|
993
899
|
export default componentWrapper(ImagePreview, methodsGenerator(ImagePreviewWithGlobalContext));
|