@nutui/nutui-react-taro 1.5.2-beta.0 → 1.5.2-beta.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/dist/esm/ActionSheet/style/index.js +2 -0
- package/dist/esm/ActionSheet.js +16 -0
- package/dist/esm/Address/style/index.js +4 -0
- package/dist/esm/Address.js +23 -0
- package/dist/esm/Animate/style/index.js +2 -0
- package/dist/esm/Animate.js +9 -0
- package/dist/esm/AnimatingNumbers/style/index.js +3 -0
- package/dist/esm/AnimatingNumbers.js +9 -0
- package/dist/esm/Audio/style/index.js +4 -0
- package/dist/esm/Audio.js +21 -0
- package/dist/esm/Avatar/style/index.js +2 -0
- package/dist/esm/Avatar.js +13 -0
- package/dist/esm/AvatarContext-c96afdcc.js +5 -0
- package/dist/esm/AvatarGroup/style/index.js +2 -0
- package/dist/esm/AvatarGroup.js +13 -0
- package/dist/esm/BackTop/style/index.js +2 -0
- package/dist/esm/BackTop.js +11 -0
- package/dist/esm/Badge/style/index.js +2 -0
- package/dist/esm/Badge.js +11 -0
- package/dist/esm/Barrage/style/index.js +2 -0
- package/dist/esm/Barrage.js +10 -0
- package/dist/esm/Button/style/index.js +2 -0
- package/dist/esm/Button.js +10 -0
- package/dist/esm/Calendar/style/index.js +2 -0
- package/dist/esm/Calendar.js +21 -0
- package/dist/esm/CalendarItem/style/index.js +2 -0
- package/dist/esm/CalendarItem.js +14 -0
- package/dist/esm/Card/style/index.js +4 -0
- package/dist/esm/Card.js +13 -0
- package/dist/esm/Cascader/style/index.js +3 -0
- package/dist/esm/Cascader.js +18 -0
- package/dist/esm/Cell/style/index.js +2 -0
- package/dist/esm/Cell.js +11 -0
- package/dist/esm/CellGroup/style/index.js +2 -0
- package/dist/esm/CellGroup.js +8 -0
- package/dist/esm/Checkbox/style/index.js +3 -0
- package/dist/esm/Checkbox.js +10 -0
- package/dist/esm/CheckboxGroup/style/index.js +2 -0
- package/dist/esm/CheckboxGroup.js +10 -0
- package/dist/esm/CircleProgress/style/index.js +2 -0
- package/dist/esm/CircleProgress.js +10 -0
- package/dist/esm/Col/style/index.js +2 -0
- package/dist/esm/Col.js +8 -0
- package/dist/esm/Collapse/style/index.js +2 -0
- package/dist/esm/Collapse.js +9 -0
- package/dist/esm/CollapseItem/style/index.js +2 -0
- package/dist/esm/CollapseItem.js +10 -0
- package/dist/esm/ConfigProvider/style/index.js +2 -0
- package/dist/esm/ConfigProvider.js +8 -0
- package/dist/esm/CountDown/style/index.js +2 -0
- package/dist/esm/CountDown.js +11 -0
- package/dist/esm/DatePicker/style/index.js +2 -0
- package/dist/esm/DatePicker.js +26 -0
- package/dist/esm/Dialog/style/index.js +3 -0
- package/dist/esm/Dialog.js +17 -0
- package/dist/esm/Divider/style/index.js +2 -0
- package/dist/esm/Divider.js +9 -0
- package/dist/esm/Drag/style/index.js +2 -0
- package/dist/esm/Drag.js +9 -0
- package/dist/esm/Elevator/style/index.js +2 -0
- package/dist/esm/Elevator.js +10 -0
- package/dist/esm/Ellipsis/style/index.js +2 -0
- package/dist/esm/Ellipsis.js +11 -0
- package/dist/esm/Empty/style/index.js +2 -0
- package/dist/esm/Empty.js +11 -0
- package/dist/esm/FixedNav/style/index.js +3 -0
- package/dist/esm/FixedNav.js +16 -0
- package/dist/esm/Form/style/index.js +2 -0
- package/dist/esm/Form.js +14 -0
- package/dist/esm/FormItem/style/index.js +2 -0
- package/dist/esm/FormItem.js +12 -0
- package/dist/esm/Grid/style/index.js +2 -0
- package/dist/esm/Grid.js +13 -0
- package/dist/esm/GridItem/style/index.js +2 -0
- package/dist/esm/GridItem.js +15 -0
- package/dist/esm/Icon/style/index.js +4 -0
- package/dist/esm/Icon.js +8 -0
- package/dist/esm/Image/style/index.js +2 -0
- package/dist/esm/Image.js +12 -0
- package/dist/esm/ImagePreview/style/index.js +4 -0
- package/dist/esm/ImagePreview.js +20 -0
- package/dist/esm/Indicator/style/index.js +2 -0
- package/dist/esm/Indicator.js +9 -0
- package/dist/esm/Infiniteloading/style/index.js +2 -0
- package/dist/esm/Infiniteloading.js +16 -0
- package/dist/esm/Input/style/index.js +2 -0
- package/dist/esm/Input.js +13 -0
- package/dist/esm/InputNumber/style/index.js +2 -0
- package/dist/esm/InputNumber.js +11 -0
- package/dist/esm/Layout/style/index.js +2 -0
- package/dist/esm/Layout.js +6 -0
- package/dist/esm/Menu/style/index.js +3 -0
- package/dist/esm/Menu.js +11 -0
- package/dist/esm/MenuItem/style/index.js +3 -0
- package/dist/esm/MenuItem.js +17 -0
- package/dist/esm/NavBar/style/index.js +2 -0
- package/dist/esm/NavBar.js +11 -0
- package/dist/esm/NoticeBar/style/index.js +2 -0
- package/dist/esm/NoticeBar.js +12 -0
- package/dist/esm/Notify/style/index.js +2 -0
- package/dist/esm/Notify.js +10 -0
- package/dist/esm/NumberKeyboard/style/index.js +2 -0
- package/dist/esm/NumberKeyboard.js +19 -0
- package/dist/esm/Overlay/style/index.js +2 -0
- package/dist/esm/Overlay.js +10 -0
- package/dist/esm/Pagination/style/index.js +2 -0
- package/dist/esm/Pagination.js +11 -0
- package/dist/esm/Picker/style/index.js +2 -0
- package/dist/esm/Picker.js +24 -0
- package/dist/esm/Popover/style/index.js +3 -0
- package/dist/esm/Popover.js +14 -0
- package/dist/esm/Popup/style/index.js +3 -0
- package/dist/esm/Popup.js +15 -0
- package/dist/esm/Price/style/index.js +2 -0
- package/dist/esm/Price.js +8 -0
- package/dist/esm/Progress/style/index.js +2 -0
- package/dist/esm/Progress.js +11 -0
- package/dist/esm/PullToRefresh/style/index.js +2 -0
- package/dist/esm/PullToRefresh.js +14 -0
- package/dist/esm/Radio/style/index.js +3 -0
- package/dist/esm/Radio.js +10 -0
- package/dist/esm/RadioGroup/style/index.js +2 -0
- package/dist/esm/RadioGroup.js +10 -0
- package/dist/esm/Range/style/index.js +2 -0
- package/dist/esm/Range.js +16 -0
- package/dist/esm/Rate/style/index.js +2 -0
- package/dist/esm/Rate.js +11 -0
- package/dist/esm/Row/style/index.js +2 -0
- package/dist/esm/Row.js +8 -0
- package/dist/esm/SearchBar/style/index.js +2 -0
- package/dist/esm/SearchBar.js +14 -0
- package/dist/esm/ShortPassword/style/index.js +3 -0
- package/dist/esm/ShortPassword.js +19 -0
- package/dist/esm/SideNavBar/style/index.js +2 -0
- package/dist/esm/SideNavBar.js +20 -0
- package/dist/esm/SideNavBarItem/style/index.js +2 -0
- package/dist/esm/SideNavBarItem.js +6 -0
- package/dist/esm/Signature/style/index.js +2 -0
- package/dist/esm/Signature.js +15 -0
- package/dist/esm/Skeleton/style/index.js +2 -0
- package/dist/esm/Skeleton.js +14 -0
- package/dist/esm/Step/style/index.js +2 -0
- package/dist/esm/Step.js +12 -0
- package/dist/esm/Steps/style/index.js +2 -0
- package/dist/esm/Steps.js +10 -0
- package/dist/esm/Sticky/style/index.js +2 -0
- package/dist/esm/Sticky.js +13 -0
- package/dist/esm/SubSideNavBar/style/index.js +2 -0
- package/dist/esm/SubSideNavBar.js +7 -0
- package/dist/esm/Swipe/style/index.js +2 -0
- package/dist/esm/Swipe.js +12 -0
- package/dist/esm/Swiper/style/index.js +2 -0
- package/dist/esm/Swiper.js +11 -0
- package/dist/esm/SwiperItem/style/index.js +2 -0
- package/dist/esm/SwiperItem.js +10 -0
- package/dist/esm/Switch/style/index.js +2 -0
- package/dist/esm/Switch.js +8 -0
- package/dist/esm/TabPane/style/index.js +2 -0
- package/dist/esm/TabPane.js +9 -0
- package/dist/esm/Tabbar/style/index.js +2 -0
- package/dist/esm/Tabbar.js +8 -0
- package/dist/esm/TabbarItem/style/index.js +2 -0
- package/dist/esm/TabbarItem.js +11 -0
- package/dist/esm/Table/style/index.js +2 -0
- package/dist/esm/Table.js +14 -0
- package/dist/esm/Tabs/style/index.js +4 -0
- package/dist/esm/Tabs.js +12 -0
- package/dist/esm/Tag/style/index.js +2 -0
- package/dist/esm/Tag.js +11 -0
- package/dist/esm/TextArea/style/index.js +2 -0
- package/dist/esm/TextArea.js +11 -0
- package/dist/esm/TimeDetail/style/index.js +2 -0
- package/dist/esm/TimeDetail.js +11 -0
- package/dist/esm/TimePannel/style/index.js +2 -0
- package/dist/esm/TimePannel.js +11 -0
- package/dist/esm/TimeSelect/style/index.js +4 -0
- package/dist/esm/TimeSelect.js +21 -0
- package/dist/esm/Toast/style/index.js +2 -0
- package/dist/esm/Toast.js +10 -0
- package/dist/esm/TrendArrow/style/index.js +2 -0
- package/dist/esm/TrendArrow.js +9 -0
- package/dist/esm/Uploader/style/index.js +4 -0
- package/dist/esm/Uploader.js +19 -0
- package/dist/esm/UserContext-0aac9a82.js +5 -0
- package/dist/esm/UserContext-e402e1a6.js +5 -0
- package/dist/esm/UserContext-e8176108.js +5 -0
- package/dist/esm/Video/style/index.js +2 -0
- package/dist/esm/Video.js +9 -0
- package/dist/esm/VirtualList/style/index.js +2 -0
- package/dist/esm/VirtualList.js +11 -0
- package/dist/esm/WaterMark/style/index.js +2 -0
- package/dist/esm/WaterMark.js +13 -0
- package/dist/esm/actionsheet.taro-e6a51446.js +53 -0
- package/dist/esm/address.taro-3a9b6396.js +461 -0
- package/dist/esm/animate.taro-fb7986d6.js +40 -0
- package/dist/esm/animatingnumbers.taro-03e5d61d.js +104 -0
- package/dist/esm/audio.taro-87ec8bf2.js +161 -0
- package/dist/esm/avatar.taro-3676f38f.js +103 -0
- package/dist/esm/avatargroup-f3574510.js +34 -0
- package/dist/esm/backtop.taro-66394a36.js +48 -0
- package/dist/esm/badge.taro-a4e59c11.js +52 -0
- package/dist/esm/barrage.taro-0495a1b2.js +94 -0
- package/dist/esm/bem-350c1702.js +5 -0
- package/dist/esm/button.taro-9244d065.js +100 -0
- package/dist/esm/calendar.taro-670842ea.js +65 -0
- package/dist/esm/calendaritem.taro-2a603571.js +787 -0
- package/dist/esm/can-use-dom-3eeb5af4.js +6 -0
- package/dist/esm/card.taro-e4c76dad.js +33 -0
- package/dist/esm/cascader.taro-eb1fb011.js +438 -0
- package/dist/esm/cell.taro-a10a74d3.js +64 -0
- package/dist/esm/cellgroup.taro-abe501bc.js +25 -0
- package/dist/esm/checkbox.taro-6120e3e3.js +171 -0
- package/dist/esm/circleprogress.taro-79854448.js +109 -0
- package/dist/esm/col.taro-53eed3cc.js +41 -0
- package/dist/esm/collapse.taro-1a9e4ba2.js +83 -0
- package/dist/esm/collapseitem-4d0bc55d.js +83 -0
- package/dist/esm/configprovider-67d19d3a.js +19 -0
- package/dist/esm/configprovider.taro-8d71eb49.js +42 -0
- package/dist/esm/countdown.taro-5b17c607.js +226 -0
- package/dist/esm/datepicker.taro-6e9b4b8f.js +275 -0
- package/dist/esm/dialog.taro-a3267d29.js +118 -0
- package/dist/esm/divider.taro-26d1d8b4.js +35 -0
- package/dist/esm/drag.taro-79bb8744.js +110 -0
- package/dist/esm/elevator.taro-6019669e.js +178 -0
- package/dist/esm/ellipsis.taro-f15f26da.js +241 -0
- package/dist/esm/empty.taro-04ae4389.js +62 -0
- package/dist/esm/fixednav.taro-1f05acaf.js +53 -0
- package/dist/esm/form.taro-0c8e7a39.js +179 -0
- package/dist/esm/formitem.taro-190a3326.js +89 -0
- package/dist/esm/get-scroll-parent-b4a07e65.js +25 -0
- package/dist/esm/grid.taro-3503b82c.js +61 -0
- package/dist/esm/grid.taro.context-c2bbfb4f.js +8 -0
- package/dist/esm/griditem.taro-cdb3f119.js +98 -0
- package/dist/esm/icon-296a1bec.js +63 -0
- package/dist/esm/icon.taro-296a1bec.js +63 -0
- package/dist/esm/image.taro-142cf512.js +64 -0
- package/dist/esm/imagepreview.taro-c50bb0a3.js +167 -0
- package/dist/esm/index-5bcb0ff8.js +7 -0
- package/dist/esm/indicator.taro-cba8b010.js +37 -0
- package/dist/esm/infiniteloading.taro-183bccbf.js +144 -0
- package/dist/esm/input.taro-97af6c96.js +240 -0
- package/dist/esm/inputnumber.taro-91f65d17.js +130 -0
- package/dist/esm/layout.taro-9046d093.js +11 -0
- package/dist/esm/menu.taro-7e4038a1.js +99 -0
- package/dist/esm/menuitem.taro-96cc4f15.js +130 -0
- package/dist/esm/navbar.taro-777c4705.js +79 -0
- package/dist/esm/noticebar.taro-4a23cdee.js +448 -0
- package/dist/esm/notify.taro-e17c6f82.js +75 -0
- package/dist/esm/numberkeyboard.taro-1bc24744.js +159 -0
- package/dist/esm/nutui-react.es.js +119 -0
- package/dist/esm/offsetContext-c2a746fa.js +5 -0
- package/dist/esm/overlay.taro-21e87fb1.js +69 -0
- package/dist/esm/pagination.taro-715a173b.js +124 -0
- package/dist/esm/picker.taro-9ad1b7c5.js +473 -0
- package/dist/esm/popover.taro-ad5e76ea.js +156 -0
- package/dist/esm/popup.taro-01676bff.js +137 -0
- package/dist/esm/price.taro-776ed16e.js +83 -0
- package/dist/esm/progress.taro-f0ce38e9.js +90 -0
- package/dist/esm/pulltorefresh.taro-a294f656.js +181 -0
- package/dist/esm/radio.taro-a6eff96c.js +168 -0
- package/dist/esm/range.taro-d8fc7656.js +332 -0
- package/dist/esm/rate.taro-6cdf03bd.js +75 -0
- package/dist/esm/row.taro-f64d4a13.js +46 -0
- package/dist/esm/searchbar.taro-0c25927b.js +152 -0
- package/dist/esm/shortpassword.taro-9ee034f7.js +111 -0
- package/dist/esm/sidenavbar.taro-c307b35e.js +35 -0
- package/dist/esm/sidenavbaritem.taro-5a7965d0.js +12 -0
- package/dist/esm/signature.taro-ec4e713b.js +143 -0
- package/dist/esm/skeleton.taro-76faf63f.js +62 -0
- package/dist/esm/step.taro-b7903e8c.js +59 -0
- package/dist/esm/steps.taro-c82d2252.js +30 -0
- package/dist/esm/sticky.taro-218bda37.js +138 -0
- package/dist/esm/subsidenavbar.taro-69cb9752.js +63 -0
- package/dist/esm/supports-passive-c85ef996.js +18 -0
- package/dist/esm/swipe.taro-ea35f07f.js +177 -0
- package/dist/esm/swiper.taro-7a94e211.js +451 -0
- package/dist/esm/swiperitem-c9e3d0d5.js +29 -0
- package/dist/esm/switch.taro-34ca8228.js +50 -0
- package/dist/esm/tabbar.taro-9acfc2fa.js +59 -0
- package/dist/esm/tabbaritem.taro-bf517487.js +58 -0
- package/dist/esm/table.taro-91fc0c01.js +93 -0
- package/dist/esm/tabpane.taro-4ca340ef.js +23 -0
- package/dist/esm/tabs.taro-6a7524a4.js +140 -0
- package/dist/esm/tag.taro-23ba0834.js +92 -0
- package/dist/esm/textarea.taro-442e7350.js +94 -0
- package/dist/esm/timedetail.taro-5b2f2269.js +44 -0
- package/dist/esm/timepannel.taro-d6e40180.js +22 -0
- package/dist/esm/timeselect.taro-a07036f4.js +133 -0
- package/dist/esm/toast.taro-d6c14811.js +109 -0
- package/dist/esm/trendarrow.taro-b8c5ccd9.js +73 -0
- package/dist/esm/typings-b9828dba.js +9 -0
- package/dist/esm/uploader.taro-587e6bf3.js +492 -0
- package/dist/esm/useClientRect-1f8ed1fe.js +18 -0
- package/dist/esm/useTouch-db24bb5c.js +69 -0
- package/dist/esm/video-f1be8a91.js +67 -0
- package/dist/esm/virtuallist.taro-f0b0270d.js +214 -0
- package/dist/esm/watermark.taro-9ce2ae37.js +114 -0
- package/dist/esm/zh-CN-c779e6c1.js +131 -0
- package/dist/locales/base.d.ts +129 -0
- package/dist/locales/base.js +5 -0
- package/dist/locales/en-US.d.ts +3 -0
- package/dist/locales/en-US.js +135 -0
- package/dist/locales/id-ID.d.ts +3 -0
- package/dist/locales/id-ID.js +135 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +137 -0
- package/dist/locales/zh-TW.d.ts +3 -0
- package/dist/locales/zh-TW.js +135 -0
- package/dist/locales/zh-UG.d.ts +3 -0
- package/dist/locales/zh-UG.js +135 -0
- package/dist/nutui.react.mjs +1 -1
- package/dist/nutui.react.umd.js +1 -1
- package/dist/packages/actionsheet/actionsheet.scss +103 -0
- package/dist/packages/address/address.scss +243 -0
- package/dist/packages/animate/animate.scss +284 -0
- package/dist/packages/animatingnumbers/animatingnumbers.scss +0 -0
- package/dist/packages/animatingnumbers/countup.scss +45 -0
- package/dist/packages/audio/audio.scss +93 -0
- package/dist/packages/avatar/avatar.scss +58 -0
- package/dist/packages/avatargroup/avatargroup.scss +14 -0
- package/dist/packages/backtop/backtop.scss +29 -0
- package/dist/packages/badge/badge.scss +53 -0
- package/dist/packages/barrage/barrage.scss +60 -0
- package/dist/packages/button/button.scss +245 -0
- package/dist/packages/calendar/calendar.scss +265 -0
- package/dist/packages/calendaritem/calendaritem.scss +0 -0
- package/dist/packages/card/card.scss +83 -0
- package/dist/packages/cascader/cascader.scss +108 -0
- package/dist/packages/cell/cell.scss +107 -0
- package/dist/packages/cellgroup/cellgroup.scss +46 -0
- package/dist/packages/checkbox/checkbox.scss +49 -0
- package/dist/packages/checkboxgroup/checkboxgroup.scss +33 -0
- package/dist/packages/circleprogress/circleprogress.scss +33 -0
- package/dist/packages/col/col.scss +24 -0
- package/dist/packages/collapse/collapse.scss +0 -0
- package/dist/packages/collapseitem/collapseitem.scss +161 -0
- package/dist/packages/configprovider/configprovider.scss +0 -0
- package/dist/packages/countdown/countdown.scss +3 -0
- package/dist/packages/datepicker/datepicker.scss +0 -0
- package/dist/packages/dialog/dialog.scss +135 -0
- package/dist/packages/divider/divider.scss +73 -0
- package/dist/packages/drag/drag.scss +10 -0
- package/dist/packages/elevator/elevator.scss +124 -0
- package/dist/packages/ellipsis/ellipsis.scss +17 -0
- package/dist/packages/empty/empty.scss +42 -0
- package/dist/packages/fixednav/fixednav.scss +141 -0
- package/dist/packages/form/form.scss +31 -0
- package/dist/packages/formitem/formitem.scss +100 -0
- package/dist/packages/grid/grid.scss +10 -0
- package/dist/packages/griditem/griditem.scss +108 -0
- package/dist/packages/icon/icon.scss +132 -0
- package/dist/packages/image/image.scss +53 -0
- package/dist/packages/imagepreview/imagepreview.scss +51 -0
- package/dist/packages/indicator/indicator.scss +70 -0
- package/dist/packages/infiniteloading/infiniteloading.scss +69 -0
- package/dist/packages/input/input.scss +203 -0
- package/dist/packages/inputnumber/inputnumber.scss +79 -0
- package/dist/packages/layout/layout.scss +2 -0
- package/dist/packages/menu/menu.scss +75 -0
- package/dist/packages/menuitem/menuitem.scss +120 -0
- package/dist/packages/navbar/navbar.scss +185 -0
- package/dist/packages/noticebar/noticebar.scss +156 -0
- package/dist/packages/notify/notify.scss +93 -0
- package/dist/packages/numberkeyboard/numberkeyboard.scss +147 -0
- package/dist/packages/overlay/overlay.scss +75 -0
- package/dist/packages/pagination/pagination.scss +81 -0
- package/dist/packages/picker/picker.scss +225 -0
- package/dist/packages/popover/popover.scss +288 -0
- package/dist/packages/popup/popup.scss +201 -0
- package/dist/packages/price/price.scss +37 -0
- package/dist/packages/progress/progress.scss +114 -0
- package/dist/packages/pulltorefresh/pulltorefresh.scss +26 -0
- package/dist/packages/radio/radio.scss +84 -0
- package/dist/packages/radiogroup/radiogroup.scss +86 -0
- package/dist/packages/range/range.scss +224 -0
- package/dist/packages/rate/rate.scss +36 -0
- package/dist/packages/row/row.scss +83 -0
- package/dist/packages/searchbar/searchbar.scss +146 -0
- package/dist/packages/shortpassword/shortpassword.scss +203 -0
- package/dist/packages/sidenavbar/sidenavbar.scss +100 -0
- package/dist/packages/sidenavbaritem/sidenavbaritem.scss +25 -0
- package/dist/packages/signature/signature.scss +39 -0
- package/dist/packages/skeleton/skeleton.scss +70 -0
- package/dist/packages/step/step.scss +274 -0
- package/dist/packages/steps/steps.scss +7 -0
- package/dist/packages/sticky/sticky.scss +3 -0
- package/dist/packages/subsidenavbar/subsidenavbar.scss +35 -0
- package/dist/packages/swipe/swipe.scss +33 -0
- package/dist/packages/swiper/swiper.scss +45 -0
- package/dist/packages/swiperitem/swiperitem.scss +3 -0
- package/dist/packages/switch/switch.scss +87 -0
- package/dist/packages/tabbar/tabbar.scss +46 -0
- package/dist/packages/tabbaritem/tabbaritem.scss +97 -0
- package/dist/packages/table/table.scss +152 -0
- package/dist/packages/tabpane/tabpane.scss +23 -0
- package/dist/packages/tabs/tabs.scss +284 -0
- package/dist/packages/tag/tag.scss +67 -0
- package/dist/packages/textarea/textarea.scss +60 -0
- package/dist/packages/timedetail/timedetail.scss +45 -0
- package/dist/packages/timepannel/timepannel.scss +17 -0
- package/dist/packages/timeselect/timeselect.scss +73 -0
- package/dist/packages/toast/toast.scss +98 -0
- package/dist/packages/trendarrow/trendarrow.scss +17 -0
- package/dist/packages/uploader/uploader.scss +237 -0
- package/dist/packages/video/video.scss +18 -0
- package/dist/packages/virtuallist/virtuallist.scss +87 -0
- package/dist/packages/watermark/watermark.scss +13 -0
- package/dist/style.css +1 -0
- package/dist/style.mjs +9 -0
- package/dist/styles/animation/drop.scss +24 -0
- package/dist/styles/animation/ease.scss +23 -0
- package/dist/styles/animation/fade.scss +20 -0
- package/dist/styles/animation/icon.scss +245 -0
- package/dist/styles/animation/index.scss +7 -0
- package/dist/styles/animation/rotate.scss +10 -0
- package/dist/styles/animation/zoom.scss +26 -0
- package/dist/styles/font/config.json +175 -0
- package/dist/styles/font/demo.css +539 -0
- package/dist/styles/font/demo_index.html +3063 -0
- package/dist/styles/font/iconfont.css +515 -0
- package/dist/styles/font/iconfont.eot +0 -0
- package/dist/styles/font/iconfont.js +68 -0
- package/dist/styles/font/iconfont.json +884 -0
- package/dist/styles/font/iconfont.svg +356 -0
- package/dist/styles/font/iconfont.ttf +0 -0
- package/dist/styles/font/iconfont.woff +0 -0
- package/dist/styles/font/iconfont.woff2 +0 -0
- package/dist/styles/mixins/index.scss +2 -0
- package/dist/styles/mixins/make-animation.scss +24 -0
- package/dist/styles/mixins/text-ellipsis.scss +20 -0
- package/dist/styles/theme-dark.scss +26 -0
- package/dist/styles/theme-default.scss +40 -0
- package/dist/styles/themes/default.scss +97 -0
- package/dist/styles/variables.scss +2610 -0
- package/dist/types/index.d.ts +2194 -0
- package/package.json +1 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import React__default, { forwardRef, useRef, useState, useMemo, useImperativeHandle, useEffect } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { useReady, nextTick } from '@tarojs/taro';
|
|
4
|
+
import { c as cn } from './bem-350c1702.js';
|
|
5
|
+
import { u as useTouch } from './useTouch-db24bb5c.js';
|
|
6
|
+
import { g as getRectByTaro } from './useClientRect-1f8ed1fe.js';
|
|
7
|
+
|
|
8
|
+
function preventDefault(event, isStopPropagation) {
|
|
9
|
+
if (typeof event.cancelable !== 'boolean' || event.cancelable) {
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
}
|
|
12
|
+
if (isStopPropagation) {
|
|
13
|
+
event.stopPropagation();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const defaultProps = {
|
|
17
|
+
name: '',
|
|
18
|
+
leftWidth: 0,
|
|
19
|
+
rightWidth: 0,
|
|
20
|
+
};
|
|
21
|
+
const Swipe = forwardRef((props, instanceRef) => {
|
|
22
|
+
const swipeBem = cn('swipe');
|
|
23
|
+
const touch = useTouch();
|
|
24
|
+
// 获取元素的时候要在页面 onReady 后,需要参考小程序的事件周期
|
|
25
|
+
useReady(() => {
|
|
26
|
+
const getWidth = async () => {
|
|
27
|
+
if (leftWrapper.current) {
|
|
28
|
+
const leftRect = await getRectByTaro(leftWrapper.current);
|
|
29
|
+
setActionWidth((v) => ({ ...v, left: leftRect.width }));
|
|
30
|
+
}
|
|
31
|
+
if (rightWrapper.current) {
|
|
32
|
+
const rightRect = await getRectByTaro(rightWrapper.current);
|
|
33
|
+
setActionWidth((v) => ({ ...v, right: rightRect.width }));
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
nextTick(() => getWidth());
|
|
37
|
+
});
|
|
38
|
+
const { children, className, style } = { ...defaultProps, ...props };
|
|
39
|
+
const root = useRef();
|
|
40
|
+
const opened = useRef(false);
|
|
41
|
+
const lockClick = useRef(false);
|
|
42
|
+
const startOffset = useRef(0);
|
|
43
|
+
const [state, setState] = useState({
|
|
44
|
+
offset: 0,
|
|
45
|
+
dragging: false,
|
|
46
|
+
});
|
|
47
|
+
const [actionWidth, setActionWidth] = useState({
|
|
48
|
+
left: 0,
|
|
49
|
+
right: 0,
|
|
50
|
+
});
|
|
51
|
+
const wrapperStyle = {
|
|
52
|
+
transform: `translate3d(${state.offset}px, 0, 0)`,
|
|
53
|
+
transitionDuration: state.dragging ? '0s' : '.6s',
|
|
54
|
+
};
|
|
55
|
+
const leftWidth = useMemo(() => (props.leftWidth ? props.leftWidth : actionWidth.left), [props.leftWidth, actionWidth.left]);
|
|
56
|
+
const rightWidth = useMemo(() => (props.rightWidth ? props.rightWidth : actionWidth.right), [props.rightWidth, actionWidth.right]);
|
|
57
|
+
const onTouchStart = async (event) => {
|
|
58
|
+
if (leftWrapper.current) {
|
|
59
|
+
const leftRect = await getRectByTaro(leftWrapper.current);
|
|
60
|
+
setActionWidth((v) => ({ ...v, left: leftRect.width }));
|
|
61
|
+
}
|
|
62
|
+
if (rightWrapper.current) {
|
|
63
|
+
const rightRect = await getRectByTaro(rightWrapper.current);
|
|
64
|
+
setActionWidth((v) => ({ ...v, right: rightRect.width }));
|
|
65
|
+
}
|
|
66
|
+
if (!props.disabled) {
|
|
67
|
+
startOffset.current = state.offset;
|
|
68
|
+
touch.start(event);
|
|
69
|
+
props.onTouchStart && props.onTouchStart(event);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const onTouchMove = (event) => {
|
|
73
|
+
if (props.disabled) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
touch.move(event);
|
|
77
|
+
props.onTouchMove && props.onTouchMove(event);
|
|
78
|
+
if (touch.isHorizontal()) {
|
|
79
|
+
lockClick.current = true;
|
|
80
|
+
const newState = { ...state, dragging: true };
|
|
81
|
+
const isEdge = !opened || touch.deltaX * startOffset.current < 0;
|
|
82
|
+
if (isEdge) {
|
|
83
|
+
preventDefault(event, true);
|
|
84
|
+
}
|
|
85
|
+
newState.offset = rangeCalculation(touch.deltaX + startOffset.current, -rightWidth || 0, leftWidth || 0);
|
|
86
|
+
setState(newState);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const onTouchEnd = (event) => {
|
|
90
|
+
if (state.dragging) {
|
|
91
|
+
setState((v) => ({ ...v, dragging: false }));
|
|
92
|
+
toggle(state.offset > 0 ? 'left' : 'right');
|
|
93
|
+
setTimeout(() => {
|
|
94
|
+
lockClick.current = false;
|
|
95
|
+
}, 0);
|
|
96
|
+
props.onTouchEnd && props.onTouchEnd(event);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const toggle = (side) => {
|
|
100
|
+
const offset = Math.abs(state.offset);
|
|
101
|
+
const base = 0.3;
|
|
102
|
+
const baseNum = opened ? 1 - base : base;
|
|
103
|
+
const width = side === 'left' ? leftWidth : rightWidth;
|
|
104
|
+
if (width && offset > Number(width) * baseNum) {
|
|
105
|
+
open(side);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
close(side);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const open = (side) => {
|
|
112
|
+
opened.current = true;
|
|
113
|
+
const offset = side === 'left' ? leftWidth : -rightWidth;
|
|
114
|
+
const name = props.name;
|
|
115
|
+
props.onOpen?.({ name, position: side });
|
|
116
|
+
setState((v) => ({ ...v, offset: Number(offset) || 0 }));
|
|
117
|
+
};
|
|
118
|
+
const close = (position) => {
|
|
119
|
+
if (opened.current) {
|
|
120
|
+
opened.current = false;
|
|
121
|
+
props.onClose?.({
|
|
122
|
+
name: props.name,
|
|
123
|
+
position: position || 'left',
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
setState((v) => ({ ...v, offset: 0 }));
|
|
127
|
+
};
|
|
128
|
+
const rangeCalculation = (num, min, max) => {
|
|
129
|
+
return Math.min(Math.max(Number(num), Number(min)), Number(max));
|
|
130
|
+
};
|
|
131
|
+
const leftWrapper = useRef(null);
|
|
132
|
+
const rightWrapper = useRef(null);
|
|
133
|
+
const renderActionContent = (side) => {
|
|
134
|
+
if (props[`${side}Action`]) {
|
|
135
|
+
return (React__default.createElement("div", { id: "left", ref: side === 'left' ? leftWrapper : rightWrapper, className: `${swipeBem(side)}`, onClick: (e) => handleOperate(e, side) }, props[`${side}Action`]));
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
138
|
+
};
|
|
139
|
+
const handleOperate = (event, position) => {
|
|
140
|
+
event.stopPropagation();
|
|
141
|
+
if (props.beforeClose) {
|
|
142
|
+
props.beforeClose(position);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
props.onActionClick && props.onActionClick(event, position);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
useImperativeHandle(instanceRef, () => ({
|
|
149
|
+
open,
|
|
150
|
+
close: () => close(),
|
|
151
|
+
}));
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
const handler = (event) => {
|
|
154
|
+
const targets = [root];
|
|
155
|
+
if (targets.some((targetItem) => {
|
|
156
|
+
const targetElement = targetItem.current || targetItem;
|
|
157
|
+
return !targetElement || targetElement?.contains(event.target);
|
|
158
|
+
})) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
close();
|
|
162
|
+
};
|
|
163
|
+
document.addEventListener('touchstart', handler);
|
|
164
|
+
return () => {
|
|
165
|
+
document.removeEventListener('touchstart', handler);
|
|
166
|
+
};
|
|
167
|
+
}, []);
|
|
168
|
+
return (React__default.createElement("div", { ref: root, className: classNames(swipeBem(), className), onTouchStart: (e) => onTouchStart(e), onTouchMove: (e) => onTouchMove(e), onTouchEnd: (e) => onTouchEnd(e), style: style },
|
|
169
|
+
React__default.createElement("div", { className: `${swipeBem('wrapper')}`, style: wrapperStyle },
|
|
170
|
+
renderActionContent('left'),
|
|
171
|
+
children,
|
|
172
|
+
renderActionContent('right'))));
|
|
173
|
+
});
|
|
174
|
+
Swipe.defaultProps = defaultProps;
|
|
175
|
+
Swipe.displayName = 'NutSwipe';
|
|
176
|
+
|
|
177
|
+
export { Swipe as S };
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import React__default, { useRef, useState, useMemo, useEffect } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { nextTick, useReady, createSelectorQuery } from '@tarojs/taro';
|
|
4
|
+
import { D as DataContext } from './UserContext-e8176108.js';
|
|
5
|
+
import { c as cn } from './bem-350c1702.js';
|
|
6
|
+
|
|
7
|
+
const defaultProps = {
|
|
8
|
+
width: typeof window === 'object' ? window.innerWidth : 375,
|
|
9
|
+
height: 0,
|
|
10
|
+
duration: 500,
|
|
11
|
+
initPage: 0,
|
|
12
|
+
autoPlay: 0,
|
|
13
|
+
direction: 'horizontal',
|
|
14
|
+
paginationColor: '#fff',
|
|
15
|
+
paginationBgColor: '#ddd',
|
|
16
|
+
paginationVisible: false,
|
|
17
|
+
loop: true,
|
|
18
|
+
touchable: true,
|
|
19
|
+
isPreventDefault: true,
|
|
20
|
+
isStopPropagation: true,
|
|
21
|
+
isCenter: false,
|
|
22
|
+
className: '',
|
|
23
|
+
};
|
|
24
|
+
const DISTANCE = 5;
|
|
25
|
+
const Swiper = React__default.forwardRef((props, ref) => {
|
|
26
|
+
const propSwiper = { ...defaultProps, ...props };
|
|
27
|
+
const { children, direction, className, pageContent, onChange, initPage, paginationColor, paginationVisible, touchable, isPreventDefault, isStopPropagation, autoPlay, isCenter, ...rest } = propSwiper;
|
|
28
|
+
const container = useRef(null);
|
|
29
|
+
const innerRef = useRef(null);
|
|
30
|
+
const _swiper = useRef({
|
|
31
|
+
moving: false,
|
|
32
|
+
autoplayTimer: null,
|
|
33
|
+
width: 0,
|
|
34
|
+
height: 0,
|
|
35
|
+
offset: 0,
|
|
36
|
+
size: 0,
|
|
37
|
+
});
|
|
38
|
+
const [refRandomId] = useState(Math.random().toString(36).slice(-8));
|
|
39
|
+
const isVertical = direction === 'vertical';
|
|
40
|
+
const [rect, setRect] = useState(null);
|
|
41
|
+
// eslint-disable-next-line prefer-const
|
|
42
|
+
let [active, setActive] = useState(0);
|
|
43
|
+
const [width, setWidth] = useState(0);
|
|
44
|
+
const [height, setHeight] = useState(0);
|
|
45
|
+
const [offset, setOffset] = useState(0);
|
|
46
|
+
const [childOffset, setChildOffset] = useState([]);
|
|
47
|
+
const [ready, setReady] = useState(false);
|
|
48
|
+
let size = isVertical ? height : width;
|
|
49
|
+
const [touch, setTouch] = useState({
|
|
50
|
+
startX: 0,
|
|
51
|
+
startY: 0,
|
|
52
|
+
deltaX: 0,
|
|
53
|
+
deltaY: 0,
|
|
54
|
+
offsetX: 0,
|
|
55
|
+
offsetY: 0,
|
|
56
|
+
stateDirection: '',
|
|
57
|
+
delta: 0,
|
|
58
|
+
touchTime: 0,
|
|
59
|
+
});
|
|
60
|
+
const { childs, childCount } = useMemo(() => {
|
|
61
|
+
let childCount = 0;
|
|
62
|
+
const childs = React__default.Children.map(props.children, (child) => {
|
|
63
|
+
if (!React__default.isValidElement(child))
|
|
64
|
+
return null;
|
|
65
|
+
childCount++;
|
|
66
|
+
return child;
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
childs,
|
|
70
|
+
childCount,
|
|
71
|
+
};
|
|
72
|
+
}, [props.children]);
|
|
73
|
+
let trackSize = childCount * Number(size);
|
|
74
|
+
// 父组件参数传入子组件item
|
|
75
|
+
const parent = {
|
|
76
|
+
propSwiper,
|
|
77
|
+
size,
|
|
78
|
+
};
|
|
79
|
+
const minOffset = (() => {
|
|
80
|
+
if (rect) {
|
|
81
|
+
const base = isVertical ? rect?.height : rect?.width;
|
|
82
|
+
return base - Number(size) * childCount;
|
|
83
|
+
}
|
|
84
|
+
return 0;
|
|
85
|
+
})();
|
|
86
|
+
// 清除定时器
|
|
87
|
+
const stopAutoPlay = () => {
|
|
88
|
+
clearTimeout(_swiper.current.autoplayTimer);
|
|
89
|
+
_swiper.current.autoplayTimer = null;
|
|
90
|
+
};
|
|
91
|
+
// 定时轮播
|
|
92
|
+
const autoplay = () => {
|
|
93
|
+
if (propSwiper.autoPlay <= 0 || childCount <= 1)
|
|
94
|
+
return;
|
|
95
|
+
stopAutoPlay();
|
|
96
|
+
_swiper.current.autoplayTimer = setTimeout(() => {
|
|
97
|
+
next();
|
|
98
|
+
autoplay();
|
|
99
|
+
}, Number(propSwiper.autoPlay));
|
|
100
|
+
};
|
|
101
|
+
// 重置首尾位置信息
|
|
102
|
+
const resettPosition = () => {
|
|
103
|
+
_swiper.current.moving = true;
|
|
104
|
+
if (active <= -1) {
|
|
105
|
+
move({ pace: childCount });
|
|
106
|
+
}
|
|
107
|
+
if (active >= childCount) {
|
|
108
|
+
move({ pace: -childCount });
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
// 上一页
|
|
112
|
+
const prev = () => {
|
|
113
|
+
resettPosition();
|
|
114
|
+
touchReset();
|
|
115
|
+
requestFrame(() => {
|
|
116
|
+
requestFrame(() => {
|
|
117
|
+
_swiper.current.moving = false;
|
|
118
|
+
move({
|
|
119
|
+
pace: -1,
|
|
120
|
+
isEmit: true,
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
// 下一页
|
|
126
|
+
const next = () => {
|
|
127
|
+
resettPosition();
|
|
128
|
+
touchReset();
|
|
129
|
+
requestFrame(() => {
|
|
130
|
+
requestFrame(() => {
|
|
131
|
+
_swiper.current.moving = false;
|
|
132
|
+
move({
|
|
133
|
+
pace: 1,
|
|
134
|
+
isEmit: true,
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
// 前往指定页
|
|
140
|
+
const to = (index) => {
|
|
141
|
+
resettPosition();
|
|
142
|
+
touchReset();
|
|
143
|
+
requestFrame(() => {
|
|
144
|
+
requestFrame(() => {
|
|
145
|
+
_swiper.current.moving = false;
|
|
146
|
+
let targetIndex;
|
|
147
|
+
if (props.loop && childCount === index) {
|
|
148
|
+
targetIndex = active === 0 ? 0 : index;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
targetIndex = index % childCount;
|
|
152
|
+
}
|
|
153
|
+
move({
|
|
154
|
+
pace: targetIndex - active,
|
|
155
|
+
isEmit: true,
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
const resize = () => {
|
|
161
|
+
init(active);
|
|
162
|
+
};
|
|
163
|
+
// 切换方法
|
|
164
|
+
const move = ({ pace = 0, offset = 0, isEmit = false, movingStatus = false, }) => {
|
|
165
|
+
if (childCount <= 1)
|
|
166
|
+
return;
|
|
167
|
+
const targetActive = getActive(pace);
|
|
168
|
+
// 父级容器偏移量
|
|
169
|
+
const targetOffset = getOffset(targetActive, offset);
|
|
170
|
+
// 如果循环,调整开头结尾图片位置
|
|
171
|
+
if (props.loop) {
|
|
172
|
+
if (Array.isArray(children) &&
|
|
173
|
+
children[0] &&
|
|
174
|
+
targetOffset !== minOffset) {
|
|
175
|
+
const rightBound = targetOffset < minOffset;
|
|
176
|
+
childOffset[0] = rightBound ? trackSize : 0;
|
|
177
|
+
}
|
|
178
|
+
if (Array.isArray(children) &&
|
|
179
|
+
children[childCount - 1] &&
|
|
180
|
+
targetOffset !== 0) {
|
|
181
|
+
const leftBound = targetOffset > 0;
|
|
182
|
+
childOffset[childCount - 1] = leftBound ? -trackSize : 0;
|
|
183
|
+
}
|
|
184
|
+
setChildOffset(childOffset);
|
|
185
|
+
}
|
|
186
|
+
if (isEmit && active !== targetActive) {
|
|
187
|
+
props.onChange && props.onChange((targetActive + childCount) % childCount);
|
|
188
|
+
}
|
|
189
|
+
active = targetActive;
|
|
190
|
+
setActive(targetActive);
|
|
191
|
+
setOffset(targetOffset);
|
|
192
|
+
getStyle(targetOffset);
|
|
193
|
+
};
|
|
194
|
+
// 确定当前active 元素
|
|
195
|
+
const getActive = (pace) => {
|
|
196
|
+
if (pace) {
|
|
197
|
+
const _active = active + pace;
|
|
198
|
+
if (props.loop) {
|
|
199
|
+
return range(_active, -1, childCount);
|
|
200
|
+
}
|
|
201
|
+
return range(_active, 0, childCount - 1);
|
|
202
|
+
}
|
|
203
|
+
return active;
|
|
204
|
+
};
|
|
205
|
+
// 计算位移
|
|
206
|
+
const getOffset = (active, offset = 0) => {
|
|
207
|
+
let currentPosition = active * Number(size);
|
|
208
|
+
if (!props.loop) {
|
|
209
|
+
currentPosition = Math.min(currentPosition, -minOffset);
|
|
210
|
+
}
|
|
211
|
+
let targetOffset = offset - currentPosition;
|
|
212
|
+
if (!props.loop) {
|
|
213
|
+
targetOffset = range(targetOffset, minOffset, 0);
|
|
214
|
+
}
|
|
215
|
+
return targetOffset;
|
|
216
|
+
};
|
|
217
|
+
// 浏览器 帧 事件
|
|
218
|
+
const requestFrame = (fn) => {
|
|
219
|
+
window.requestAnimationFrame.call(window, fn);
|
|
220
|
+
};
|
|
221
|
+
// 取值 方法
|
|
222
|
+
const range = (num, min, max) => {
|
|
223
|
+
return Math.min(Math.max(num, min), max);
|
|
224
|
+
};
|
|
225
|
+
const getDirection = (x, y) => {
|
|
226
|
+
if (x > y && x > DISTANCE)
|
|
227
|
+
return 'horizontal';
|
|
228
|
+
if (y > x && y > DISTANCE)
|
|
229
|
+
return 'vertical';
|
|
230
|
+
return '';
|
|
231
|
+
};
|
|
232
|
+
// 重置 全部位移信息
|
|
233
|
+
const touchReset = () => {
|
|
234
|
+
touch.startX = 0;
|
|
235
|
+
touch.startY = 0;
|
|
236
|
+
touch.deltaX = 0;
|
|
237
|
+
touch.deltaY = 0;
|
|
238
|
+
touch.offsetX = 0;
|
|
239
|
+
touch.offsetY = 0;
|
|
240
|
+
touch.delta = 0;
|
|
241
|
+
touch.stateDirection = '';
|
|
242
|
+
touch.touchTime = 0;
|
|
243
|
+
};
|
|
244
|
+
// 触摸事件开始
|
|
245
|
+
const touchStart = (e) => {
|
|
246
|
+
touchReset();
|
|
247
|
+
touch.startX = e.touches[0].clientX;
|
|
248
|
+
touch.startY = e.touches[0].clientY;
|
|
249
|
+
};
|
|
250
|
+
// 触摸事件移动
|
|
251
|
+
const touchMove = (e) => {
|
|
252
|
+
touch.deltaX = e.touches[0].clientX - touch.startX;
|
|
253
|
+
touch.deltaY = e.touches[0].clientY - touch.startY;
|
|
254
|
+
touch.offsetX = Math.abs(touch.deltaX);
|
|
255
|
+
touch.offsetY = Math.abs(touch.deltaY);
|
|
256
|
+
touch.delta = isVertical ? touch.deltaY : touch.deltaX;
|
|
257
|
+
if (!touch.stateDirection) {
|
|
258
|
+
touch.stateDirection = getDirection(touch.offsetX, touch.offsetY);
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
const b = cn('swiper');
|
|
262
|
+
const classes = classNames(b(''));
|
|
263
|
+
const contentClass = classNames({
|
|
264
|
+
[`${b('inner')}`]: true,
|
|
265
|
+
[`${b('vertical')}`]: isVertical,
|
|
266
|
+
});
|
|
267
|
+
const getStyle = (moveOffset = offset) => {
|
|
268
|
+
const target = innerRef.current;
|
|
269
|
+
let _offset = 0;
|
|
270
|
+
if (!isCenter) {
|
|
271
|
+
_offset = moveOffset;
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
const _size = isVertical ? height : width;
|
|
275
|
+
const val = isVertical
|
|
276
|
+
? rect?.height - _size
|
|
277
|
+
: rect?.width - _size;
|
|
278
|
+
_offset =
|
|
279
|
+
moveOffset +
|
|
280
|
+
(active === childCount - 1 && !props.loop ? -val / 2 : val / 2);
|
|
281
|
+
}
|
|
282
|
+
target.style.transitionDuration = `${_swiper.current.moving ? 0 : props.duration}ms`;
|
|
283
|
+
target.style[isVertical ? 'height' : 'width'] = `${Number(size) * childCount}px`;
|
|
284
|
+
target.style[isVertical ? 'width' : 'height'] = `${isVertical ? width : height}px`;
|
|
285
|
+
target.style.transform = `translate3D${!isVertical ? `(${_offset}px,0,0)` : `(0,${_offset}px,0)`}`;
|
|
286
|
+
};
|
|
287
|
+
const onTouchStart = (e) => {
|
|
288
|
+
if (props.isPreventDefault)
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
if (props.isStopPropagation)
|
|
291
|
+
e.stopPropagation();
|
|
292
|
+
if (!props.touchable)
|
|
293
|
+
return;
|
|
294
|
+
touchStart(e);
|
|
295
|
+
touch.touchTime = Date.now();
|
|
296
|
+
stopAutoPlay();
|
|
297
|
+
resettPosition();
|
|
298
|
+
};
|
|
299
|
+
const onTouchMove = (e) => {
|
|
300
|
+
if (props.touchable && _swiper.current.moving) {
|
|
301
|
+
touchMove(e);
|
|
302
|
+
if (touch.stateDirection === props.direction) {
|
|
303
|
+
move({
|
|
304
|
+
offset: touch.delta,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
const onTouchEnd = (e) => {
|
|
310
|
+
if (!props.touchable || !_swiper.current.moving)
|
|
311
|
+
return;
|
|
312
|
+
const speed = touch.delta / (Date.now() - touch.touchTime);
|
|
313
|
+
const isShouldMove = Math.abs(speed) > 0.3 || Math.abs(touch.delta) > +(size / 2).toFixed(2);
|
|
314
|
+
let pace = 0;
|
|
315
|
+
_swiper.current.moving = false;
|
|
316
|
+
if (isShouldMove && touch.stateDirection === props.direction) {
|
|
317
|
+
const offset = isVertical ? touch.offsetY : touch.offsetX;
|
|
318
|
+
if (props.loop) {
|
|
319
|
+
if (offset > 0) {
|
|
320
|
+
pace = touch.delta > 0 ? -1 : 1;
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
pace = 0;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
pace = -Math[touch.delta > 0 ? 'ceil' : 'floor'](touch.delta / size);
|
|
328
|
+
}
|
|
329
|
+
move({
|
|
330
|
+
pace,
|
|
331
|
+
isEmit: true,
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
else if (touch.delta) {
|
|
335
|
+
move({ pace: 0 });
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
getStyle();
|
|
339
|
+
}
|
|
340
|
+
autoplay();
|
|
341
|
+
};
|
|
342
|
+
useEffect(() => {
|
|
343
|
+
_swiper.current.activePagination = (active + childCount) % childCount;
|
|
344
|
+
}, [active]);
|
|
345
|
+
const queryRect = (element) => {
|
|
346
|
+
return new Promise((resolve) => {
|
|
347
|
+
const query = createSelectorQuery();
|
|
348
|
+
query.select(`#${element.id}`) &&
|
|
349
|
+
query.select(`#${element.id}`).boundingClientRect();
|
|
350
|
+
query.exec((res) => {
|
|
351
|
+
resolve(res[0]);
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
};
|
|
355
|
+
const init = async (active = +propSwiper.initPage) => {
|
|
356
|
+
const rect = await queryRect(container.current);
|
|
357
|
+
const _active = Math.max(Math.min(childCount - 1, active), 0);
|
|
358
|
+
const _width = propSwiper.width ? +propSwiper.width : rect?.width;
|
|
359
|
+
const _height = propSwiper.height ? +propSwiper.height : rect?.height;
|
|
360
|
+
size = isVertical ? _height : _width;
|
|
361
|
+
trackSize = childCount * Number(size);
|
|
362
|
+
const targetOffset = getOffset(_active);
|
|
363
|
+
_swiper.current.moving = true;
|
|
364
|
+
if (ready) {
|
|
365
|
+
_swiper.current.moving = false;
|
|
366
|
+
}
|
|
367
|
+
setRect(rect);
|
|
368
|
+
setActive(_active);
|
|
369
|
+
setWidth(_width);
|
|
370
|
+
setHeight(_height);
|
|
371
|
+
setOffset(targetOffset);
|
|
372
|
+
setReady(true);
|
|
373
|
+
};
|
|
374
|
+
useEffect(() => {
|
|
375
|
+
if (ready) {
|
|
376
|
+
getStyle();
|
|
377
|
+
}
|
|
378
|
+
}, [isVertical, width, height, offset, ready]);
|
|
379
|
+
useEffect(() => {
|
|
380
|
+
if (ready) {
|
|
381
|
+
stopAutoPlay();
|
|
382
|
+
autoplay();
|
|
383
|
+
}
|
|
384
|
+
return () => {
|
|
385
|
+
setReady(false);
|
|
386
|
+
};
|
|
387
|
+
}, [ready]);
|
|
388
|
+
useEffect(() => {
|
|
389
|
+
stopAutoPlay();
|
|
390
|
+
autoplay();
|
|
391
|
+
}, [children]);
|
|
392
|
+
useEffect(() => {
|
|
393
|
+
nextTick(() => {
|
|
394
|
+
init();
|
|
395
|
+
});
|
|
396
|
+
}, [propSwiper.initPage]);
|
|
397
|
+
useEffect(() => {
|
|
398
|
+
return () => {
|
|
399
|
+
stopAutoPlay();
|
|
400
|
+
};
|
|
401
|
+
}, []);
|
|
402
|
+
useReady(() => {
|
|
403
|
+
nextTick(() => {
|
|
404
|
+
init();
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
const itemStyle = (index) => {
|
|
408
|
+
const style = {};
|
|
409
|
+
const _direction = propSwiper.direction || direction;
|
|
410
|
+
const _size = size;
|
|
411
|
+
if (_size) {
|
|
412
|
+
style[_direction === 'horizontal' ? 'width' : 'height'] = `${_size}px`;
|
|
413
|
+
}
|
|
414
|
+
const offset = childOffset[index];
|
|
415
|
+
if (offset) {
|
|
416
|
+
style.transform = `translate3D${_direction === 'horizontal' ? `(${offset}px,0,0)` : `(0,${offset}px,0)`}`;
|
|
417
|
+
}
|
|
418
|
+
return style;
|
|
419
|
+
};
|
|
420
|
+
React__default.useImperativeHandle(ref, () => ({
|
|
421
|
+
to,
|
|
422
|
+
next,
|
|
423
|
+
prev,
|
|
424
|
+
resize,
|
|
425
|
+
}));
|
|
426
|
+
return (React__default.createElement(DataContext.Provider, { value: parent },
|
|
427
|
+
React__default.createElement("div", { className: `${classes} ${className}`, ref: container, ...rest, id: `container-${refRandomId}`, onTouchStart: onTouchStart, onTouchMove: onTouchMove, onTouchEnd: onTouchEnd,
|
|
428
|
+
// @ts-ignore
|
|
429
|
+
catchMove: isVertical },
|
|
430
|
+
React__default.createElement("div", { className: contentClass, ref: innerRef }, React__default.Children.map(childs, (child, index) => {
|
|
431
|
+
return (React__default.createElement("div", { className: b('item-wrapper'), style: itemStyle(index), key: index }, child));
|
|
432
|
+
})),
|
|
433
|
+
propSwiper.paginationVisible && !('pageContent' in propSwiper) ? (React__default.createElement("div", { className: classNames({
|
|
434
|
+
[`${b('pagination')}`]: true,
|
|
435
|
+
[`${b('pagination-vertical')}`]: isVertical,
|
|
436
|
+
}) }, React__default.Children.map(childs, (item, index) => {
|
|
437
|
+
return (React__default.createElement("i", { style: (active + childCount) % childCount === index
|
|
438
|
+
? {
|
|
439
|
+
backgroundColor: propSwiper.paginationColor,
|
|
440
|
+
}
|
|
441
|
+
: {
|
|
442
|
+
backgroundColor: propSwiper.paginationBgColor,
|
|
443
|
+
}, className: classNames({
|
|
444
|
+
active: (active + childCount) % childCount === index,
|
|
445
|
+
}), key: index }));
|
|
446
|
+
}))) : (React__default.createElement("div", null, pageContent)))));
|
|
447
|
+
});
|
|
448
|
+
Swiper.defaultProps = defaultProps;
|
|
449
|
+
Swiper.displayName = 'NutSwiper';
|
|
450
|
+
|
|
451
|
+
export { Swiper as S };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React__default, { useContext } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { D as DataContext } from './UserContext-e8176108.js';
|
|
4
|
+
import { c as cn } from './bem-350c1702.js';
|
|
5
|
+
|
|
6
|
+
const defaultProps = {
|
|
7
|
+
direction: 'horizontal',
|
|
8
|
+
};
|
|
9
|
+
const SwiperItem = React__default.forwardRef((props, ref) => {
|
|
10
|
+
const _props = { ...defaultProps, ...props };
|
|
11
|
+
const { className, style, children, direction, size } = _props;
|
|
12
|
+
const parent = useContext(DataContext);
|
|
13
|
+
const b = cn('swiper-item');
|
|
14
|
+
const classes = classNames(b(''), className);
|
|
15
|
+
const getStyle = () => {
|
|
16
|
+
const style = {};
|
|
17
|
+
const _direction = parent?.propSwiper.direction || direction;
|
|
18
|
+
const _size = parent?.size || size;
|
|
19
|
+
if (_size) {
|
|
20
|
+
style[_direction === 'horizontal' ? 'width' : 'height'] = `${_size}px`;
|
|
21
|
+
}
|
|
22
|
+
return style;
|
|
23
|
+
};
|
|
24
|
+
return (React__default.createElement("div", { className: classes, style: { ...style, ...getStyle() } }, children));
|
|
25
|
+
});
|
|
26
|
+
SwiperItem.defaultProps = defaultProps;
|
|
27
|
+
SwiperItem.displayName = 'NutSwiperItem';
|
|
28
|
+
|
|
29
|
+
export { SwiperItem as S };
|