@arco-design/mobile-react 2.25.3 → 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 +33 -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/type.d.ts +3 -3
- 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.css +1 -0
- package/cjs/search-bar/style/css/index.js +1 -0
- package/cjs/search-bar/style/index.js +1 -0
- package/cjs/search-bar/style/index.less +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 +3766 -3629
- 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/type.d.ts +3 -3
- 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/search-bar/style/css/index.css +1 -0
- package/esm/search-bar/style/index.less +1 -0
- 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 +22 -0
- package/tokens/app/arcodesign/default/index.d.ts +22 -0
- package/tokens/app/arcodesign/default/index.js +25 -1
- package/tokens/app/arcodesign/default/index.json +262 -0
- package/tokens/app/arcodesign/default/index.less +22 -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/type.d.ts +3 -3
- 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/search-bar/style/css/index.css +1 -0
- package/umd/search-bar/style/index.less +1 -0
- 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
@@ -1,44 +1,58 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
4
5
|
exports.__esModule = true;
|
5
6
|
exports.default = void 0;
|
7
|
+
|
6
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
|
7
10
|
var _react = _interopRequireWildcard(require("react"));
|
11
|
+
|
8
12
|
var _mobileUtils = require("@arco-design/mobile-utils");
|
13
|
+
|
9
14
|
var _helpers = require("../_helpers");
|
15
|
+
|
10
16
|
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); }
|
17
|
+
|
11
18
|
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; }
|
19
|
+
|
12
20
|
var TabCellUnderline = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
13
21
|
var prefix = props.prefix,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
useCaterpillar = props.useCaterpillar,
|
23
|
+
distance = props.distance,
|
24
|
+
tabDirection = props.tabDirection,
|
25
|
+
underlineInnerStyle = props.underlineInnerStyle,
|
26
|
+
duration = props.duration,
|
27
|
+
cellTrans = props.cellTrans,
|
28
|
+
showLine = props.showLine,
|
29
|
+
activeIndex = props.activeIndex,
|
30
|
+
wrapWidth = props.wrapWidth,
|
31
|
+
wrapHeight = props.wrapHeight,
|
32
|
+
jumpingDis = props.jumpingDis,
|
33
|
+
translateZ = props.translateZ,
|
34
|
+
caterpillarMaxScale = props.caterpillarMaxScale,
|
35
|
+
caterpillarProperty = props.caterpillarProperty,
|
36
|
+
underlineSize = props.underlineSize,
|
37
|
+
underlineThick = props.underlineThick,
|
38
|
+
underlineAdaptive = props.underlineAdaptive,
|
39
|
+
renderUnderline = props.renderUnderline,
|
40
|
+
getTabRect = props.getTabRect,
|
41
|
+
getTabCenterLeft = props.getTabCenterLeft;
|
42
|
+
|
32
43
|
var _useState = (0, _react.useState)({}),
|
33
|
-
|
34
|
-
|
44
|
+
underlineStyle = _useState[0],
|
45
|
+
setUnderlineStyle = _useState[1];
|
46
|
+
|
35
47
|
var _useRefState = (0, _helpers.useRefState)(false),
|
36
|
-
|
37
|
-
|
38
|
-
|
48
|
+
caterpillar = _useRefState[0],
|
49
|
+
caterpillarRef = _useRefState[1],
|
50
|
+
setCaterpillar = _useRefState[2];
|
51
|
+
|
39
52
|
var _useState2 = (0, _react.useState)(0),
|
40
|
-
|
41
|
-
|
53
|
+
caterpillarDelay = _useState2[0],
|
54
|
+
setCaterpillarDelay = _useState2[1];
|
55
|
+
|
42
56
|
var lineRef = (0, _react.useRef)(null);
|
43
57
|
var timeRef = (0, _react.useRef)(0);
|
44
58
|
var system = (0, _helpers.useSystem)();
|
@@ -55,24 +69,30 @@ var TabCellUnderline = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
55
69
|
if (!useCaterpillar) {
|
56
70
|
return '';
|
57
71
|
}
|
72
|
+
|
58
73
|
if (caterpillarProperty === 'size') {
|
59
74
|
return "tabsCaterpillar" + (isVertical ? 'W' : 'H') + maxScaleWithDefault;
|
60
75
|
}
|
76
|
+
|
61
77
|
if (caterpillarMaxScale) {
|
62
78
|
return "tabsCaterpillar" + (isVertical ? 'X' : 'Y') + caterpillarMaxScale;
|
63
79
|
}
|
80
|
+
|
64
81
|
return '';
|
65
82
|
}, [useCaterpillar, isVertical, caterpillarMaxScale, caterpillarProperty]);
|
66
83
|
(0, _react.useEffect)(function () {
|
67
84
|
if (!animationKey) {
|
68
85
|
return;
|
69
86
|
}
|
87
|
+
|
70
88
|
var dir = isVertical ? 'X' : 'Y';
|
89
|
+
|
71
90
|
if (caterpillarProperty === 'size') {
|
72
91
|
var attr = isVertical ? 'width' : 'height';
|
73
92
|
(0, _mobileUtils.addCssKeyframes)(animationKey, "{\n 0% {\n " + attr + ": 100%;\n }\n 50% {\n " + attr + ": " + 100 * maxScaleWithDefault + "%;\n }\n 100% {\n " + attr + ": 100%;\n }\n }");
|
74
93
|
return;
|
75
94
|
}
|
95
|
+
|
76
96
|
(0, _mobileUtils.addCssKeyframes)(animationKey, "{\n 0% {\n transform: scale" + dir + "(1)" + translateZStr + ";\n -webkit-transform: scale" + dir + "(1)" + translateZStr + ";\n }\n 50% {\n transform: scale" + dir + "(" + caterpillarMaxScale + ")" + translateZStr + ";\n -webkit-transform: scale" + dir + "(" + caterpillarMaxScale + ")" + translateZStr + ";\n }\n 100% {\n transform: scale" + dir + "(1)" + translateZStr + ";\n -webkit-transform: scale" + dir + "(1)" + translateZStr + ";\n }\n }");
|
77
97
|
return function () {
|
78
98
|
(0, _mobileUtils.removeCssStyleDom)(animationKey);
|
@@ -86,40 +106,79 @@ var TabCellUnderline = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
86
106
|
}, [jumpingDis]);
|
87
107
|
(0, _react.useEffect)(function () {
|
88
108
|
resetUnderlineStyle();
|
89
|
-
}, [useCaterpillar, caterpillar, cellTrans, duration, tabDirection, wrapWidth, wrapHeight, distance, animationKey, caterpillarDelay]);
|
90
|
-
|
109
|
+
}, [useCaterpillar, caterpillar, cellTrans, duration, tabDirection, wrapWidth, wrapHeight, distance, animationKey, caterpillarDelay, underlineSize, underlineThick, underlineAdaptive]);
|
110
|
+
|
111
|
+
function getLineWidth(index) {
|
91
112
|
var _lineRef$current, _lineRef$current2;
|
113
|
+
|
114
|
+
if (underlineAdaptive) {
|
115
|
+
return getTabRect(index).width;
|
116
|
+
}
|
117
|
+
|
92
118
|
var offsetSize = isVertical ? (_lineRef$current = lineRef.current) == null ? void 0 : _lineRef$current.offsetWidth : (_lineRef$current2 = lineRef.current) == null ? void 0 : _lineRef$current2.offsetHeight;
|
93
119
|
var lineWidth = offsetSize || 0;
|
120
|
+
return lineWidth;
|
121
|
+
}
|
122
|
+
|
123
|
+
function getLineLeft(index) {
|
124
|
+
if (underlineAdaptive) {
|
125
|
+
return getTabRect(index).left;
|
126
|
+
}
|
127
|
+
|
128
|
+
var lineWidth = getLineWidth(index);
|
94
129
|
return getTabCenterLeft(index) - lineWidth / 2;
|
95
130
|
}
|
131
|
+
|
96
132
|
function getDescIndex() {
|
97
133
|
if (distance > 0) {
|
98
134
|
return activeIndex - 1;
|
99
135
|
}
|
136
|
+
|
100
137
|
if (distance < 0) {
|
101
138
|
return activeIndex + 1;
|
102
139
|
}
|
140
|
+
|
103
141
|
return activeIndex;
|
104
142
|
}
|
143
|
+
|
105
144
|
function getLineScale(ratio) {
|
106
145
|
var absRatio = Math.abs(ratio);
|
107
146
|
return absRatio > 0.5 ? (1 - absRatio) * 2 * (maxScaleWithDefault - 1) + 1 : absRatio * 2 * (maxScaleWithDefault - 1) + 1;
|
108
147
|
}
|
148
|
+
|
109
149
|
function getLineStyle() {
|
110
150
|
var _ref;
|
151
|
+
|
111
152
|
if (!lineRef.current) {
|
112
153
|
return {};
|
113
154
|
}
|
155
|
+
|
114
156
|
var currentLeft = getLineLeft(activeIndex);
|
115
157
|
var descIndex = getDescIndex();
|
116
158
|
var descLeft = getLineLeft(descIndex);
|
117
159
|
var moveRatio = wrapWidth ? distance / wrapWidth : 0;
|
118
160
|
var leftOffset = moveRatio * (currentLeft - descLeft);
|
119
161
|
var direc = isVertical ? 'X' : 'Y';
|
120
|
-
var transStyle = useCaterpillar && !jumpingDis ? caterpillarProperty === 'size' ? (_ref = {}, _ref[isVertical ? 'width' : 'height'] = 100 * getLineScale(moveRatio) + "%", _ref.willChange = 'width', _ref) : {
|
162
|
+
var transStyle = useCaterpillar && !jumpingDis && !underlineAdaptive ? caterpillarProperty === 'size' ? (_ref = {}, _ref[isVertical ? 'width' : 'height'] = 100 * getLineScale(moveRatio) + "%", _ref.willChange = 'width', _ref) : {
|
121
163
|
transform: "scale" + direc + "(" + getLineScale(moveRatio) + ")"
|
122
164
|
} : {};
|
165
|
+
var adaptiveStyle = {};
|
166
|
+
var adaptiveOuterStyle = {};
|
167
|
+
|
168
|
+
if (underlineAdaptive) {
|
169
|
+
var _adaptiveStyle;
|
170
|
+
|
171
|
+
var currentWidth = getLineWidth(activeIndex);
|
172
|
+
var descWidth = getLineWidth(descIndex);
|
173
|
+
var widthOffset = moveRatio * (currentWidth - descWidth);
|
174
|
+
adaptiveStyle = (_adaptiveStyle = {}, _adaptiveStyle[isVertical ? 'width' : 'height'] = distance > 0 ? currentWidth - widthOffset : currentWidth + widthOffset, _adaptiveStyle.willChange = 'width', _adaptiveStyle);
|
175
|
+
adaptiveOuterStyle = isVertical ? {
|
176
|
+
width: 'auto'
|
177
|
+
} : {
|
178
|
+
height: 'auto'
|
179
|
+
};
|
180
|
+
}
|
181
|
+
|
123
182
|
var outerSize = isVertical ? {
|
124
183
|
width: underlineSize,
|
125
184
|
height: underlineThick
|
@@ -130,21 +189,28 @@ var TabCellUnderline = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
130
189
|
return {
|
131
190
|
outer: (0, _extends2.default)({
|
132
191
|
transform: "translate" + direc + "(" + (distance > 0 ? currentLeft - leftOffset : currentLeft + leftOffset) + "px)" + translateZStr
|
133
|
-
}, outerSize),
|
134
|
-
inner: (0, _extends2.default)({}, transStyle)
|
192
|
+
}, outerSize, adaptiveOuterStyle),
|
193
|
+
inner: (0, _extends2.default)({}, transStyle, adaptiveStyle)
|
135
194
|
};
|
136
195
|
}
|
196
|
+
|
137
197
|
function getUnderlineStyle() {
|
138
198
|
var transStyle = {};
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
199
|
+
|
200
|
+
if (!underlineAdaptive) {
|
201
|
+
if (useCaterpillar) {
|
202
|
+
transStyle.animationDuration = duration + "ms";
|
203
|
+
}
|
204
|
+
|
205
|
+
if (caterpillarRef.current && animationKey) {
|
206
|
+
transStyle.animationName = animationKey;
|
207
|
+
}
|
208
|
+
|
209
|
+
if (caterpillarDelay) {
|
210
|
+
transStyle.animationDelay = "-" + caterpillarDelay + "ms";
|
211
|
+
}
|
147
212
|
}
|
213
|
+
|
148
214
|
var lineStyle = getLineStyle();
|
149
215
|
return {
|
150
216
|
outer: (0, _helpers.getStyleWithVendor)((0, _extends2.default)({
|
@@ -153,29 +219,36 @@ var TabCellUnderline = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
153
219
|
inner: (0, _helpers.getStyleWithVendor)((0, _extends2.default)({}, transStyle, lineStyle.inner || {}))
|
154
220
|
};
|
155
221
|
}
|
222
|
+
|
156
223
|
function resetUnderlineStyle() {
|
157
224
|
setUnderlineStyle(getUnderlineStyle());
|
158
225
|
}
|
226
|
+
|
159
227
|
function setCaterpillarAnimate(movedRatio) {
|
160
228
|
if (movedRatio === void 0) {
|
161
229
|
movedRatio = 0;
|
162
230
|
}
|
231
|
+
|
163
232
|
if (!duration) {
|
164
233
|
return;
|
165
234
|
}
|
235
|
+
|
166
236
|
var movedTime = (duration || 0) * Math.abs(movedRatio);
|
167
237
|
setCaterpillarDelay(movedTime);
|
168
238
|
(0, _mobileUtils.nextTick)(function () {
|
169
239
|
setCaterpillar(true);
|
170
240
|
});
|
241
|
+
|
171
242
|
if (timeRef.current) {
|
172
243
|
clearTimeout(timeRef.current);
|
173
244
|
}
|
245
|
+
|
174
246
|
timeRef.current = window.setTimeout(function () {
|
175
247
|
setCaterpillar(false);
|
176
248
|
setCaterpillarDelay(0);
|
177
249
|
}, (duration || 0) - movedTime + 20);
|
178
250
|
}
|
251
|
+
|
179
252
|
return renderUnderline ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderUnderline(underlineStyle, showLine, lineRef)) : /*#__PURE__*/_react.default.createElement("div", {
|
180
253
|
className: (0, _mobileUtils.cls)(prefix + "-underline", {
|
181
254
|
show: showLine
|
package/cjs/tabs/tab-cell.js
CHANGED
@@ -1,83 +1,98 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
4
5
|
exports.__esModule = true;
|
5
6
|
exports.default = void 0;
|
7
|
+
|
6
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
|
7
10
|
var _react = _interopRequireWildcard(require("react"));
|
11
|
+
|
8
12
|
var _mobileUtils = require("@arco-design/mobile-utils");
|
13
|
+
|
9
14
|
var _helpers = require("../_helpers");
|
15
|
+
|
10
16
|
var _tabCellUnderline = _interopRequireDefault(require("./tab-cell-underline"));
|
17
|
+
|
11
18
|
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
|
+
|
12
20
|
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
|
+
|
13
22
|
var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
14
23
|
var tabs = props.tabs,
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
24
|
+
prefixCls = props.prefixCls,
|
25
|
+
activeIndex = props.activeIndex,
|
26
|
+
activeIndexRef = props.activeIndexRef,
|
27
|
+
tabDirection = props.tabDirection,
|
28
|
+
type = props.type,
|
29
|
+
onTabClick = props.onTabClick,
|
30
|
+
changeIndex = props.changeIndex,
|
31
|
+
tabBarPosition = props.tabBarPosition,
|
32
|
+
tabBarArrange = props.tabBarArrange,
|
33
|
+
tabBarScroll = props.tabBarScroll,
|
34
|
+
tabBarFixed = props.tabBarFixed,
|
35
|
+
renderUnderline = props.renderUnderline,
|
36
|
+
duration = props.duration,
|
37
|
+
transitionDuration = props.transitionDuration,
|
38
|
+
useCaterpillar = props.useCaterpillar,
|
39
|
+
wrapWidth = props.wrapWidth,
|
40
|
+
wrapHeight = props.wrapHeight,
|
41
|
+
cellTrans = props.cellTrans,
|
42
|
+
distance = props.distance,
|
43
|
+
jumpingDis = props.jumpingDis,
|
44
|
+
tabBarExtra = props.tabBarExtra,
|
45
|
+
onTabBarOverflowChange = props.onTabBarOverflowChange,
|
46
|
+
tabBarGutter = props.tabBarGutter,
|
47
|
+
tabBarPadding = props.tabBarPadding,
|
48
|
+
underlineSize = props.underlineSize,
|
49
|
+
underlineThick = props.underlineThick,
|
50
|
+
underlineInnerStyle = props.underlineInnerStyle,
|
51
|
+
caterpillarMaxScale = props.caterpillarMaxScale,
|
52
|
+
caterpillarProperty = props.caterpillarProperty,
|
53
|
+
onTabBarScroll = props.onTabBarScroll,
|
54
|
+
hideTabBarBeforeMounted = props.hideTabBarBeforeMounted,
|
55
|
+
_props$overflowThresh = props.overflowThreshold,
|
56
|
+
overflowThreshold = _props$overflowThresh === void 0 ? 5 : _props$overflowThresh,
|
57
|
+
tabBarScrollBezier = props.tabBarScrollBezier,
|
58
|
+
tabBarScrollDuration = props.tabBarScrollDuration,
|
59
|
+
tabBarScrollChance = props.tabBarScrollChance,
|
60
|
+
tabBarHasDivider = props.tabBarHasDivider,
|
61
|
+
showUnderline = props.showUnderline,
|
62
|
+
underlineAdaptive = props.underlineAdaptive,
|
63
|
+
disabled = props.disabled,
|
64
|
+
renderTabBarItem = props.renderTabBarItem,
|
65
|
+
renderTabBarInner = props.renderTabBarInner,
|
66
|
+
tabBarStyle = props.tabBarStyle,
|
67
|
+
tabBarClass = props.tabBarClass,
|
68
|
+
translateZ = props.translateZ,
|
69
|
+
tabBarStopPropagation = props.tabBarStopPropagation;
|
60
70
|
var prefix = prefixCls + "-tab-cell";
|
61
71
|
var domRef = (0, _react.useRef)(null);
|
62
72
|
var underlineRef = (0, _react.useRef)(null);
|
63
73
|
var allCellRectRef = (0, _react.useRef)([]);
|
74
|
+
|
64
75
|
var _useState = (0, _react.useState)(false),
|
65
|
-
|
66
|
-
|
76
|
+
showLine = _useState[0],
|
77
|
+
setShowLine = _useState[1];
|
78
|
+
|
67
79
|
var _useState2 = (0, _react.useState)(false),
|
68
|
-
|
69
|
-
|
80
|
+
hasOverflow = _useState2[0],
|
81
|
+
setHasOverflow = _useState2[1];
|
82
|
+
|
70
83
|
var _useState3 = (0, _react.useState)(function () {
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
84
|
+
return tabs.length < overflowThreshold ? tabBarArrange : 'start';
|
85
|
+
}),
|
86
|
+
originArrange = _useState3[0],
|
87
|
+
setOriginArrange = _useState3[1]; // 默认tab小于overflowThreshold个时不开启加载前隐藏,大于overflowThreshold个时开启
|
88
|
+
|
89
|
+
|
76
90
|
var _useState4 = (0, _react.useState)(function () {
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
91
|
+
return hideTabBarBeforeMounted === void 0 ? tabs.length < overflowThreshold || activeIndex === 0 : !hideTabBarBeforeMounted;
|
92
|
+
}),
|
93
|
+
showTab = _useState4[0],
|
94
|
+
setShowTab = _useState4[1];
|
95
|
+
|
81
96
|
var isVertical = tabDirection === 'vertical';
|
82
97
|
var isLine = (type || '').indexOf('line') !== -1;
|
83
98
|
var isCard = type === 'card';
|
@@ -85,6 +100,7 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
85
100
|
* 非card类型才有间隙和两侧留白
|
86
101
|
* @en Non-card types have gaps and blank on both sides
|
87
102
|
*/
|
103
|
+
|
88
104
|
var cellPadding = isCard ? void 0 : tabBarPadding;
|
89
105
|
var cellGutter = isCard ? void 0 : tabBarGutter;
|
90
106
|
var hasDivider = tabBarHasDivider === void 0 ? isLine : tabBarHasDivider;
|
@@ -92,12 +108,12 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
92
108
|
var system = (0, _helpers.useSystem)();
|
93
109
|
(0, _react.useEffect)(function () {
|
94
110
|
(0, _mobileUtils.nextTick)(function () {
|
95
|
-
setCellOverflow();
|
96
|
-
// dom出来之后originArrange置空,交由tabBarArrange控制
|
111
|
+
setCellOverflow(); // dom出来之后originArrange置空,交由tabBarArrange控制
|
97
112
|
// @en After the dom comes out, originArrange is left empty and controlled by tabBarArrange
|
98
|
-
|
99
|
-
// dom出来了才知道布局,计算完成后展示出来防止跳动的情况
|
113
|
+
|
114
|
+
setOriginArrange(void 0); // dom出来了才知道布局,计算完成后展示出来防止跳动的情况
|
100
115
|
// @en The layout is determined only when the dom comes out. It is displayed to prevent the jumping after the calculation is completed
|
116
|
+
|
101
117
|
setShowTab(true);
|
102
118
|
setShowLine(true);
|
103
119
|
});
|
@@ -105,6 +121,7 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
105
121
|
(0, _react.useEffect)(function () {
|
106
122
|
(0, _mobileUtils.nextTick)(function () {
|
107
123
|
var _underlineRef$current;
|
124
|
+
|
108
125
|
(_underlineRef$current = underlineRef.current) == null ? void 0 : _underlineRef$current.resetUnderlineStyle();
|
109
126
|
});
|
110
127
|
}, [activeIndex, tabs, getCellPadding('left'), getCellPadding('right'), tabBarGutter, tabDirection]);
|
@@ -116,10 +133,12 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
116
133
|
hasOverflow: hasOverflow,
|
117
134
|
setCaterpillarAnimate: function setCaterpillarAnimate(ratio) {
|
118
135
|
var _underlineRef$current2;
|
136
|
+
|
119
137
|
return (_underlineRef$current2 = underlineRef.current) == null ? void 0 : _underlineRef$current2.setCaterpillarAnimate(ratio);
|
120
138
|
},
|
121
139
|
resetUnderlineStyle: function resetUnderlineStyle() {
|
122
140
|
var _underlineRef$current3;
|
141
|
+
|
123
142
|
return (_underlineRef$current3 = underlineRef.current) == null ? void 0 : _underlineRef$current3.resetUnderlineStyle();
|
124
143
|
}
|
125
144
|
};
|
@@ -132,16 +151,18 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
132
151
|
}
|
133
152
|
}, [activeIndex, wrapSize]);
|
134
153
|
(0, _react.useEffect)(function () {
|
135
|
-
tabBarScrollChance !== 'none' && scrollToCenter(true);
|
136
|
-
// TabCell左右可滚动时,防止触发父级touchmove事件导致滚不动
|
154
|
+
tabBarScrollChance !== 'none' && scrollToCenter(true); // TabCell左右可滚动时,防止触发父级touchmove事件导致滚不动
|
137
155
|
// @en When the TabCell can be scrolled left and right, prevent the parent touchmove event from being triggered which result in inability to scroll
|
156
|
+
|
138
157
|
var stopFunc = function stopFunc(e) {
|
139
158
|
return e.stopPropagation();
|
140
159
|
};
|
160
|
+
|
141
161
|
if (isVertical && hasOverflow && domRef.current && tabBarStopPropagation) {
|
142
162
|
domRef.current.addEventListener('touchstart', stopFunc);
|
143
163
|
domRef.current.addEventListener('touchmove', stopFunc);
|
144
164
|
}
|
165
|
+
|
145
166
|
return function () {
|
146
167
|
if (isVertical && hasOverflow && domRef.current && tabBarStopPropagation) {
|
147
168
|
domRef.current.removeEventListener('touchstart', stopFunc);
|
@@ -149,35 +170,43 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
149
170
|
}
|
150
171
|
};
|
151
172
|
}, [hasOverflow]);
|
173
|
+
|
152
174
|
function setCellOverflow() {
|
153
175
|
var overflow = false;
|
176
|
+
|
154
177
|
if (domRef.current) {
|
155
178
|
overflow = isVertical ? domRef.current.scrollWidth > domRef.current.offsetWidth : domRef.current.scrollHeight > domRef.current.offsetHeight;
|
156
179
|
}
|
180
|
+
|
157
181
|
if (overflow !== hasOverflow) {
|
158
182
|
onTabBarOverflowChange && onTabBarOverflowChange(overflow);
|
159
183
|
}
|
184
|
+
|
160
185
|
setHasOverflow(overflow);
|
161
186
|
}
|
187
|
+
|
162
188
|
function scrollToCenter(rightNow) {
|
163
189
|
if (!wrapSize || !hasOverflow) {
|
164
190
|
return;
|
165
191
|
}
|
192
|
+
|
166
193
|
var currentTabLeft = getTabCenterLeft(activeIndexRef.current);
|
167
194
|
var newLeft = currentTabLeft - wrapSize / 2;
|
168
195
|
scrollTo(newLeft, rightNow);
|
169
196
|
}
|
197
|
+
|
170
198
|
function scrollTo(position, rightNow) {
|
171
199
|
if (!domRef.current) {
|
172
200
|
return;
|
173
201
|
}
|
174
|
-
|
175
|
-
// 部分安卓机在动画和raf同时执行时会卡顿
|
202
|
+
|
203
|
+
var needRafScroll = false; // 部分安卓机在动画和raf同时执行时会卡顿
|
176
204
|
// @en Some Android machines will freeze when animation and raf are executed at the same time
|
177
205
|
// 如果是安卓机,且对滚动的时长和变化曲线无要求时,优先用原生顺滑滚动
|
178
206
|
// @en If it is an Android device, and there is no requirement for the scrolling duration and change curve, the native smooth scrolling is preferred
|
179
207
|
// 当浏览器不支持原生顺滑滚动,或对上述滚动参数有要求时,用raf滚动兜底
|
180
208
|
// @en When the browser does not support native smooth scrolling, or there are requirements for the above scrolling parameters, use raf to scroll the bottom line
|
209
|
+
|
181
210
|
if (system === 'android' && tabBarScrollBezier === void 0 && tabBarScrollDuration === void 0) {
|
182
211
|
try {
|
183
212
|
var disObj = isVertical ? {
|
@@ -194,6 +223,7 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
194
223
|
} else {
|
195
224
|
needRafScroll = true;
|
196
225
|
}
|
226
|
+
|
197
227
|
if (needRafScroll) {
|
198
228
|
(0, _mobileUtils.scrollWithAnimation)(isVertical ? domRef.current.scrollLeft : domRef.current.scrollTop, position, function (top) {
|
199
229
|
if (domRef.current) {
|
@@ -206,44 +236,63 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
206
236
|
}, rightNow ? 0 : tabBarScrollDuration, tabBarScrollBezier);
|
207
237
|
}
|
208
238
|
}
|
209
|
-
|
239
|
+
|
240
|
+
function getTabRect(index) {
|
210
241
|
var currentTab = allCellRectRef.current[index] || {};
|
211
|
-
|
212
|
-
|
242
|
+
return {
|
243
|
+
left: (isVertical ? currentTab.left : currentTab.top) || 0,
|
244
|
+
width: (isVertical ? currentTab.width : currentTab.height) || 0
|
245
|
+
};
|
246
|
+
}
|
247
|
+
|
248
|
+
function getTabCenterLeft(index) {
|
249
|
+
var _getTabRect = getTabRect(index),
|
250
|
+
currentTabLeft = _getTabRect.left,
|
251
|
+
currentTabWidth = _getTabRect.width;
|
252
|
+
|
213
253
|
return currentTabLeft + currentTabWidth / 2;
|
214
254
|
}
|
255
|
+
|
215
256
|
function getCellPadding(pType) {
|
216
257
|
if (typeof cellPadding === 'object') {
|
217
258
|
return cellPadding[pType];
|
218
259
|
}
|
260
|
+
|
219
261
|
return cellPadding;
|
220
262
|
}
|
263
|
+
|
221
264
|
function getCellStyle(index) {
|
222
265
|
if (!isVertical) {
|
223
266
|
return {};
|
224
267
|
}
|
268
|
+
|
225
269
|
if (index === 0) {
|
226
270
|
return {
|
227
271
|
marginRight: cellGutter,
|
228
272
|
marginLeft: getCellPadding('left')
|
229
273
|
};
|
230
274
|
}
|
275
|
+
|
231
276
|
return {
|
232
277
|
marginRight: index === tabs.length - 1 ? void 0 : cellGutter
|
233
278
|
};
|
234
279
|
}
|
280
|
+
|
235
281
|
function renderBarItem(tab, index) {
|
236
282
|
if (renderTabBarItem) {
|
237
283
|
return renderTabBarItem(tab, index, {
|
238
284
|
active: index === activeIndex
|
239
285
|
});
|
240
286
|
}
|
287
|
+
|
241
288
|
return typeof tab === 'string' ? tab : tab.title;
|
242
289
|
}
|
290
|
+
|
243
291
|
function renderTabUnderline() {
|
244
292
|
if (!showUnderline || !isLine) {
|
245
293
|
return null;
|
246
294
|
}
|
295
|
+
|
247
296
|
var lineProps = {
|
248
297
|
prefix: prefix,
|
249
298
|
showLine: showLine,
|
@@ -262,13 +311,16 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
262
311
|
translateZ: translateZ,
|
263
312
|
underlineSize: underlineSize,
|
264
313
|
underlineThick: underlineThick,
|
314
|
+
underlineAdaptive: underlineAdaptive,
|
265
315
|
renderUnderline: renderUnderline
|
266
316
|
};
|
267
317
|
return /*#__PURE__*/_react.default.createElement(_tabCellUnderline.default, (0, _extends2.default)({
|
268
318
|
ref: underlineRef,
|
269
|
-
getTabCenterLeft: getTabCenterLeft
|
319
|
+
getTabCenterLeft: getTabCenterLeft,
|
320
|
+
getTabRect: getTabRect
|
270
321
|
}, lineProps));
|
271
322
|
}
|
323
|
+
|
272
324
|
var cellInner = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tabs.map(function (tab, index) {
|
273
325
|
return /*#__PURE__*/_react.default.createElement("div", {
|
274
326
|
key: index,
|
@@ -286,6 +338,7 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
286
338
|
if (disabled) {
|
287
339
|
return;
|
288
340
|
}
|
341
|
+
|
289
342
|
changeIndex(index, 'click');
|
290
343
|
onTabClick && onTabClick(tab, index, e);
|
291
344
|
},
|
@@ -308,6 +361,7 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
308
361
|
height: '100%'
|
309
362
|
}
|
310
363
|
}) : null);
|
364
|
+
|
311
365
|
return /*#__PURE__*/_react.default.createElement("div", {
|
312
366
|
className: (0, _mobileUtils.cls)(prefix + "-container-wrap", tabDirection, "type-" + type, tabBarClass, system),
|
313
367
|
style: tabBarStyle
|