@arco-design/mobile-react 2.38.4 → 2.39.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 +24 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/hooks.js +59 -141
- package/cjs/_helpers/index.js +2 -18
- package/cjs/_helpers/react-dom.js +0 -14
- package/cjs/_helpers/render.js +5 -21
- package/cjs/action-sheet/index.js +10 -30
- package/cjs/action-sheet/methods.js +0 -2
- package/cjs/action-sheet/style/css/index.js +0 -2
- package/cjs/action-sheet/style/index.js +0 -2
- package/cjs/avatar/group.js +12 -24
- package/cjs/avatar/index.js +53 -79
- package/cjs/avatar/style/css/index.js +0 -2
- package/cjs/avatar/style/index.js +0 -2
- package/cjs/badge/index.js +18 -29
- package/cjs/badge/style/css/index.js +0 -1
- package/cjs/badge/style/index.js +0 -1
- package/cjs/button/hooks.js +15 -20
- package/cjs/button/index.js +46 -67
- package/cjs/button/style/css/index.js +0 -2
- package/cjs/button/style/index.js +0 -2
- package/cjs/carousel/index.js +153 -288
- package/cjs/carousel/style/css/index.js +0 -1
- package/cjs/carousel/style/index.js +0 -1
- package/cjs/cell/arrow.js +0 -3
- package/cjs/cell/cell.js +18 -34
- package/cjs/cell/group.js +9 -21
- package/cjs/cell/index.js +1 -7
- package/cjs/cell/style/css/index.js +0 -1
- package/cjs/cell/style/index.js +0 -1
- package/cjs/checkbox/checkbox.js +31 -57
- package/cjs/checkbox/group.js +24 -38
- package/cjs/checkbox/hooks/index.js +0 -2
- package/cjs/checkbox/hooks/useMergeProps.js +7 -14
- package/cjs/checkbox/index.js +1 -8
- package/cjs/checkbox/style/css/index.js +0 -1
- package/cjs/checkbox/style/index.js +0 -1
- package/cjs/checkbox/type.js +0 -2
- package/cjs/circle-progress/index.js +37 -57
- package/cjs/circle-progress/style/css/index.js +0 -1
- package/cjs/circle-progress/style/index.js +0 -1
- package/cjs/collapse/collapse.js +30 -61
- package/cjs/collapse/group.js +20 -44
- package/cjs/collapse/index.js +0 -9
- package/cjs/collapse/style/css/index.js +0 -1
- package/cjs/collapse/style/index.js +0 -1
- package/cjs/collapse/utils.js +0 -7
- package/cjs/context-provider/index.js +18 -43
- package/cjs/context-provider/style/css/index.js +0 -1
- package/cjs/context-provider/style/index.js +0 -1
- package/cjs/count-down/hooks.js +24 -43
- package/cjs/count-down/index.js +29 -37
- package/cjs/count-down/singleton.js +2 -12
- package/cjs/count-down/style/css/index.js +0 -1
- package/cjs/count-down/style/index.js +0 -1
- package/cjs/count-down/util.js +33 -47
- package/cjs/date-picker/helper.js +7 -14
- package/cjs/date-picker/index.js +66 -167
- package/cjs/date-picker/style/css/index.js +0 -2
- package/cjs/date-picker/style/index.js +0 -2
- package/cjs/dialog/index.js +31 -57
- package/cjs/dialog/methods.js +9 -22
- package/cjs/dialog/style/css/index.js +0 -2
- package/cjs/dialog/style/index.js +0 -2
- package/cjs/divider/index.js +8 -20
- package/cjs/divider/style/css/index.js +0 -1
- package/cjs/divider/style/index.js +0 -1
- package/cjs/dropdown/dropdown.js +74 -113
- package/cjs/dropdown/index.js +1 -8
- package/cjs/dropdown/options.js +12 -28
- package/cjs/dropdown/style/css/index.js +0 -1
- package/cjs/dropdown/style/index.js +0 -1
- package/cjs/dropdown-menu/dropdown-menu.js +49 -84
- package/cjs/dropdown-menu/helper.js +4 -24
- package/cjs/dropdown-menu/index.js +0 -6
- package/cjs/dropdown-menu/style/css/index.js +0 -2
- package/cjs/dropdown-menu/style/index.js +0 -2
- package/cjs/ellipsis/components/js-ellipsis.js +32 -70
- package/cjs/ellipsis/components/native-ellipsis.js +9 -14
- package/cjs/ellipsis/index.js +19 -32
- package/cjs/ellipsis/style/css/index.js +0 -1
- package/cjs/ellipsis/style/index.js +0 -1
- package/cjs/ellipsis/utils/dom.js +0 -8
- package/cjs/ellipsis/utils/is.js +1 -5
- package/cjs/form/form-item-context.js +0 -5
- package/cjs/form/form-item.js +74 -163
- package/cjs/form/index.js +18 -38
- package/cjs/form/linked-container.js +5 -24
- package/cjs/form/style/css/index.js +0 -1
- package/cjs/form/style/index.js +0 -1
- package/cjs/form/type.d.ts +11 -1
- package/cjs/form/type.js +0 -5
- package/cjs/form/useForm.js +10 -79
- package/cjs/form/utils.js +4 -22
- package/cjs/grid/index.js +22 -45
- package/cjs/grid/style/css/index.js +0 -1
- package/cjs/grid/style/index.js +0 -1
- package/cjs/icon/IconAdd/index.js +5 -12
- package/cjs/icon/IconArrowBack/index.js +5 -12
- package/cjs/icon/IconArrowDown/index.js +5 -12
- package/cjs/icon/IconArrowIn/index.js +5 -12
- package/cjs/icon/IconArrowUp/index.js +5 -12
- package/cjs/icon/IconCheck/index.js +5 -12
- package/cjs/icon/IconCheckBold/index.js +5 -12
- package/cjs/icon/IconCircleChecked/index.js +5 -12
- package/cjs/icon/IconCircleDisabled/index.js +5 -12
- package/cjs/icon/IconCircleUnchecked/index.js +5 -12
- package/cjs/icon/IconClear/index.js +5 -12
- package/cjs/icon/IconClose/index.js +5 -12
- package/cjs/icon/IconCloseBold/index.js +5 -12
- package/cjs/icon/IconDelete/index.js +5 -12
- package/cjs/icon/IconDownload/index.js +5 -12
- package/cjs/icon/IconEdit/index.js +5 -12
- package/cjs/icon/IconErrorCircle/index.js +5 -12
- package/cjs/icon/IconEyeInvisible/index.js +5 -12
- package/cjs/icon/IconEyeVisible/index.js +5 -12
- package/cjs/icon/IconEyelashInvisible/index.js +5 -12
- package/cjs/icon/IconFile/index.js +5 -12
- package/cjs/icon/IconGift/index.js +5 -12
- package/cjs/icon/IconHeart/index.js +5 -12
- package/cjs/icon/IconHome/index.js +5 -12
- package/cjs/icon/IconKeyboard/index.js +5 -12
- package/cjs/icon/IconKeyboardDelete/index.js +5 -12
- package/cjs/icon/IconLikeCircle/index.js +5 -12
- package/cjs/icon/IconMinus/index.js +5 -12
- package/cjs/icon/IconMore/index.js +5 -12
- package/cjs/icon/IconNotice/index.js +5 -12
- package/cjs/icon/IconNoticeOff/index.js +5 -12
- package/cjs/icon/IconPicture/index.js +5 -12
- package/cjs/icon/IconPlay/index.js +5 -12
- package/cjs/icon/IconQuestionCircle/index.js +5 -12
- package/cjs/icon/IconRefresh/index.js +5 -12
- package/cjs/icon/IconSad/index.js +5 -12
- package/cjs/icon/IconScan/index.js +5 -12
- package/cjs/icon/IconSearch/index.js +5 -12
- package/cjs/icon/IconSetting/index.js +5 -12
- package/cjs/icon/IconShop/index.js +5 -12
- package/cjs/icon/IconShopping/index.js +5 -12
- package/cjs/icon/IconSmileFill/index.js +5 -12
- package/cjs/icon/IconSound/index.js +5 -12
- package/cjs/icon/IconSquareChecked/index.js +5 -12
- package/cjs/icon/IconSquareDisabled/index.js +5 -12
- package/cjs/icon/IconSquareUnchecked/index.js +5 -12
- package/cjs/icon/IconStar/index.js +5 -12
- package/cjs/icon/IconStarFill/index.js +5 -12
- package/cjs/icon/IconStarHalf/index.js +5 -12
- package/cjs/icon/IconSubway/index.js +5 -12
- package/cjs/icon/IconSuccessCircle/index.js +5 -12
- package/cjs/icon/IconTriDown/index.js +5 -12
- package/cjs/icon/IconTriUp/index.js +5 -12
- package/cjs/icon/IconUpload/index.js +5 -12
- package/cjs/icon/IconUser/index.js +5 -12
- package/cjs/icon/IconUserFill/index.js +5 -12
- package/cjs/icon/IconWarnCircle/index.js +5 -12
- package/cjs/icon/IconWarnCircleFill/index.js +5 -12
- package/cjs/icon/index.js +0 -119
- package/cjs/image/index.js +53 -94
- package/cjs/image/style/css/index.js +0 -2
- package/cjs/image/style/index.js +0 -2
- package/cjs/image-picker/add-icon.js +0 -3
- package/cjs/image-picker/index.js +32 -59
- package/cjs/image-picker/style/css/index.js +0 -3
- package/cjs/image-picker/style/index.js +0 -3
- package/cjs/image-preview/index.js +129 -254
- package/cjs/image-preview/methods.js +5 -18
- package/cjs/image-preview/style/css/index.js +0 -4
- package/cjs/image-preview/style/index.js +0 -4
- package/cjs/index-bar/context.js +0 -2
- package/cjs/index-bar/group.js +16 -35
- package/cjs/index-bar/index.js +55 -87
- package/cjs/index-bar/side-bar.js +15 -34
- package/cjs/index-bar/style/css/index.js +0 -2
- package/cjs/index-bar/style/index.js +0 -2
- package/cjs/index-bar/utils.js +3 -17
- package/cjs/index.js +0 -119
- package/cjs/input/hooks.js +45 -84
- package/cjs/input/index.js +26 -40
- package/cjs/input/style/css/index.js +0 -1
- package/cjs/input/style/index.js +0 -1
- package/cjs/keyboard/index.js +37 -73
- package/cjs/keyboard/style/css/index.js +0 -2
- package/cjs/keyboard/style/index.js +0 -2
- package/cjs/load-more/index.js +33 -65
- package/cjs/load-more/style/css/index.js +0 -1
- package/cjs/load-more/style/index.js +0 -1
- package/cjs/loading/index.js +19 -48
- package/cjs/loading/style/css/index.js +0 -1
- package/cjs/loading/style/index.js +0 -1
- package/cjs/masking/index.js +47 -80
- package/cjs/masking/methods.js +5 -21
- package/cjs/masking/style/css/index.js +0 -2
- package/cjs/masking/style/index.js +0 -2
- package/cjs/nav-bar/back-icon.js +2 -8
- package/cjs/nav-bar/index.js +37 -61
- package/cjs/nav-bar/style/css/index.js +0 -1
- package/cjs/nav-bar/style/index.js +0 -1
- package/cjs/notice-bar/index.js +34 -60
- package/cjs/notice-bar/style/css/index.js +0 -1
- package/cjs/notice-bar/style/index.js +0 -1
- package/cjs/notify/index.js +20 -49
- package/cjs/notify/methods.js +2 -17
- package/cjs/notify/style/css/index.js +0 -1
- package/cjs/notify/style/index.js +0 -1
- package/cjs/pagination/arrow.js +0 -3
- package/cjs/pagination/index.js +27 -58
- package/cjs/pagination/style/css/index.js +0 -1
- package/cjs/pagination/style/index.js +0 -1
- package/cjs/picker/index.js +48 -84
- package/cjs/picker/style/css/index.js +0 -3
- package/cjs/picker/style/index.js +0 -3
- package/cjs/picker-view/components/cascader.js +13 -32
- package/cjs/picker-view/components/multi-picker.js +8 -17
- package/cjs/picker-view/components/picker-cell.js +45 -101
- package/cjs/picker-view/index.js +30 -76
- package/cjs/picker-view/style/css/index.js +0 -1
- package/cjs/picker-view/style/index.js +0 -1
- package/cjs/popover/hooks/index.js +0 -4
- package/cjs/popover/hooks/useEvent.js +25 -49
- package/cjs/popover/hooks/usePosition.js +100 -159
- package/cjs/popover/index.js +1 -8
- package/cjs/popover/menu.js +32 -52
- package/cjs/popover/popover-inner.js +30 -48
- package/cjs/popover/popover.js +69 -101
- package/cjs/popover/style/css/index.js +0 -2
- package/cjs/popover/style/index.js +0 -2
- package/cjs/popup/index.js +22 -39
- package/cjs/popup/methods.js +0 -2
- package/cjs/popup/style/css/index.js +0 -2
- package/cjs/popup/style/index.js +0 -2
- package/cjs/popup-swiper/index.js +50 -92
- package/cjs/popup-swiper/methods.js +0 -2
- package/cjs/popup-swiper/style/css/index.js +0 -2
- package/cjs/popup-swiper/style/index.js +0 -2
- package/cjs/portal/index.js +3 -8
- package/cjs/portal/style/css/index.js +0 -1
- package/cjs/portal/style/index.js +0 -1
- package/cjs/progress/index.js +27 -44
- package/cjs/progress/style/css/index.js +0 -1
- package/cjs/progress/style/index.js +0 -1
- package/cjs/pull-refresh/android-pull-refresh.js +56 -95
- package/cjs/pull-refresh/hooks.js +11 -32
- package/cjs/pull-refresh/index.js +3 -14
- package/cjs/pull-refresh/ios-pull-refresh.js +53 -81
- package/cjs/pull-refresh/model.js +0 -1
- package/cjs/pull-refresh/style/css/index.js +0 -2
- package/cjs/pull-refresh/style/index.js +0 -2
- package/cjs/radio/group.js +20 -34
- package/cjs/radio/index.js +1 -8
- package/cjs/radio/radio.js +0 -10
- package/cjs/radio/style/css/index.js +0 -1
- package/cjs/radio/style/index.js +0 -1
- package/cjs/rate/index.js +28 -54
- package/cjs/rate/style/css/index.js +0 -1
- package/cjs/rate/style/index.js +0 -1
- package/cjs/search-bar/association.js +14 -32
- package/cjs/search-bar/cancel-button.js +8 -16
- package/cjs/search-bar/highlight.js +14 -25
- package/cjs/search-bar/index.js +77 -97
- package/cjs/search-bar/style/css/index.js +0 -1
- package/cjs/search-bar/style/index.js +0 -1
- package/cjs/show-monitor/index.js +40 -108
- package/cjs/show-monitor/style/css/index.js +0 -1
- package/cjs/show-monitor/style/index.js +0 -1
- package/cjs/skeleton/elements.js +47 -84
- package/cjs/skeleton/index.js +18 -36
- package/cjs/skeleton/skeleton-context.js +0 -4
- package/cjs/skeleton/style/css/index.js +0 -2
- package/cjs/skeleton/style/index.js +0 -2
- package/cjs/slider/hooks/index.js +0 -13
- package/cjs/slider/hooks/useSliderEvents.js +27 -59
- package/cjs/slider/hooks/useSliderIcon.js +6 -20
- package/cjs/slider/hooks/useSliderInit.js +32 -52
- package/cjs/slider/hooks/useSliderStyle.js +13 -27
- package/cjs/slider/index.js +47 -73
- package/cjs/slider/marks.js +13 -27
- package/cjs/slider/popover.js +4 -13
- package/cjs/slider/style/css/index.js +0 -2
- package/cjs/slider/style/index.js +0 -2
- package/cjs/slider/thumb.js +11 -22
- package/cjs/stepper/hooks/useButtonClick.js +15 -25
- package/cjs/stepper/hooks/useInputEvent.js +10 -19
- package/cjs/stepper/hooks/useValue.js +9 -15
- package/cjs/stepper/index.js +84 -98
- package/cjs/stepper/style/css/index.js +0 -1
- package/cjs/stepper/style/index.js +0 -1
- package/cjs/steps/index.js +25 -43
- package/cjs/steps/step.js +10 -27
- package/cjs/steps/style/css/index.js +0 -1
- package/cjs/steps/style/index.js +0 -1
- package/cjs/sticky/index.js +40 -74
- package/cjs/sticky/style/css/index.js +0 -1
- package/cjs/sticky/style/index.js +0 -1
- package/cjs/style.js +0 -59
- package/cjs/swipe-action/index.js +40 -92
- package/cjs/swipe-action/item.js +9 -17
- package/cjs/swipe-action/style/css/index.js +0 -1
- package/cjs/swipe-action/style/index.js +0 -1
- package/cjs/swipe-load/index.js +78 -113
- package/cjs/swipe-load/style/css/index.js +0 -1
- package/cjs/swipe-load/style/index.js +0 -1
- package/cjs/switch/index.js +28 -49
- package/cjs/switch/style/css/index.js +0 -1
- package/cjs/switch/style/index.js +0 -1
- package/cjs/tab-bar/index.js +0 -7
- package/cjs/tab-bar/item.js +6 -24
- package/cjs/tab-bar/style/css/index.js +0 -1
- package/cjs/tab-bar/style/index.js +0 -1
- package/cjs/tab-bar/tab-bar.js +16 -32
- package/cjs/tabs/index.js +136 -206
- package/cjs/tabs/style/css/index.js +0 -1
- package/cjs/tabs/style/index.js +0 -1
- package/cjs/tabs/tab-cell-underline.js +28 -76
- package/cjs/tabs/tab-cell.js +73 -128
- package/cjs/tabs/tab-pane.js +53 -103
- package/cjs/tag/index.js +1 -8
- package/cjs/tag/list.js +11 -26
- package/cjs/tag/style/css/index.js +0 -1
- package/cjs/tag/style/index.js +0 -1
- package/cjs/tag/tag.js +20 -32
- package/cjs/textarea/index.js +35 -56
- package/cjs/textarea/style/css/index.js +0 -2
- package/cjs/textarea/style/index.js +0 -2
- package/cjs/toast/index.js +26 -61
- package/cjs/toast/methods.js +2 -16
- package/cjs/toast/style/css/index.js +0 -3
- package/cjs/toast/style/index.js +0 -3
- package/cjs/transition/index.js +17 -29
- package/cjs/transition/style/css/index.js +0 -1
- package/cjs/transition/style/index.js +0 -1
- package/cjs/uploader/index.d.ts +1 -1
- package/cjs/uploader/index.js +28 -49
- package/cjs/uploader/style/css/index.js +0 -3
- package/cjs/uploader/style/index.js +0 -3
- package/cjs/uploader/upload/index.js +0 -4
- package/cjs/uploader/upload/upload.js +9 -45
- package/dist/index.js +3838 -6455
- package/dist/index.min.js +2 -2
- package/esm/_helpers/hooks.js +59 -123
- package/esm/_helpers/index.js +4 -6
- package/esm/_helpers/react-dom.js +0 -11
- package/esm/_helpers/render.js +5 -15
- package/esm/action-sheet/index.js +10 -16
- package/esm/avatar/group.js +12 -16
- package/esm/avatar/index.js +53 -64
- package/esm/badge/index.js +18 -22
- package/esm/button/hooks.js +15 -18
- package/esm/button/index.js +46 -57
- package/esm/carousel/index.js +153 -280
- package/esm/cell/cell.js +18 -25
- package/esm/cell/group.js +9 -11
- package/esm/cell/index.js +1 -1
- package/esm/checkbox/checkbox.js +31 -42
- package/esm/checkbox/group.js +24 -28
- package/esm/checkbox/hooks/useMergeProps.js +7 -9
- package/esm/checkbox/index.js +2 -2
- package/esm/checkbox/type.js +0 -1
- package/esm/circle-progress/index.js +37 -49
- package/esm/collapse/collapse.js +30 -51
- package/esm/collapse/group.js +20 -34
- package/esm/collapse/index.js +1 -1
- package/esm/collapse/utils.js +0 -1
- package/esm/context-provider/index.js +18 -33
- package/esm/count-down/hooks.js +24 -37
- package/esm/count-down/index.js +30 -29
- package/esm/count-down/singleton.js +2 -5
- package/esm/count-down/util.js +33 -42
- package/esm/date-picker/helper.js +7 -9
- package/esm/date-picker/index.js +66 -155
- package/esm/dialog/index.js +31 -42
- package/esm/dialog/methods.js +9 -11
- package/esm/divider/index.js +8 -12
- package/esm/dropdown/dropdown.js +74 -102
- package/esm/dropdown/index.js +1 -1
- package/esm/dropdown/options.js +12 -20
- package/esm/dropdown-menu/dropdown-menu.js +49 -74
- package/esm/dropdown-menu/helper.js +4 -14
- package/esm/dropdown-menu/index.js +1 -1
- package/esm/ellipsis/components/js-ellipsis.js +32 -60
- package/esm/ellipsis/components/native-ellipsis.js +9 -11
- package/esm/ellipsis/index.js +20 -21
- package/esm/ellipsis/utils/dom.js +0 -7
- package/esm/ellipsis/utils/is.js +1 -1
- package/esm/form/form-item.js +74 -147
- package/esm/form/index.js +18 -23
- package/esm/form/linked-container.js +5 -14
- package/esm/form/type.d.ts +11 -1
- package/esm/form/type.js +0 -5
- package/esm/form/useForm.js +10 -74
- package/esm/form/utils.js +4 -11
- package/esm/grid/index.js +22 -38
- package/esm/icon/IconAdd/index.js +5 -6
- package/esm/icon/IconArrowBack/index.js +5 -6
- package/esm/icon/IconArrowDown/index.js +5 -6
- package/esm/icon/IconArrowIn/index.js +5 -6
- package/esm/icon/IconArrowUp/index.js +5 -6
- package/esm/icon/IconCheck/index.js +5 -6
- package/esm/icon/IconCheckBold/index.js +5 -6
- package/esm/icon/IconCircleChecked/index.js +5 -6
- package/esm/icon/IconCircleDisabled/index.js +5 -6
- package/esm/icon/IconCircleUnchecked/index.js +5 -6
- package/esm/icon/IconClear/index.js +5 -6
- package/esm/icon/IconClose/index.js +5 -6
- package/esm/icon/IconCloseBold/index.js +5 -6
- package/esm/icon/IconDelete/index.js +5 -6
- package/esm/icon/IconDownload/index.js +5 -6
- package/esm/icon/IconEdit/index.js +5 -6
- package/esm/icon/IconErrorCircle/index.js +5 -6
- package/esm/icon/IconEyeInvisible/index.js +5 -6
- package/esm/icon/IconEyeVisible/index.js +5 -6
- package/esm/icon/IconEyelashInvisible/index.js +5 -6
- package/esm/icon/IconFile/index.js +5 -6
- package/esm/icon/IconGift/index.js +5 -6
- package/esm/icon/IconHeart/index.js +5 -6
- package/esm/icon/IconHome/index.js +5 -6
- package/esm/icon/IconKeyboard/index.js +5 -6
- package/esm/icon/IconKeyboardDelete/index.js +5 -6
- package/esm/icon/IconLikeCircle/index.js +5 -6
- package/esm/icon/IconMinus/index.js +5 -6
- package/esm/icon/IconMore/index.js +5 -6
- package/esm/icon/IconNotice/index.js +5 -6
- package/esm/icon/IconNoticeOff/index.js +5 -6
- package/esm/icon/IconPicture/index.js +5 -6
- package/esm/icon/IconPlay/index.js +5 -6
- package/esm/icon/IconQuestionCircle/index.js +5 -6
- package/esm/icon/IconRefresh/index.js +5 -6
- package/esm/icon/IconSad/index.js +5 -6
- package/esm/icon/IconScan/index.js +5 -6
- package/esm/icon/IconSearch/index.js +5 -6
- package/esm/icon/IconSetting/index.js +5 -6
- package/esm/icon/IconShop/index.js +5 -6
- package/esm/icon/IconShopping/index.js +5 -6
- package/esm/icon/IconSmileFill/index.js +5 -6
- package/esm/icon/IconSound/index.js +5 -6
- package/esm/icon/IconSquareChecked/index.js +5 -6
- package/esm/icon/IconSquareDisabled/index.js +5 -6
- package/esm/icon/IconSquareUnchecked/index.js +5 -6
- package/esm/icon/IconStar/index.js +5 -6
- package/esm/icon/IconStarFill/index.js +5 -6
- package/esm/icon/IconStarHalf/index.js +5 -6
- package/esm/icon/IconSubway/index.js +5 -6
- package/esm/icon/IconSuccessCircle/index.js +5 -6
- package/esm/icon/IconTriDown/index.js +5 -6
- package/esm/icon/IconTriUp/index.js +5 -6
- package/esm/icon/IconUpload/index.js +5 -6
- package/esm/icon/IconUser/index.js +5 -6
- package/esm/icon/IconUserFill/index.js +5 -6
- package/esm/icon/IconWarnCircle/index.js +5 -6
- package/esm/icon/IconWarnCircleFill/index.js +5 -6
- package/esm/image/index.js +53 -85
- package/esm/image-picker/index.js +32 -42
- package/esm/image-preview/index.js +129 -232
- package/esm/image-preview/methods.js +5 -14
- package/esm/index-bar/group.js +16 -25
- package/esm/index-bar/index.js +55 -74
- package/esm/index-bar/side-bar.js +15 -28
- package/esm/index-bar/utils.js +3 -10
- package/esm/input/hooks.js +45 -75
- package/esm/input/index.js +26 -30
- package/esm/keyboard/index.js +40 -63
- package/esm/load-more/index.js +33 -57
- package/esm/loading/index.js +19 -40
- package/esm/masking/index.js +47 -65
- package/esm/masking/methods.js +5 -16
- package/esm/nav-bar/back-icon.js +2 -4
- package/esm/nav-bar/index.js +37 -52
- package/esm/notice-bar/index.js +34 -53
- package/esm/notify/index.js +20 -33
- package/esm/notify/methods.js +2 -13
- package/esm/pagination/index.js +27 -50
- package/esm/picker/index.js +48 -69
- package/esm/picker-view/components/cascader.js +13 -24
- package/esm/picker-view/components/multi-picker.js +8 -14
- package/esm/picker-view/components/picker-cell.js +45 -93
- package/esm/picker-view/index.js +30 -60
- package/esm/popover/hooks/useEvent.js +26 -41
- package/esm/popover/hooks/usePosition.js +100 -152
- package/esm/popover/index.js +2 -2
- package/esm/popover/menu.js +32 -41
- package/esm/popover/popover-inner.js +30 -39
- package/esm/popover/popover.js +69 -90
- package/esm/popup/index.js +22 -25
- package/esm/popup-swiper/index.js +50 -76
- package/esm/portal/index.js +3 -5
- package/esm/progress/index.js +27 -36
- package/esm/pull-refresh/android-pull-refresh.js +56 -83
- package/esm/pull-refresh/hooks.js +11 -23
- package/esm/pull-refresh/index.js +3 -5
- package/esm/pull-refresh/ios-pull-refresh.js +53 -68
- package/esm/pull-refresh/model.js +0 -1
- package/esm/radio/group.js +20 -24
- package/esm/radio/index.js +2 -2
- package/esm/rate/index.js +28 -43
- package/esm/search-bar/association.js +14 -27
- package/esm/search-bar/cancel-button.js +8 -11
- package/esm/search-bar/highlight.js +14 -20
- package/esm/search-bar/index.js +77 -86
- package/esm/show-monitor/index.js +40 -100
- package/esm/skeleton/elements.js +47 -75
- package/esm/skeleton/index.js +18 -24
- package/esm/slider/hooks/useSliderEvents.js +27 -54
- package/esm/slider/hooks/useSliderIcon.js +6 -13
- package/esm/slider/hooks/useSliderInit.js +32 -46
- package/esm/slider/hooks/useSliderStyle.js +13 -22
- package/esm/slider/index.js +47 -63
- package/esm/slider/marks.js +13 -19
- package/esm/slider/popover.js +4 -6
- package/esm/slider/thumb.js +11 -16
- package/esm/stepper/hooks/useButtonClick.js +15 -24
- package/esm/stepper/hooks/useInputEvent.js +10 -17
- package/esm/stepper/hooks/useValue.js +9 -12
- package/esm/stepper/index.js +84 -84
- package/esm/steps/index.js +25 -30
- package/esm/steps/step.js +10 -19
- package/esm/sticky/index.js +40 -65
- package/esm/swipe-action/index.js +40 -80
- package/esm/swipe-action/item.js +9 -12
- package/esm/swipe-load/index.js +79 -104
- package/esm/switch/index.js +28 -41
- package/esm/tab-bar/index.js +0 -1
- package/esm/tab-bar/item.js +6 -13
- package/esm/tab-bar/tab-bar.js +16 -22
- package/esm/tabs/index.js +137 -194
- package/esm/tabs/tab-cell-underline.js +28 -67
- package/esm/tabs/tab-cell.js +73 -118
- package/esm/tabs/tab-pane.js +53 -95
- package/esm/tag/index.js +2 -2
- package/esm/tag/list.js +11 -16
- package/esm/tag/tag.js +20 -22
- package/esm/textarea/index.js +35 -46
- package/esm/toast/index.js +26 -42
- package/esm/toast/methods.js +2 -12
- package/esm/transition/index.js +17 -20
- package/esm/uploader/index.d.ts +1 -1
- package/esm/uploader/index.js +28 -34
- package/esm/uploader/upload/upload.js +9 -38
- package/esnext/form/form-item.js +12 -7
- package/esnext/form/type.d.ts +11 -1
- package/esnext/uploader/index.d.ts +1 -1
- package/esnext/uploader/index.js +1 -1
- package/esnext/uploader/upload/upload.js +1 -1
- package/package.json +5 -3
- package/tokens/app/arcodesign/default/index.js +0 -2
- package/umd/_helpers/hooks.js +59 -138
- package/umd/_helpers/index.js +2 -9
- package/umd/_helpers/react-dom.js +0 -13
- package/umd/_helpers/render.js +5 -17
- package/umd/action-sheet/index.js +10 -22
- package/umd/action-sheet/methods.js +0 -1
- package/umd/avatar/group.js +12 -20
- package/umd/avatar/index.js +53 -70
- package/umd/badge/index.js +18 -25
- package/umd/button/hooks.js +15 -19
- package/umd/button/index.js +46 -60
- package/umd/carousel/index.js +153 -283
- package/umd/cell/arrow.js +0 -2
- package/umd/cell/cell.js +18 -29
- package/umd/cell/group.js +9 -17
- package/umd/cell/index.js +1 -2
- package/umd/checkbox/checkbox.js +31 -45
- package/umd/checkbox/group.js +24 -34
- package/umd/checkbox/hooks/useMergeProps.js +7 -12
- package/umd/checkbox/index.js +1 -3
- package/umd/checkbox/type.js +0 -2
- package/umd/circle-progress/index.js +37 -52
- package/umd/collapse/collapse.js +30 -55
- package/umd/collapse/group.js +20 -38
- package/umd/collapse/index.js +0 -3
- package/umd/collapse/utils.js +0 -5
- package/umd/context-provider/index.js +18 -38
- package/umd/count-down/hooks.js +24 -39
- package/umd/count-down/index.js +29 -31
- package/umd/count-down/singleton.js +2 -10
- package/umd/count-down/util.js +33 -47
- package/umd/date-picker/helper.js +7 -13
- package/umd/date-picker/index.js +66 -158
- package/umd/dialog/index.js +31 -47
- package/umd/dialog/methods.js +9 -18
- package/umd/divider/index.js +8 -15
- package/umd/dropdown/dropdown.js +74 -106
- package/umd/dropdown/index.js +1 -3
- package/umd/dropdown/options.js +12 -24
- package/umd/dropdown-menu/dropdown-menu.js +49 -78
- package/umd/dropdown-menu/helper.js +4 -22
- package/umd/dropdown-menu/index.js +0 -2
- package/umd/ellipsis/components/js-ellipsis.js +32 -66
- package/umd/ellipsis/components/native-ellipsis.js +9 -12
- package/umd/ellipsis/index.js +19 -24
- package/umd/ellipsis/utils/dom.js +0 -8
- package/umd/ellipsis/utils/is.js +1 -5
- package/umd/form/form-item-context.js +0 -3
- package/umd/form/form-item.js +74 -151
- package/umd/form/index.js +18 -28
- package/umd/form/linked-container.js +5 -19
- package/umd/form/type.d.ts +11 -1
- package/umd/form/type.js +0 -5
- package/umd/form/useForm.js +10 -74
- package/umd/form/utils.js +4 -19
- package/umd/grid/index.js +22 -41
- package/umd/icon/IconAdd/index.js +5 -7
- package/umd/icon/IconArrowBack/index.js +5 -7
- package/umd/icon/IconArrowDown/index.js +5 -7
- package/umd/icon/IconArrowIn/index.js +5 -7
- package/umd/icon/IconArrowUp/index.js +5 -7
- package/umd/icon/IconCheck/index.js +5 -7
- package/umd/icon/IconCheckBold/index.js +5 -7
- package/umd/icon/IconCircleChecked/index.js +5 -7
- package/umd/icon/IconCircleDisabled/index.js +5 -7
- package/umd/icon/IconCircleUnchecked/index.js +5 -7
- package/umd/icon/IconClear/index.js +5 -7
- package/umd/icon/IconClose/index.js +5 -7
- package/umd/icon/IconCloseBold/index.js +5 -7
- package/umd/icon/IconDelete/index.js +5 -7
- package/umd/icon/IconDownload/index.js +5 -7
- package/umd/icon/IconEdit/index.js +5 -7
- package/umd/icon/IconErrorCircle/index.js +5 -7
- package/umd/icon/IconEyeInvisible/index.js +5 -7
- package/umd/icon/IconEyeVisible/index.js +5 -7
- package/umd/icon/IconEyelashInvisible/index.js +5 -7
- package/umd/icon/IconFile/index.js +5 -7
- package/umd/icon/IconGift/index.js +5 -7
- package/umd/icon/IconHeart/index.js +5 -7
- package/umd/icon/IconHome/index.js +5 -7
- package/umd/icon/IconKeyboard/index.js +5 -7
- package/umd/icon/IconKeyboardDelete/index.js +5 -7
- package/umd/icon/IconLikeCircle/index.js +5 -7
- package/umd/icon/IconMinus/index.js +5 -7
- package/umd/icon/IconMore/index.js +5 -7
- package/umd/icon/IconNotice/index.js +5 -7
- package/umd/icon/IconNoticeOff/index.js +5 -7
- package/umd/icon/IconPicture/index.js +5 -7
- package/umd/icon/IconPlay/index.js +5 -7
- package/umd/icon/IconQuestionCircle/index.js +5 -7
- package/umd/icon/IconRefresh/index.js +5 -7
- package/umd/icon/IconSad/index.js +5 -7
- package/umd/icon/IconScan/index.js +5 -7
- package/umd/icon/IconSearch/index.js +5 -7
- package/umd/icon/IconSetting/index.js +5 -7
- package/umd/icon/IconShop/index.js +5 -7
- package/umd/icon/IconShopping/index.js +5 -7
- package/umd/icon/IconSmileFill/index.js +5 -7
- package/umd/icon/IconSound/index.js +5 -7
- package/umd/icon/IconSquareChecked/index.js +5 -7
- package/umd/icon/IconSquareDisabled/index.js +5 -7
- package/umd/icon/IconSquareUnchecked/index.js +5 -7
- package/umd/icon/IconStar/index.js +5 -7
- package/umd/icon/IconStarFill/index.js +5 -7
- package/umd/icon/IconStarHalf/index.js +5 -7
- package/umd/icon/IconSubway/index.js +5 -7
- package/umd/icon/IconSuccessCircle/index.js +5 -7
- package/umd/icon/IconTriDown/index.js +5 -7
- package/umd/icon/IconTriUp/index.js +5 -7
- package/umd/icon/IconUpload/index.js +5 -7
- package/umd/icon/IconUser/index.js +5 -7
- package/umd/icon/IconUserFill/index.js +5 -7
- package/umd/icon/IconWarnCircle/index.js +5 -7
- package/umd/icon/IconWarnCircleFill/index.js +5 -7
- package/umd/icon/index.js +0 -1
- package/umd/image/index.js +53 -88
- package/umd/image-picker/add-icon.js +0 -2
- package/umd/image-picker/index.js +32 -47
- package/umd/image-preview/index.js +129 -239
- package/umd/image-preview/methods.js +5 -15
- package/umd/index-bar/group.js +16 -30
- package/umd/index-bar/index.js +55 -79
- package/umd/index-bar/side-bar.js +15 -32
- package/umd/index-bar/utils.js +3 -16
- package/umd/index.js +0 -1
- package/umd/input/hooks.js +45 -79
- package/umd/input/index.js +26 -35
- package/umd/keyboard/index.js +37 -64
- package/umd/load-more/index.js +33 -60
- package/umd/loading/index.js +19 -43
- package/umd/masking/index.js +47 -72
- package/umd/masking/methods.js +5 -18
- package/umd/nav-bar/back-icon.js +2 -5
- package/umd/nav-bar/index.js +37 -55
- package/umd/notice-bar/index.js +34 -56
- package/umd/notify/index.js +20 -40
- package/umd/notify/methods.js +2 -14
- package/umd/pagination/arrow.js +0 -2
- package/umd/pagination/index.js +27 -53
- package/umd/picker/index.js +48 -73
- package/umd/picker-view/components/cascader.js +13 -28
- package/umd/picker-view/components/multi-picker.js +8 -16
- package/umd/picker-view/components/picker-cell.js +45 -97
- package/umd/picker-view/index.js +30 -63
- package/umd/popover/hooks/useEvent.js +25 -44
- package/umd/popover/hooks/usePosition.js +100 -153
- package/umd/popover/index.js +1 -3
- package/umd/popover/menu.js +32 -45
- package/umd/popover/popover-inner.js +30 -43
- package/umd/popover/popover.js +69 -94
- package/umd/popup/index.js +22 -31
- package/umd/popup/methods.js +0 -1
- package/umd/popup-swiper/index.js +50 -83
- package/umd/popup-swiper/methods.js +0 -1
- package/umd/portal/index.js +3 -6
- package/umd/progress/index.js +27 -39
- package/umd/pull-refresh/android-pull-refresh.js +56 -86
- package/umd/pull-refresh/hooks.js +11 -29
- package/umd/pull-refresh/index.js +3 -7
- package/umd/pull-refresh/ios-pull-refresh.js +53 -72
- package/umd/pull-refresh/model.js +0 -1
- package/umd/radio/group.js +20 -30
- package/umd/radio/index.js +1 -3
- package/umd/radio/radio.js +0 -5
- package/umd/rate/index.js +28 -48
- package/umd/search-bar/association.js +14 -29
- package/umd/search-bar/cancel-button.js +8 -14
- package/umd/search-bar/highlight.js +14 -21
- package/umd/search-bar/index.js +77 -87
- package/umd/show-monitor/index.js +40 -104
- package/umd/skeleton/elements.js +47 -78
- package/umd/skeleton/index.js +18 -28
- package/umd/skeleton/skeleton-context.js +0 -3
- package/umd/slider/hooks/index.js +0 -4
- package/umd/slider/hooks/useSliderEvents.js +27 -55
- package/umd/slider/hooks/useSliderIcon.js +6 -17
- package/umd/slider/hooks/useSliderInit.js +32 -50
- package/umd/slider/hooks/useSliderStyle.js +13 -24
- package/umd/slider/index.js +47 -66
- package/umd/slider/marks.js +13 -22
- package/umd/slider/popover.js +4 -10
- package/umd/slider/thumb.js +11 -18
- package/umd/stepper/hooks/useButtonClick.js +15 -24
- package/umd/stepper/hooks/useInputEvent.js +10 -18
- package/umd/stepper/hooks/useValue.js +9 -13
- package/umd/stepper/index.js +84 -89
- package/umd/steps/index.js +25 -35
- package/umd/steps/step.js +10 -22
- package/umd/sticky/index.js +40 -68
- package/umd/style.js +1 -1
- package/umd/swipe-action/index.js +40 -84
- package/umd/swipe-action/item.js +9 -14
- package/umd/swipe-load/index.js +78 -106
- package/umd/switch/index.js +28 -45
- package/umd/tab-bar/index.js +0 -2
- package/umd/tab-bar/item.js +6 -19
- package/umd/tab-bar/tab-bar.js +16 -27
- package/umd/tabs/index.js +136 -197
- package/umd/tabs/tab-cell-underline.js +28 -71
- package/umd/tabs/tab-cell.js +73 -122
- package/umd/tabs/tab-pane.js +53 -98
- package/umd/tag/index.js +1 -3
- package/umd/tag/list.js +11 -20
- package/umd/tag/tag.js +20 -26
- package/umd/textarea/index.js +35 -51
- package/umd/toast/index.js +26 -49
- package/umd/toast/methods.js +2 -13
- package/umd/transition/index.js +16 -22
- package/umd/uploader/index.d.ts +1 -1
- package/umd/uploader/index.js +28 -39
- package/umd/uploader/upload/upload.js +9 -43
package/cjs/carousel/index.js
CHANGED
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
exports.__esModule = true;
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
|
|
10
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
8
|
var _mobileUtils = require("@arco-design/mobile-utils");
|
|
13
|
-
|
|
14
9
|
var _contextProvider = require("../context-provider");
|
|
15
|
-
|
|
16
10
|
var _helpers = require("../_helpers");
|
|
17
|
-
|
|
18
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
13
|
/**
|
|
23
14
|
* 轮播组件,支持自定义轮播索引样式及滑块宽度。**需要注意的是,如果正使用`fastclick`,需要为 touchstart 的 target 添加`needsclick`类**(<a href="https://github.com/ftlabs/fastclick#ignore-certain-elements-with-needsclick" target="_blank">详情戳这里</a>),以规避`fastclick`逻辑与组件内部的手势冲突。(如果使用了`list`属性则无需额外添加)
|
|
24
15
|
* @en Carousel component, supports custom carousel index style and slider width. **Note that if you are using `fastclick`, you need to add a `needsclick` class to the touchstart target ** (<a href="https://github.com/ftlabs/fastclick#ignore-certain-elements- with-needsclick" target="_blank">click here for details</a>) to avoid `fastclick` logic conflicts with gestures inside the component. (no need to add if `list` is set)
|
|
@@ -29,97 +20,95 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
29
20
|
*/
|
|
30
21
|
var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
31
22
|
var className = props.className,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
23
|
+
wrapStyle = props.wrapStyle,
|
|
24
|
+
style = props.style,
|
|
25
|
+
children = props.children,
|
|
26
|
+
_props$list = props.list,
|
|
27
|
+
list = _props$list === void 0 ? [] : _props$list,
|
|
28
|
+
_props$animateDuratio = props.animateDuration,
|
|
29
|
+
animateDuration = _props$animateDuratio === void 0 ? 500 : _props$animateDuratio,
|
|
30
|
+
_props$animateDuratio2 = props.animateDurationSlide,
|
|
31
|
+
animateDurationSlide = _props$animateDuratio2 === void 0 ? 300 : _props$animateDuratio2,
|
|
32
|
+
_props$loop = props.loop,
|
|
33
|
+
loop = _props$loop === void 0 ? true : _props$loop,
|
|
34
|
+
_props$autoPlay = props.autoPlay,
|
|
35
|
+
autoPlay = _props$autoPlay === void 0 ? true : _props$autoPlay,
|
|
36
|
+
_props$autoPlayDirect = props.autoPlayDirection,
|
|
37
|
+
autoPlayDirection = _props$autoPlayDirect === void 0 ? 'normal' : _props$autoPlayDirect,
|
|
38
|
+
_props$swipeable = props.swipeable,
|
|
39
|
+
swipeable = _props$swipeable === void 0 ? true : _props$swipeable,
|
|
40
|
+
_props$stayDuration = props.stayDuration,
|
|
41
|
+
stayDuration = _props$stayDuration === void 0 ? 4000 : _props$stayDuration,
|
|
42
|
+
boxWidth = props.boxWidth,
|
|
43
|
+
boxHeight = props.boxHeight,
|
|
44
|
+
baseBoxWidth = props.baseBoxWidth,
|
|
45
|
+
baseBoxHeight = props.baseBoxHeight,
|
|
46
|
+
_props$width = props.width,
|
|
47
|
+
width = _props$width === void 0 ? 0 : _props$width,
|
|
48
|
+
height = props.height,
|
|
49
|
+
_props$initialIndex = props.initialIndex,
|
|
50
|
+
initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex,
|
|
51
|
+
renderIndicator = props.renderIndicator,
|
|
52
|
+
_props$indicatorPos = props.indicatorPos,
|
|
53
|
+
indicatorPos = _props$indicatorPos === void 0 ? 'center' : _props$indicatorPos,
|
|
54
|
+
_props$indicatorVerti = props.indicatorVerticalPos,
|
|
55
|
+
indicatorVerticalPos = _props$indicatorVerti === void 0 ? 'left' : _props$indicatorVerti,
|
|
56
|
+
indicatorOutside = props.indicatorOutside,
|
|
57
|
+
_props$showIndicator = props.showIndicator,
|
|
58
|
+
showIndicator = _props$showIndicator === void 0 ? true : _props$showIndicator,
|
|
59
|
+
_props$hideSingleIndi = props.hideSingleIndicator,
|
|
60
|
+
hideSingleIndicator = _props$hideSingleIndi === void 0 ? true : _props$hideSingleIndi,
|
|
61
|
+
_props$indicatorType = props.indicatorType,
|
|
62
|
+
indicatorType = _props$indicatorType === void 0 ? 'square' : _props$indicatorType,
|
|
63
|
+
_props$indicatorClass = props.indicatorClass,
|
|
64
|
+
indicatorClass = _props$indicatorClass === void 0 ? '' : _props$indicatorClass,
|
|
65
|
+
indicatorInverse = props.indicatorInverse,
|
|
66
|
+
_props$spaceBetween = props.spaceBetween,
|
|
67
|
+
spaceBetween = _props$spaceBetween === void 0 ? 0 : _props$spaceBetween,
|
|
68
|
+
_props$offsetBetween = props.offsetBetween,
|
|
69
|
+
offsetBetween = _props$offsetBetween === void 0 ? 0 : _props$offsetBetween,
|
|
70
|
+
currentIndex = props.currentIndex,
|
|
71
|
+
_props$autoHeight = props.autoHeight,
|
|
72
|
+
autoHeight = _props$autoHeight === void 0 ? false : _props$autoHeight,
|
|
73
|
+
_props$percentToChang = props.percentToChange,
|
|
74
|
+
percentToChange = _props$percentToChang === void 0 ? 0.3 : _props$percentToChang,
|
|
75
|
+
_props$distanceToChan = props.distanceToChange,
|
|
76
|
+
distanceToChange = _props$distanceToChan === void 0 ? 10 : _props$distanceToChan,
|
|
77
|
+
_props$speedToChange = props.speedToChange,
|
|
78
|
+
speedToChange = _props$speedToChange === void 0 ? 100 : _props$speedToChange,
|
|
79
|
+
vertical = props.vertical,
|
|
80
|
+
lazyloadCount = props.lazyloadCount,
|
|
81
|
+
_props$inactiveScale = props.inactiveScale,
|
|
82
|
+
inactiveScale = _props$inactiveScale === void 0 ? 1 : _props$inactiveScale,
|
|
83
|
+
_props$stopPropagatio = props.stopPropagation,
|
|
84
|
+
stopPropagation = _props$stopPropagatio === void 0 ? true : _props$stopPropagatio,
|
|
85
|
+
_props$fakeItem = props.fakeItem,
|
|
86
|
+
fakeItem = _props$fakeItem === void 0 ? false : _props$fakeItem,
|
|
87
|
+
_props$allowEndBlank = props.allowEndBlank,
|
|
88
|
+
allowEndBlank = _props$allowEndBlank === void 0 ? false : _props$allowEndBlank,
|
|
89
|
+
_props$bounceWhenNoLo = props.bounceWhenNoLoop,
|
|
90
|
+
bounceWhenNoLoop = _props$bounceWhenNoLo === void 0 ? false : _props$bounceWhenNoLo,
|
|
91
|
+
_props$bounceDampRate = props.bounceDampRate,
|
|
92
|
+
bounceDampRate = _props$bounceDampRate === void 0 ? 3 : _props$bounceDampRate,
|
|
93
|
+
_props$iOSVisibleOpti = props.iOSVisibleOptimize,
|
|
94
|
+
iOSVisibleOptimize = _props$iOSVisibleOpti === void 0 ? true : _props$iOSVisibleOpti,
|
|
95
|
+
renderExtra = props.renderExtra,
|
|
96
|
+
distanceProcessor = props.distanceProcessor,
|
|
97
|
+
getInnerScrollContainer = props.getInnerScrollContainer,
|
|
98
|
+
onChange = props.onChange,
|
|
99
|
+
onAfterChange = props.onAfterChange,
|
|
100
|
+
onTouchStart = props.onTouchStart,
|
|
101
|
+
onTouchMove = props.onTouchMove,
|
|
102
|
+
onTouchEnd = props.onTouchEnd,
|
|
103
|
+
onTransitionStart = props.onTransitionStart,
|
|
104
|
+
onTransitionEnd = props.onTransitionEnd,
|
|
105
|
+
onDistanceChange = props.onDistanceChange,
|
|
106
|
+
_props$stopTouchThres = props.stopTouchThreshold,
|
|
107
|
+
stopTouchThreshold = _props$stopTouchThres === void 0 ? 0 : _props$stopTouchThres,
|
|
108
|
+
onTouchStopped = props.onTouchStopped,
|
|
109
|
+
onPageVisibleChange = props.onPageVisibleChange;
|
|
120
110
|
var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
useRtl = _useContext.useRtl;
|
|
123
112
|
var horizontalUseRtl = !vertical && useRtl;
|
|
124
113
|
var domRef = (0, _react.useRef)(null);
|
|
125
114
|
var wrapRef = (0, _react.useRef)(null);
|
|
@@ -131,70 +120,55 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
131
120
|
var touchStartTimeRef = (0, _react.useRef)(0);
|
|
132
121
|
var touchStartedRef = (0, _react.useRef)(false);
|
|
133
122
|
var touchMovedRef = (0, _react.useRef)(false);
|
|
134
|
-
|
|
135
123
|
var _useState = (0, _react.useState)(baseBoxWidth || 0),
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
124
|
+
wrapWidth = _useState[0],
|
|
125
|
+
setWrapWidth = _useState[1];
|
|
139
126
|
var _useState2 = (0, _react.useState)(baseBoxHeight || 0),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
127
|
+
wrapHeight = _useState2[0],
|
|
128
|
+
setWrapHeight = _useState2[1];
|
|
143
129
|
var touchStartXRef = (0, _react.useRef)(0);
|
|
144
130
|
var touchStartYRef = (0, _react.useRef)(0);
|
|
145
131
|
var scrollingRef = (0, _react.useRef)(null);
|
|
146
132
|
var touchStoppedRef = (0, _react.useRef)(false);
|
|
147
133
|
var bouncingRef = (0, _react.useRef)(false);
|
|
148
|
-
|
|
149
134
|
var _useState3 = (0, _react.useState)('auto'),
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
135
|
+
currentItemHeight = _useState3[0],
|
|
136
|
+
setCurrentItemHeight = _useState3[1];
|
|
153
137
|
var _useRefState = (0, _helpers.useRefState)(false),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
138
|
+
posAdjusting = _useRefState[0],
|
|
139
|
+
posAdjustingRef = _useRefState[1],
|
|
140
|
+
setPosAdjusting = _useRefState[2];
|
|
158
141
|
var _useRefState2 = (0, _helpers.useRefState)(0),
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
142
|
+
distance = _useRefState2[0],
|
|
143
|
+
distanceRef = _useRefState2[1],
|
|
144
|
+
setDistance = _useRefState2[2];
|
|
163
145
|
var _useState4 = (0, _react.useState)(true),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
146
|
+
isAutoJump = _useState4[0],
|
|
147
|
+
setIsAutoJump = _useState4[1];
|
|
167
148
|
var _useRefState3 = (0, _helpers.useRefState)(currentIndex !== void 0 ? currentIndex : initialIndex),
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
149
|
+
index = _useRefState3[0],
|
|
150
|
+
indexRef = _useRefState3[1],
|
|
151
|
+
setIndex = _useRefState3[2];
|
|
172
152
|
var _useRefState4 = (0, _helpers.useRefState)([]),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
153
|
+
transforms = _useRefState4[0],
|
|
154
|
+
transformsRef = _useRefState4[1],
|
|
155
|
+
setTransforms = _useRefState4[2];
|
|
177
156
|
var _useRefState5 = (0, _helpers.useRefState)((autoPlayDirection === 'reverse' || horizontalUseRtl) && autoPlay ? 'right' : 'left'),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
157
|
+
direction = _useRefState5[0],
|
|
158
|
+
directionRef = _useRefState5[1],
|
|
159
|
+
setStateDirection = _useRefState5[2];
|
|
182
160
|
var lastDirectionRef = (0, _react.useRef)('');
|
|
183
161
|
var lastShownIndexRef = (0, _react.useRef)(-1);
|
|
184
|
-
|
|
185
162
|
var _getAllChildren = getAllChildren(),
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
163
|
+
allChildren = _getAllChildren.allChildren,
|
|
164
|
+
fakeTwoChildren = _getAllChildren.fakeTwoChildren;
|
|
189
165
|
var total = allChildren.length;
|
|
190
166
|
var shownTotal = fakeTwoChildren ? 2 : total;
|
|
191
167
|
var indicatorArr = (0, _react.useMemo)(function () {
|
|
192
168
|
var arr = [];
|
|
193
|
-
|
|
194
169
|
for (var i = 0; i < shownTotal; i += 1) {
|
|
195
170
|
arr.push(i);
|
|
196
171
|
}
|
|
197
|
-
|
|
198
172
|
return arr;
|
|
199
173
|
}, [shownTotal]);
|
|
200
174
|
var rtlRatio = horizontalUseRtl ? -1 : 1;
|
|
@@ -218,14 +192,12 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
218
192
|
var inactiveValidScale = (0, _react.useMemo)(function () {
|
|
219
193
|
return Math.max(0, Math.min(inactiveScale, 1));
|
|
220
194
|
}, [inactiveScale]);
|
|
221
|
-
|
|
222
195
|
var _useState5 = (0, _react.useState)([]),
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
196
|
+
fakeIndexes = _useState5[0],
|
|
197
|
+
setFakeIndexes = _useState5[1];
|
|
198
|
+
var system = (0, _helpers.useSystem)();
|
|
199
|
+
// 开启自动循环时iOS会有渲染问题需要强刷dom,但不需要autoPlay的不用强刷,这里判断下
|
|
227
200
|
// @en When the automatic loop is turned on, there will be rendering problems in iOS. Need to brush the dom, but if you don't need autoPlay, don't need to brush.
|
|
228
|
-
|
|
229
201
|
var needRefreshDom = !noInterval && system === 'ios' && iOSVisibleOptimize;
|
|
230
202
|
var setDirection = (0, _react.useCallback)(function (newDirec) {
|
|
231
203
|
setStateDirection(function (direc) {
|
|
@@ -240,17 +212,14 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
240
212
|
if (onTouchStart && onTouchStart(e, shownTotal, getShownIndex(indexRef.current))) {
|
|
241
213
|
return;
|
|
242
214
|
}
|
|
243
|
-
|
|
244
215
|
if (posAdjustingRef.current) {
|
|
245
216
|
return;
|
|
246
|
-
}
|
|
217
|
+
}
|
|
218
|
+
// touchMove触发时,阻止handleTouchStart多次执行(如点击事件)
|
|
247
219
|
// @en When touchMove is triggered, prevent handleTouchStart from executing multiple times (such as click events)
|
|
248
|
-
|
|
249
|
-
|
|
250
220
|
if (touchStartedRef.current && touchMovedRef.current) {
|
|
251
221
|
return;
|
|
252
222
|
}
|
|
253
|
-
|
|
254
223
|
touchStartedRef.current = true;
|
|
255
224
|
touchMovedRef.current = false;
|
|
256
225
|
clear();
|
|
@@ -264,25 +233,20 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
264
233
|
}, [shownTotal, onTouchStart]);
|
|
265
234
|
var triggerTouchStopped = (0, _react.useCallback)(function (posDis) {
|
|
266
235
|
var needStop = Math.abs(posDis) > stopTouchThreshold;
|
|
267
|
-
|
|
268
236
|
if (!touchStoppedRef.current && needStop) {
|
|
269
237
|
onTouchStopped && onTouchStopped(posDis >= 0 ? -1 : 1);
|
|
270
238
|
}
|
|
271
|
-
|
|
272
239
|
touchStoppedRef.current = needStop;
|
|
273
240
|
}, [stopTouchThreshold, onTouchStopped]);
|
|
274
241
|
var handleTouchMove = (0, _react.useCallback)(function (e) {
|
|
275
242
|
if (onTouchMove && onTouchMove(e, shownTotal, getShownIndex(indexRef.current))) {
|
|
276
243
|
return;
|
|
277
244
|
}
|
|
278
|
-
|
|
279
245
|
stopPropagation && e.stopPropagation();
|
|
280
|
-
|
|
281
246
|
if (!touchStartedRef.current || posAdjustingRef.current) {
|
|
282
247
|
e.cancelable && e.preventDefault();
|
|
283
248
|
return;
|
|
284
249
|
}
|
|
285
|
-
|
|
286
250
|
touchMovedRef.current = true;
|
|
287
251
|
var evt = e.changedTouches[0];
|
|
288
252
|
var touchMoveX = Math.max(0, evt.clientX || 0);
|
|
@@ -292,41 +256,33 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
292
256
|
var absDisX = Math.abs(posDisX);
|
|
293
257
|
var absDisY = Math.abs(posDisY);
|
|
294
258
|
var originDis = vertical ? posDisY : posDisX;
|
|
295
|
-
|
|
296
259
|
var processor = distanceProcessor || function (dis, size, child) {
|
|
297
260
|
return child * (dis / size);
|
|
298
261
|
};
|
|
299
|
-
|
|
300
262
|
var posDis = processor(originDis, wrapSizeRef.current, childSize);
|
|
301
|
-
|
|
302
263
|
if (total < 2) {
|
|
303
264
|
triggerTouchStopped(posDis);
|
|
304
265
|
return;
|
|
305
266
|
}
|
|
306
|
-
|
|
307
267
|
if (scrollingRef.current === null) {
|
|
308
268
|
scrollingRef.current = vertical ? absDisY < absDisX : absDisX < absDisY;
|
|
309
|
-
}
|
|
269
|
+
}
|
|
270
|
+
// 如果是在滚动页面则禁用轮播图手势
|
|
310
271
|
// @en Disable carousel gestures if scrolling
|
|
311
|
-
|
|
312
|
-
|
|
313
272
|
if (scrollingRef.current) {
|
|
314
|
-
setDistance(0);
|
|
273
|
+
setDistance(0);
|
|
274
|
+
// bugfix: 未触发横滑就不触发touchend逻辑,且这个场景不需要触发onTouchStopped,因此直接设置touchStoppedRef
|
|
315
275
|
// @en bugfix: The touchend event will not be triggered if the horizontal swipe is not triggered, and this scene does not need to trigger onTouchStopped.
|
|
316
|
-
|
|
317
|
-
|
|
276
|
+
touchStoppedRef.current = true;
|
|
277
|
+
// 不会触发jumpTo,但touchstart时clear了,所以要手动设置一次interval
|
|
318
278
|
// @en JumpTo will not be triggered, but it is cleared in touchstart event, so need to manually set interval once
|
|
319
|
-
|
|
320
279
|
setPlayIntervalRef.current();
|
|
321
280
|
return;
|
|
322
281
|
}
|
|
323
|
-
|
|
324
282
|
setDirection(posDis >= 0 ? 'right' : 'left');
|
|
325
283
|
var comparedPos = posDis * rtlRatio;
|
|
326
|
-
|
|
327
284
|
if (noLoop && (indexRef.current === 0 && comparedPos > 0 || indexRef.current === total - 1 && comparedPos < 0)) {
|
|
328
285
|
triggerTouchStopped(posDis);
|
|
329
|
-
|
|
330
286
|
if (bounceWhenNoLoop && bounceDampRate) {
|
|
331
287
|
e.cancelable && e.preventDefault();
|
|
332
288
|
bouncingRef.current = true;
|
|
@@ -334,10 +290,8 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
334
290
|
} else {
|
|
335
291
|
setDistance(0);
|
|
336
292
|
}
|
|
337
|
-
|
|
338
293
|
return;
|
|
339
294
|
}
|
|
340
|
-
|
|
341
295
|
e.cancelable && e.preventDefault();
|
|
342
296
|
touchStoppedRef.current = false;
|
|
343
297
|
var maxDis = childSize;
|
|
@@ -357,14 +311,13 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
357
311
|
(0, _helpers.useSwiperInnerScroll)(getInnerScrollContainer);
|
|
358
312
|
var updateWhenVisible = (0, _react.useCallback)(function () {
|
|
359
313
|
fakeWrapRef.current && (fakeWrapRef.current.style.display = 'none');
|
|
360
|
-
wrapRef.current && (wrapRef.current.style.display = '');
|
|
314
|
+
wrapRef.current && (wrapRef.current.style.display = '');
|
|
315
|
+
// 部分情况下页面隐藏后容器宽度变成0,因此页面返回后需重新取一次容器尺寸
|
|
361
316
|
// @en In some cases, the width of the container becomes 0 after the page is invisible, so the container size needs to be resized after the page is visible.
|
|
362
|
-
|
|
363
317
|
updateDataRef.current();
|
|
364
318
|
}, []);
|
|
365
319
|
var updateWhenInvisible = (0, _react.useCallback)(function () {
|
|
366
320
|
clear();
|
|
367
|
-
|
|
368
321
|
if (wrapRef.current && fakeWrapRef.current) {
|
|
369
322
|
fakeWrapRef.current.style.height = (wrapRef.current.offsetHeight || 0) + "px";
|
|
370
323
|
fakeWrapRef.current.style.display = 'block';
|
|
@@ -374,10 +327,9 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
374
327
|
(0, _react.useEffect)(function () {
|
|
375
328
|
if (onPageVisibleChange) {
|
|
376
329
|
return onPageVisibleChange(updateWhenVisible, updateWhenInvisible);
|
|
377
|
-
}
|
|
330
|
+
}
|
|
331
|
+
// ios 在页面隐藏后返回时会有dom结构正确但渲染错乱的情况,因此在页面隐藏时先用占位符,返回后重新渲染一次dom
|
|
378
332
|
// @en In iOS, When the page is invisible, the DOM will be correct but the rendering is disordered. So use a placeholder when the page is invisible, and re-render the DOM after it is visible.
|
|
379
|
-
|
|
380
|
-
|
|
381
333
|
var update = function update() {
|
|
382
334
|
if (document.visibilityState === 'visible') {
|
|
383
335
|
updateWhenVisible();
|
|
@@ -385,7 +337,6 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
385
337
|
updateWhenInvisible();
|
|
386
338
|
}
|
|
387
339
|
};
|
|
388
|
-
|
|
389
340
|
document.addEventListener('visibilitychange', update);
|
|
390
341
|
return function () {
|
|
391
342
|
document.removeEventListener('visibilitychange', update);
|
|
@@ -406,7 +357,6 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
406
357
|
wrapRef.current.addEventListener('touchstart', handleTouchStart);
|
|
407
358
|
wrapRef.current.addEventListener('touchmove', handleTouchMove);
|
|
408
359
|
}
|
|
409
|
-
|
|
410
360
|
return function () {
|
|
411
361
|
if (wrapRef.current && needTouchEvent) {
|
|
412
362
|
wrapRef.current.removeEventListener('touchstart', handleTouchStart);
|
|
@@ -469,43 +419,34 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
469
419
|
if (!fakeItem || posAdjusting) {
|
|
470
420
|
return;
|
|
471
421
|
}
|
|
472
|
-
|
|
473
422
|
setCurrentFakeIndex();
|
|
474
423
|
}, [posAdjusting, index, direction, total, childSize, horizontalUseRtl]);
|
|
475
|
-
|
|
476
424
|
function getShownIndex(nowIndex) {
|
|
477
425
|
var validIndex = nowIndex === total ? 0 : nowIndex;
|
|
478
426
|
var shownInd = nowIndex === -1 ? total - 1 : validIndex;
|
|
479
427
|
return fakeTwoChildren ? shownInd % 2 : shownInd;
|
|
480
428
|
}
|
|
481
|
-
|
|
482
429
|
function getDynamicDuration(autoJump) {
|
|
483
430
|
return autoJump ? animateDuration : animateDurationSlide;
|
|
484
431
|
}
|
|
485
|
-
|
|
486
432
|
function setCurrentHeight() {
|
|
487
433
|
if (!innerRef.current || !autoHeight || vertical) {
|
|
488
434
|
return;
|
|
489
435
|
}
|
|
490
|
-
|
|
491
436
|
var allItemDom = itemsRef.current;
|
|
492
437
|
var nowIndex = getShownIndex(indexRef.current);
|
|
493
438
|
var currentHeight = (allItemDom[nowIndex] || {}).offsetHeight || 'auto';
|
|
494
439
|
setCurrentItemHeight(currentHeight);
|
|
495
440
|
}
|
|
496
|
-
|
|
497
441
|
function getAllChildren() {
|
|
498
442
|
var allChild = [];
|
|
499
443
|
var fakeTwo = false;
|
|
500
|
-
|
|
501
444
|
if (list && list.length) {
|
|
502
445
|
var actualList = list;
|
|
503
|
-
|
|
504
446
|
if (list.length === 2 && fakeItem) {
|
|
505
447
|
fakeTwo = true;
|
|
506
448
|
actualList = list.concat(list);
|
|
507
449
|
}
|
|
508
|
-
|
|
509
450
|
allChild = actualList.map(function (item, i) {
|
|
510
451
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("img", {
|
|
511
452
|
key: i,
|
|
@@ -519,7 +460,6 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
519
460
|
});
|
|
520
461
|
} else if (children && Object.prototype.toString.call(children) === '[object Array]') {
|
|
521
462
|
allChild = children;
|
|
522
|
-
|
|
523
463
|
if (allChild.length === 2 && fakeItem) {
|
|
524
464
|
fakeTwo = true;
|
|
525
465
|
allChild = [].concat(allChild, allChild);
|
|
@@ -527,32 +467,25 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
527
467
|
} else {
|
|
528
468
|
allChild = children ? [children] : [];
|
|
529
469
|
}
|
|
530
|
-
|
|
531
470
|
return {
|
|
532
471
|
allChildren: allChild,
|
|
533
472
|
fakeTwoChildren: fakeTwo
|
|
534
473
|
};
|
|
535
474
|
}
|
|
536
|
-
|
|
537
475
|
function getDefaultDirection() {
|
|
538
476
|
var nowIndex = indexRef.current;
|
|
539
|
-
|
|
540
477
|
if (nowIndex === total - 1) {
|
|
541
478
|
return horizontalUseRtl ? 'right' : 'left';
|
|
542
479
|
}
|
|
543
|
-
|
|
544
480
|
if (nowIndex === 0) {
|
|
545
481
|
return horizontalUseRtl ? 'left' : 'right';
|
|
546
482
|
}
|
|
547
|
-
|
|
548
483
|
return '';
|
|
549
484
|
}
|
|
550
|
-
|
|
551
485
|
function changeIndex(newIndex, rightNow, userSetDirec) {
|
|
552
486
|
if (posAdjustingRef.current) {
|
|
553
487
|
return;
|
|
554
488
|
}
|
|
555
|
-
|
|
556
489
|
if (userSetDirec) {
|
|
557
490
|
// rtl 模式取反
|
|
558
491
|
var direcMap = {
|
|
@@ -568,15 +501,12 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
568
501
|
jumpTo(newIndex, true, rightNow);
|
|
569
502
|
}
|
|
570
503
|
}
|
|
571
|
-
|
|
572
504
|
function jumpTo(newIndex, autoJump, rightNow, direc) {
|
|
573
505
|
if (autoJump === void 0) {
|
|
574
506
|
autoJump = true;
|
|
575
507
|
}
|
|
576
|
-
|
|
577
508
|
var oldIndex = getShownIndex(indexRef.current);
|
|
578
509
|
var changedIndex = newIndex !== oldIndex ? getShownIndex(newIndex) : -1;
|
|
579
|
-
|
|
580
510
|
if (direc) {
|
|
581
511
|
setDirection(direc);
|
|
582
512
|
} else if (autoJump) {
|
|
@@ -586,7 +516,6 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
586
516
|
} else {
|
|
587
517
|
setDirection('');
|
|
588
518
|
}
|
|
589
|
-
|
|
590
519
|
setPosAdjusting(true);
|
|
591
520
|
setIsAutoJump(autoJump);
|
|
592
521
|
setDistance(0);
|
|
@@ -599,7 +528,6 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
599
528
|
setDirection(getDefaultDirection());
|
|
600
529
|
var newTransform = transformsRef.current.slice();
|
|
601
530
|
var transChanged = false;
|
|
602
|
-
|
|
603
531
|
if (newIndex === -1 && movedChildRef.current >= 0) {
|
|
604
532
|
newTransform[movedChildRef.current] = 0;
|
|
605
533
|
transChanged = true;
|
|
@@ -609,15 +537,12 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
609
537
|
transChanged = true;
|
|
610
538
|
setIndex(0);
|
|
611
539
|
}
|
|
612
|
-
|
|
613
540
|
transChanged && setTransforms(newTransform);
|
|
614
541
|
setIsAutoJump(true);
|
|
615
542
|
onTransitionEnd && onTransitionEnd();
|
|
616
|
-
|
|
617
543
|
if (changedIndex >= 0) {
|
|
618
544
|
onAfterChange && onAfterChange(changedIndex, oldIndex);
|
|
619
545
|
}
|
|
620
|
-
|
|
621
546
|
(0, _mobileUtils.nextTick)(function () {
|
|
622
547
|
setPlayIntervalRef.current();
|
|
623
548
|
});
|
|
@@ -625,40 +550,32 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
625
550
|
}, rightNow ? 0 : getDynamicDuration(autoJump));
|
|
626
551
|
autoJump && setDirection('');
|
|
627
552
|
}
|
|
628
|
-
|
|
629
553
|
function setPlayInterval() {
|
|
630
554
|
clear();
|
|
631
|
-
|
|
632
555
|
if (noInterval) {
|
|
633
556
|
return;
|
|
634
557
|
}
|
|
635
|
-
|
|
636
558
|
timerRef.current = delayTimeout(function () {
|
|
637
559
|
jumpTo(autoPlayDirection === 'reverse' ? indexRef.current - 1 : indexRef.current + 1);
|
|
638
560
|
}, stayDuration);
|
|
639
561
|
}
|
|
640
|
-
|
|
641
562
|
function updateLayoutData() {
|
|
642
563
|
if (wrapRef.current) {
|
|
643
564
|
setWrapWidth(wrapRef.current.offsetWidth);
|
|
644
565
|
setWrapHeight(wrapRef.current.offsetHeight);
|
|
645
566
|
}
|
|
646
|
-
|
|
647
567
|
setCurrentHeight();
|
|
648
568
|
}
|
|
649
|
-
|
|
650
569
|
function updateData() {
|
|
651
570
|
updateLayoutData();
|
|
652
571
|
setPlayIntervalRef.current();
|
|
653
572
|
}
|
|
654
|
-
|
|
655
573
|
function clear() {
|
|
656
574
|
if (timerRef.current) {
|
|
657
575
|
clearTimeout(timerRef.current);
|
|
658
576
|
timerRef.current = null;
|
|
659
577
|
}
|
|
660
578
|
}
|
|
661
|
-
|
|
662
579
|
function getFakeChild() {
|
|
663
580
|
if (noLoop) {
|
|
664
581
|
// 循环状态从有到无时,重置 transforms
|
|
@@ -666,7 +583,6 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
666
583
|
setTransforms([]);
|
|
667
584
|
return;
|
|
668
585
|
}
|
|
669
|
-
|
|
670
586
|
var nowIndex = indexRef.current;
|
|
671
587
|
var newTransform = transformsRef.current.slice();
|
|
672
588
|
var dis = Math.max(0, childSize);
|
|
@@ -683,53 +599,42 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
683
599
|
});
|
|
684
600
|
setTransforms(newTransform);
|
|
685
601
|
}
|
|
686
|
-
|
|
687
602
|
function delayTimeout(callback, timeout) {
|
|
688
603
|
return setTimeout(callback, timeout);
|
|
689
604
|
}
|
|
690
|
-
|
|
691
605
|
function handleTouchEnd(e) {
|
|
692
606
|
if (!needTouchEvent) {
|
|
693
607
|
return;
|
|
694
608
|
}
|
|
695
|
-
|
|
696
609
|
if (onTouchEnd && onTouchEnd(e.nativeEvent, shownTotal, getShownIndex(indexRef.current))) {
|
|
697
610
|
return;
|
|
698
611
|
}
|
|
699
|
-
|
|
700
612
|
stopPropagation && e.stopPropagation();
|
|
701
|
-
|
|
702
613
|
if (!touchStartedRef.current) {
|
|
703
614
|
return;
|
|
704
615
|
}
|
|
705
|
-
|
|
706
616
|
touchStartedRef.current = false;
|
|
707
|
-
|
|
708
617
|
if (!touchMovedRef.current) {
|
|
709
618
|
setPlayIntervalRef.current();
|
|
710
619
|
return;
|
|
711
620
|
}
|
|
712
|
-
|
|
713
|
-
|
|
621
|
+
touchMovedRef.current = false;
|
|
622
|
+
// bugfix: 回弹判断逻辑需在touchMovedRef标识重置逻辑之后,否则会在触发回弹后导致标识无法重置引起滑动判断问题
|
|
714
623
|
// @en bugfix: The logic for the bounce judgment needs to be after the touchMovedRef reset logic, otherwise it will cause the problem of slide judgment after the bounce is triggered.
|
|
715
|
-
|
|
716
624
|
if (bouncingRef.current) {
|
|
717
625
|
bouncingRef.current = false;
|
|
718
626
|
jumpTo(index, false);
|
|
719
627
|
return;
|
|
720
628
|
}
|
|
721
|
-
|
|
722
629
|
if (posAdjustingRef.current || touchStoppedRef.current) {
|
|
723
630
|
return;
|
|
724
631
|
}
|
|
725
|
-
|
|
726
632
|
var touchEndTime = new Date().getTime();
|
|
727
633
|
var dis = Math.abs(distance);
|
|
728
634
|
var speed = dis / (touchEndTime - touchStartTimeRef.current) * 1000;
|
|
729
635
|
var maxSlice = childSize * percentToChange;
|
|
730
636
|
var needJump = dis > maxSlice && dis > distanceToChange || speed > speedToChange;
|
|
731
637
|
var comparedDis = distance * rtlRatio;
|
|
732
|
-
|
|
733
638
|
if (comparedDis > 0 && needJump) {
|
|
734
639
|
jumpTo(index - 1, false);
|
|
735
640
|
} else if (comparedDis < 0 && needJump) {
|
|
@@ -738,14 +643,12 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
738
643
|
jumpTo(index, false);
|
|
739
644
|
}
|
|
740
645
|
}
|
|
741
|
-
|
|
742
646
|
function getSlideTransitionStyle() {
|
|
743
647
|
return {
|
|
744
648
|
transitionProperty: posAdjusting ? 'transform' : 'none',
|
|
745
649
|
transitionDuration: posAdjusting ? dynamicAnimateDuration + "ms" : '0ms'
|
|
746
650
|
};
|
|
747
651
|
}
|
|
748
|
-
|
|
749
652
|
function getInnerStyle() {
|
|
750
653
|
var transitionStyle = (0, _helpers.getStyleWithVendor)(getSlideTransitionStyle());
|
|
751
654
|
var innerSize = childSize * total;
|
|
@@ -755,24 +658,21 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
755
658
|
var minTransform = horizontalUseRtl ? -1 * max : min;
|
|
756
659
|
var maxTransform = horizontalUseRtl ? -1 * min : max;
|
|
757
660
|
var comparedDis = rtlRatio * distance;
|
|
758
|
-
var noLoopDis = bounceWhenNoLoop && (index === 0 && comparedDis > 0 || index === total - 1 && comparedDis < 0) ? Math.min(minTransform + distance, Math.max(maxTransform + distance, dis)) : Math.min(minTransform, Math.max(maxTransform, dis));
|
|
661
|
+
var noLoopDis = bounceWhenNoLoop && (index === 0 && comparedDis > 0 || index === total - 1 && comparedDis < 0) ? Math.min(minTransform + distance, Math.max(maxTransform + distance, dis)) : Math.min(minTransform, Math.max(maxTransform, dis));
|
|
662
|
+
// noLoop时需要在最后也露出spaceBetween的空白,所以当滑到最后一个时transform向左移动相应宽度
|
|
759
663
|
// @en When noLoop is used, the blank space of spaceBetween needs to be exposed at the end, so when sliding to the last one, the transform value moves to the left by the corresponding width
|
|
760
|
-
|
|
761
664
|
var translateDis = noLoop ? noLoopDis - (total > 1 && index === total - 1 ? spaceBetween : 0) * rtlRatio : dis;
|
|
762
|
-
var initTranslateDis = -1 * index * 100;
|
|
763
|
-
|
|
665
|
+
var initTranslateDis = -1 * index * 100;
|
|
666
|
+
// bugfix: prop `style` did not match in ssr
|
|
764
667
|
var transStr = childSize > 0 ? "" + translateDis + (translateDis ? 'px' : '') : "" + initTranslateDis + (initTranslateDis ? '%' : '');
|
|
765
|
-
|
|
766
668
|
if (vertical) {
|
|
767
669
|
var _translateStyle = (0, _helpers.getStyleWithVendor)({
|
|
768
670
|
transform: "translateY(" + transStr + ") translateZ(0)"
|
|
769
671
|
});
|
|
770
|
-
|
|
771
672
|
return (0, _extends3.default)({}, transitionStyle, _translateStyle, {
|
|
772
673
|
width: '100%'
|
|
773
674
|
});
|
|
774
675
|
}
|
|
775
|
-
|
|
776
676
|
var translateStyle = (0, _helpers.getStyleWithVendor)({
|
|
777
677
|
transform: "translateX(" + transStr + ") translateZ(0)"
|
|
778
678
|
});
|
|
@@ -781,41 +681,36 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
781
681
|
height: height
|
|
782
682
|
}, transitionStyle, translateStyle);
|
|
783
683
|
}
|
|
784
|
-
|
|
785
684
|
function getCarouselStyle() {
|
|
786
685
|
if (vertical) {
|
|
787
686
|
return (0, _extends3.default)({
|
|
788
687
|
height: userSetBoxHeight
|
|
789
688
|
}, style || {});
|
|
790
689
|
}
|
|
791
|
-
|
|
792
690
|
var heightStyle = currentItemHeight && currentItemHeight !== 'auto' ? {
|
|
793
691
|
height: currentItemHeight
|
|
794
692
|
} : {};
|
|
795
693
|
return (0, _extends3.default)({
|
|
796
694
|
width: userSetBoxWidth
|
|
797
695
|
}, heightStyle, style || {});
|
|
798
|
-
}
|
|
799
|
-
// @en When the front or last slider is manually placed to the rear or the front through transform, it can be considered as the total or -1 module in the display layer
|
|
800
|
-
|
|
696
|
+
}
|
|
801
697
|
|
|
698
|
+
// 当最前或最后的滑块通过transform手动被放置到最后或最前时,在展示层可以认为是第total个或第-1个模块
|
|
699
|
+
// @en When the front or last slider is manually placed to the rear or the front through transform, it can be considered as the total or -1 module in the display layer
|
|
802
700
|
function getShownChildIndex(curIndex) {
|
|
803
701
|
var childIndex = curIndex;
|
|
804
|
-
|
|
805
702
|
if (transforms[childIndex] * rtlRatio > 0) {
|
|
806
703
|
childIndex = total;
|
|
807
704
|
} else if (transforms[childIndex] * rtlRatio < 0) {
|
|
808
705
|
childIndex = -1;
|
|
809
706
|
}
|
|
810
|
-
|
|
811
707
|
return childIndex;
|
|
812
|
-
}
|
|
813
|
-
// @en When there is exposed content on both sides, it is necessary to fake the front and rear dom to make visual filling in order to connect circularly.
|
|
814
|
-
|
|
708
|
+
}
|
|
815
709
|
|
|
710
|
+
// 当两侧有露出内容时,为了循环衔接上需要fake前后的dom来做视觉填充
|
|
711
|
+
// @en When there is exposed content on both sides, it is necessary to fake the front and rear dom to make visual filling in order to connect circularly.
|
|
816
712
|
function setCurrentFakeIndex() {
|
|
817
713
|
var newIndexes = fakeIndexes.slice();
|
|
818
|
-
|
|
819
714
|
if (childSize <= 0) {
|
|
820
715
|
if (index === 0) {
|
|
821
716
|
newIndexes[0] = {
|
|
@@ -823,88 +718,73 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
823
718
|
side: 'left'
|
|
824
719
|
};
|
|
825
720
|
}
|
|
826
|
-
|
|
827
721
|
if (index === total - 1) {
|
|
828
722
|
newIndexes[2] = {
|
|
829
723
|
index: 0,
|
|
830
724
|
side: 'right'
|
|
831
725
|
};
|
|
832
726
|
}
|
|
833
|
-
|
|
834
727
|
setFakeIndexes(newIndexes);
|
|
835
728
|
return;
|
|
836
729
|
}
|
|
837
|
-
|
|
838
730
|
if (index === 1 && direction === rightDirec || index === 0 && direction !== rightDirec) {
|
|
839
731
|
newIndexes[0] = {
|
|
840
732
|
index: total - 1,
|
|
841
733
|
side: 'left'
|
|
842
734
|
};
|
|
843
735
|
}
|
|
844
|
-
|
|
845
736
|
if (index === 0 && direction === rightDirec || index === -1) {
|
|
846
737
|
newIndexes[1] = {
|
|
847
738
|
index: total - 2,
|
|
848
739
|
side: 'left'
|
|
849
740
|
};
|
|
850
741
|
}
|
|
851
|
-
|
|
852
742
|
if (index === total - 2 && direction === leftDirec || index === total - 1 && direction !== leftDirec) {
|
|
853
743
|
newIndexes[2] = {
|
|
854
744
|
index: 0,
|
|
855
745
|
side: 'right'
|
|
856
746
|
};
|
|
857
747
|
}
|
|
858
|
-
|
|
859
748
|
if (index === total - 1 && direction === leftDirec || index === total) {
|
|
860
749
|
newIndexes[3] = {
|
|
861
750
|
index: 1,
|
|
862
751
|
side: 'right'
|
|
863
752
|
};
|
|
864
753
|
}
|
|
865
|
-
|
|
866
754
|
setFakeIndexes(newIndexes);
|
|
867
755
|
}
|
|
868
|
-
|
|
869
756
|
function getItemTranslateStyle(childIndex, ratio) {
|
|
870
757
|
var dis = index - childIndex;
|
|
871
758
|
var prefix = dis > 0 ? 1 : -1;
|
|
872
759
|
var transPercent = 1 - inactiveValidScale;
|
|
873
760
|
var ratioWithRtl = ratio * rtlRatio;
|
|
874
761
|
var trans = 0;
|
|
875
|
-
|
|
876
762
|
if (Math.abs(dis) > 1) {
|
|
877
763
|
trans = (prefix * (Math.abs(dis) - 1) - ratioWithRtl) * transPercent * rtlRatio;
|
|
878
764
|
} else if (dis === -1 && ratioWithRtl > 0 || dis === 1 && ratioWithRtl < 0) {
|
|
879
765
|
trans = -1 * ratio * transPercent;
|
|
880
766
|
}
|
|
881
|
-
|
|
882
767
|
return "translate" + (vertical ? 'Y' : 'X') + "(" + trans * 100 + "%)";
|
|
883
768
|
}
|
|
884
|
-
|
|
885
769
|
function getItemScaleStyle(childIndex, ratio) {
|
|
886
|
-
var originScale = inactiveValidScale;
|
|
770
|
+
var originScale = inactiveValidScale;
|
|
771
|
+
// active滑块前后两侧的滑块,根据滑动距离等比放大
|
|
887
772
|
// @en The front and rear sides of the active slider, and zoom in proportionally according to the sliding distance
|
|
888
|
-
|
|
889
773
|
if (childIndex === index - 1 && direction === rightDirec || childIndex === index + 1 && direction === leftDirec) {
|
|
890
774
|
return originScale + (1 - originScale) * Math.abs(ratio);
|
|
891
|
-
}
|
|
775
|
+
}
|
|
776
|
+
// active的滑块,根据滑动距离等比缩小
|
|
892
777
|
// @en The active slider, zoom out proportionally according to the sliding distance
|
|
893
|
-
|
|
894
|
-
|
|
895
778
|
if (childIndex === index) {
|
|
896
779
|
return 1 - (1 - originScale) * Math.abs(ratio);
|
|
897
|
-
}
|
|
780
|
+
}
|
|
781
|
+
// 其他保持inactiveScale即可
|
|
898
782
|
// @en Others remain inactiveScale
|
|
899
|
-
|
|
900
|
-
|
|
901
783
|
return originScale;
|
|
902
784
|
}
|
|
903
|
-
|
|
904
785
|
function getItemOriginStyle(childIndex) {
|
|
905
786
|
var origin = 0.5;
|
|
906
787
|
var dis = childIndex - index;
|
|
907
|
-
|
|
908
788
|
if (dis === 0) {
|
|
909
789
|
// 当前active的卡片,随滑动方向切换origin
|
|
910
790
|
// @en The currently active card, switch origin with the sliding direction
|
|
@@ -918,21 +798,19 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
918
798
|
// @en The cards after the currently active card, the origin is on the far left
|
|
919
799
|
origin = horizontalUseRtl ? 1 : 0;
|
|
920
800
|
}
|
|
921
|
-
|
|
922
801
|
var originStr = origin * 100 + "%";
|
|
923
802
|
return vertical ? "center " + originStr : originStr + " center";
|
|
924
803
|
}
|
|
925
|
-
|
|
926
804
|
function getItemInnerStyle(curIndex) {
|
|
927
805
|
var transitionStyle = getSlideTransitionStyle();
|
|
928
806
|
var childIndex = getShownChildIndex(curIndex);
|
|
929
|
-
var ratio = distance / childSize || 0;
|
|
807
|
+
var ratio = distance / childSize || 0;
|
|
808
|
+
// 有放大效果的item,随着distance变化而变化scale和transform-origin
|
|
930
809
|
// @en Item with magnification effect, scale and transform-origin change with distance
|
|
931
810
|
// transform效果与fake dom时item的transform需隔离,且scale后会影响item的padding展示
|
|
932
811
|
// @en The transform effect of the item needs to be isolated from the fake dom, and the padding display of the item will be affected after scale.
|
|
933
812
|
// 因此需要缩放时多包裹一层item-inner,单独处理缩放逻辑
|
|
934
813
|
// @en Therefore, need to wrap an additional layer of item-inner when scaling, and handle the scaling logic separately
|
|
935
|
-
|
|
936
814
|
var scale = getItemScaleStyle(childIndex, ratio);
|
|
937
815
|
var transformStyle = {
|
|
938
816
|
transform: getItemTranslateStyle(childIndex, ratio) + " scale(" + scale + ")",
|
|
@@ -940,10 +818,8 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
940
818
|
};
|
|
941
819
|
return (0, _helpers.getStyleWithVendor)((0, _extends3.default)({}, transitionStyle, transformStyle));
|
|
942
820
|
}
|
|
943
|
-
|
|
944
821
|
function getItemFakeStyle(childIndex) {
|
|
945
822
|
var _extends2, _ref, _ref2;
|
|
946
|
-
|
|
947
823
|
var styleMap = {
|
|
948
824
|
leftDirec: vertical ? 'top' : leftDirec,
|
|
949
825
|
rightDirec: vertical ? 'bottom' : rightDirec,
|
|
@@ -954,10 +830,8 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
954
830
|
position: 'absolute'
|
|
955
831
|
}, _extends2[styleMap.otherDirec] = 0, _extends2), childIndex >= 0 ? (_ref = {}, _ref[styleMap.leftDirec] = childSize > 0 ? '100%' : total * 100 + "%", _ref.transform = "translate" + styleMap.trans + "(" + (childIndex - total) * rtlRatio * 100 + "%)", _ref) : (_ref2 = {}, _ref2[styleMap.rightDirec] = '100%', _ref2.transform = "translate" + styleMap.trans + "(" + (childIndex + 1) * rtlRatio * 100 + "%)", _ref2));
|
|
956
832
|
}
|
|
957
|
-
|
|
958
833
|
function getItemStyle(childIndex, isFake) {
|
|
959
834
|
var _ref3, _ref4;
|
|
960
|
-
|
|
961
835
|
var initialStartSpace = spaceBetween + leftOffset;
|
|
962
836
|
var initialEndSpace = spaceBetween + rightOffset;
|
|
963
837
|
var initalSize = vertical ? userSetBoxHeight : '100%';
|
|
@@ -968,26 +842,23 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
968
842
|
paddingStart: vertical ? 'paddingTop' : horizontalPaddingStart,
|
|
969
843
|
paddingEnd: vertical ? 'paddingBottom' : horizontalPaddingEnd,
|
|
970
844
|
translate: vertical ? 'translateY' : 'translateX'
|
|
971
|
-
};
|
|
845
|
+
};
|
|
846
|
+
// bugfix: item 为半透明状态下 fakeItem 和普通 item 重叠露馅问题
|
|
972
847
|
// @en bugfix: Solve the problem of overlapping fakeItem and the normal item when item is translucent
|
|
973
|
-
|
|
974
848
|
var transformStyle = isFake ? {
|
|
975
849
|
visibility: childIndex === total && transforms[0] > 0 || childIndex === -1 && transforms[total - 1] < 0 ? 'hidden' : 'initial'
|
|
976
850
|
} : {
|
|
977
851
|
transform: styleMap.translate + "(" + (transforms[childIndex] || 0) + "px)"
|
|
978
|
-
};
|
|
852
|
+
};
|
|
853
|
+
// childSize <= 0 说明是未全部加载完成的首屏情况 做一下特殊处理
|
|
979
854
|
// @en childSize <= 0 indicates that the first screen is not fully loaded, so do some special treatment
|
|
980
|
-
|
|
981
855
|
var layoutStyle = childSize > 0 ? (_ref3 = {}, _ref3[styleMap.size] = childSize - spaceBetween, _ref3[styleMap.paddingStart] = spaceBetween, _ref3.boxSizing = 'content-box', _ref3) : (_ref4 = {}, _ref4[styleMap.size] = initalSize, _ref4[styleMap.paddingStart] = initialStartSpace, _ref4[styleMap.paddingEnd] = initialEndSpace, _ref4.boxSizing = 'border-box', _ref4.transform = styleMap.translate + "(" + (childIndex === index ? 0 : (index - childIndex) * (spaceBetween + leftOffset + rightOffset)) + "px)", _ref4);
|
|
982
856
|
var fakeStyle = isFake ? getItemFakeStyle(childIndex) : {};
|
|
983
|
-
|
|
984
857
|
if (isFake && childSize < 0) {
|
|
985
858
|
delete fakeStyle.transform;
|
|
986
859
|
}
|
|
987
|
-
|
|
988
860
|
return (0, _helpers.getStyleWithVendor)((0, _extends3.default)({}, transformStyle, layoutStyle, fakeStyle));
|
|
989
861
|
}
|
|
990
|
-
|
|
991
862
|
function renderChild(child, childIndex, prefix) {
|
|
992
863
|
// 兼容线上逻辑,不需要切换放大效果的,不包裹item-inner
|
|
993
864
|
// @en No need to switch the magnification effect, do not wrap item-inner
|
|
@@ -996,12 +867,10 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
996
867
|
style: getItemInnerStyle(childIndex)
|
|
997
868
|
}, child);
|
|
998
869
|
}
|
|
999
|
-
|
|
1000
870
|
function renderFakeItem(prefix, fakeIndex, side) {
|
|
1001
871
|
if (!fakeItem || fakeIndex === void 0) {
|
|
1002
872
|
return null;
|
|
1003
873
|
}
|
|
1004
|
-
|
|
1005
874
|
var posIndex = side === 'left' ? fakeIndex - total : fakeIndex + total;
|
|
1006
875
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1007
876
|
key: "" + fakeIndex + posIndex,
|
|
@@ -1013,16 +882,13 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1013
882
|
style: getItemStyle(posIndex, true)
|
|
1014
883
|
}, renderChild(allChildren[fakeIndex], posIndex, prefix));
|
|
1015
884
|
}
|
|
1016
|
-
|
|
1017
885
|
function renderAllFakeItem(prefix) {
|
|
1018
886
|
return fakeIndexes.map(function (fakeIndex) {
|
|
1019
887
|
return renderFakeItem(prefix, fakeIndex.index, fakeIndex.side);
|
|
1020
888
|
});
|
|
1021
889
|
}
|
|
1022
|
-
|
|
1023
890
|
function renderCarousel(_ref5) {
|
|
1024
891
|
var _cls;
|
|
1025
|
-
|
|
1026
892
|
var prefixCls = _ref5.prefixCls;
|
|
1027
893
|
var prefix = prefixCls + "-carousel";
|
|
1028
894
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -1076,7 +942,6 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
1076
942
|
});
|
|
1077
943
|
})) : null);
|
|
1078
944
|
}
|
|
1079
|
-
|
|
1080
945
|
return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, renderCarousel);
|
|
1081
946
|
});
|
|
1082
947
|
var _default = Carousel;
|