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