@nutui/nutui-react-taro 2.0.0-alpha.0 → 2.0.0-alpha.10
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 +137 -638
- package/dist/esm/ActionSheet.js +15 -16
- package/dist/esm/Address.js +19 -22
- package/dist/esm/Animate.js +7 -9
- package/dist/esm/AnimatingNumbers.js +8 -9
- package/dist/esm/Audio.js +18 -20
- package/dist/esm/Avatar.js +11 -12
- package/dist/esm/AvatarGroup.js +8 -13
- package/dist/esm/BackTop.js +9 -10
- package/dist/esm/Badge.js +7 -10
- package/dist/esm/Barrage.js +9 -10
- package/dist/esm/Button.js +8 -9
- package/dist/esm/Calendar.js +18 -21
- package/dist/esm/CalendarItem.js +11 -14
- package/dist/esm/Card.js +12 -13
- package/dist/esm/Cascader.js +16 -18
- package/dist/esm/Cell.js +7 -8
- package/dist/esm/CellGroup.js +7 -8
- package/dist/esm/Checkbox.js +9 -10
- package/dist/esm/CheckboxGroup.js +9 -10
- package/dist/esm/CircleProgress.js +8 -10
- package/dist/esm/Col.js +8 -8
- package/dist/esm/Collapse.js +8 -9
- package/dist/esm/CollapseItem.js +7 -8
- package/dist/esm/ConfigProvider.js +9 -9
- package/dist/esm/CountDown.js +8 -11
- package/dist/esm/DatePicker.js +20 -24
- package/dist/esm/Dialog.js +13 -15
- package/dist/esm/Divider.js +7 -7
- package/dist/esm/Drag.js +7 -9
- package/dist/esm/Elevator.js +9 -10
- package/dist/esm/Ellipsis.js +9 -11
- package/dist/esm/Empty.js +7 -11
- package/dist/esm/FixedNav.js +11 -14
- package/dist/esm/Form.js +10 -11
- package/dist/esm/FormItem.js +8 -9
- package/dist/esm/Grid.js +8 -11
- package/dist/esm/GridItem.js +7 -10
- package/dist/esm/Image.js +7 -10
- package/dist/esm/ImagePreview.js +18 -20
- package/dist/esm/Indicator.js +6 -7
- package/dist/esm/Infiniteloading.js +12 -15
- package/dist/esm/Input.js +11 -11
- package/dist/esm/InputNumber.js +9 -10
- package/dist/esm/Layout.js +5 -6
- package/dist/esm/Menu.js +8 -9
- package/dist/esm/MenuItem.js +13 -15
- package/dist/esm/NavBar.js +7 -11
- package/dist/esm/NoticeBar.js +9 -12
- package/dist/esm/Notify.js +8 -10
- package/dist/esm/NumberKeyboard.js +14 -19
- package/dist/esm/Overlay.js +8 -9
- package/dist/esm/Pagination.js +9 -12
- package/dist/esm/Picker.js +19 -23
- package/dist/esm/Popover.js +10 -11
- package/dist/esm/Popup.js +12 -15
- package/dist/esm/Price.js +6 -8
- package/dist/esm/Progress.js +7 -11
- package/dist/esm/PullToRefresh.js +9 -14
- package/dist/esm/Radio.js +9 -10
- package/dist/esm/RadioGroup.js +9 -10
- package/dist/esm/Range/style/index.js +1 -1
- package/dist/esm/Range.js +11 -16
- package/dist/esm/Rate.js +9 -10
- package/dist/esm/Row.js +8 -8
- package/dist/esm/SearchBar.js +11 -14
- package/dist/esm/ShortPassword.js +16 -19
- package/dist/esm/SideNavBar.js +14 -20
- package/dist/esm/SideNavBarItem.js +5 -6
- package/dist/esm/Signature.js +13 -16
- package/dist/esm/Skeleton.js +14 -13
- package/dist/esm/Step.js +8 -11
- package/dist/esm/Steps/style/index.js +1 -1
- package/dist/esm/Steps.js +8 -10
- package/dist/esm/Sticky.js +10 -12
- package/dist/esm/SubSideNavBar.js +6 -7
- package/dist/esm/Swipe.js +11 -12
- package/dist/esm/Swiper.js +8 -11
- package/dist/esm/SwiperItem.js +5 -10
- package/dist/esm/Switch.js +7 -8
- package/dist/esm/TabPane.js +6 -9
- package/dist/esm/Tabbar/style/index.js +1 -1
- package/dist/esm/Tabbar.js +10 -8
- package/dist/esm/TabbarItem.js +8 -10
- package/dist/esm/Table.js +9 -14
- package/dist/esm/Tabs.js +11 -12
- package/dist/esm/Tag.js +8 -9
- package/dist/esm/TextArea.js +11 -11
- package/dist/esm/TimeDetail.js +8 -11
- package/dist/esm/TimePannel.js +8 -11
- package/dist/esm/TimeSelect.js +18 -21
- package/dist/esm/Toast.js +9 -10
- package/dist/esm/TrendArrow.js +8 -9
- package/dist/esm/Uploader.js +14 -19
- package/dist/esm/UserContext-ab42ba7f.js +5 -0
- package/dist/esm/Video.js +8 -9
- package/dist/esm/VirtualList.js +8 -11
- package/dist/esm/WaterMark.js +10 -13
- package/dist/esm/actionsheet.taro-d2217152.js +61 -0
- package/dist/esm/address.taro-1a8ab3f1.js +470 -0
- package/dist/esm/animate.taro-c8b29242.js +44 -0
- package/dist/esm/animatingnumbers.taro-c2a52dbd.js +103 -0
- package/dist/esm/audio.taro-bbd39f93.js +185 -0
- package/dist/esm/avatar.taro-01536aff.js +100 -0
- package/dist/esm/avatargroup-ad5ffb46.js +34 -0
- package/dist/esm/backtop.taro-7de36464.js +48 -0
- package/dist/esm/badge.taro-872605bf.js +48 -0
- package/dist/esm/barrage.taro-c8cb9864.js +91 -0
- package/dist/esm/bem-cdccae08.js +5 -0
- package/dist/esm/button.taro-01eae688.js +72 -0
- package/dist/esm/calendar.taro-10a6cb11.js +70 -0
- package/dist/esm/calendaritem.taro-3e5f114e.js +732 -0
- package/dist/esm/can-use-dom-0e539bd3.js +4 -0
- package/dist/esm/card.taro-2080f4d2.js +51 -0
- package/dist/esm/cascader.taro-fb7a0230.js +471 -0
- package/dist/esm/cell.taro-4e31d1fa.js +48 -0
- package/dist/esm/cellgroup.taro-a790d91b.js +28 -0
- package/dist/esm/checkbox.taro-016074da.js +177 -0
- package/dist/esm/circleprogress.taro-7149e09d.js +104 -0
- package/dist/esm/col.taro-d6a46a7d.js +41 -0
- package/dist/esm/collapse.taro-3d997680.js +70 -0
- package/dist/esm/collapseitem-f4571575.js +76 -0
- package/dist/esm/configprovider.taro-25758d9f.js +462 -0
- package/dist/esm/context-ab42ba7f.js +5 -0
- package/dist/esm/context-d0fccf11.js +5 -0
- package/dist/esm/countdown.taro-22200811.js +210 -0
- package/dist/esm/datepicker.taro-65dbeceb.js +260 -0
- package/dist/esm/dialog.taro-290eb9a6.js +128 -0
- package/dist/esm/divider.taro-0cb5f894.js +31 -0
- package/dist/esm/drag.taro-48e1ff38.js +111 -0
- package/dist/esm/elevator.taro-df8fde9d.js +206 -0
- package/dist/esm/ellipsis.taro-f9688dd7.js +242 -0
- package/dist/esm/empty.taro-ca792f57.js +59 -0
- package/dist/esm/fixednav.taro-28e5f776.js +61 -0
- package/dist/esm/form.taro-b06754e8.js +182 -0
- package/dist/esm/formitem.taro-b326809d.js +108 -0
- package/dist/esm/grid.taro-fbbd8618.js +52 -0
- package/dist/esm/griditem.taro-b0c37077.js +85 -0
- package/dist/esm/image.taro-767aa000.js +65 -0
- package/dist/esm/imagepreview.taro-daa5a84f.js +180 -0
- package/dist/esm/index-e3184f19.js +9 -0
- package/dist/esm/indicator.taro-edbc71df.js +30 -0
- package/dist/esm/infiniteloading.taro-f8f23ac6.js +143 -0
- package/dist/esm/input.taro-27d686c9.js +164 -0
- package/dist/esm/inputnumber.taro-6657d2c1.js +197 -0
- package/dist/esm/layout.taro-9659a928.js +11 -0
- package/dist/esm/menu.taro-cd0fef41.js +122 -0
- package/dist/esm/menuitem.taro-6076bffa.js +142 -0
- package/dist/esm/navbar.taro-5e1a0835.js +61 -0
- package/dist/esm/noticebar.taro-2f02b2ad.js +369 -0
- package/dist/esm/notify.taro-5768403d.js +75 -0
- package/dist/esm/numberkeyboard.taro-ad8afaf9.js +136 -0
- package/dist/esm/nutui-react.es.js +206 -118
- package/dist/esm/offsetContext-f32a9246.js +5 -0
- package/dist/esm/overlay.taro-75012bd3.js +77 -0
- package/dist/esm/pagination.taro-63607c3b.js +94 -0
- package/dist/esm/picker.taro-0570ec32.js +481 -0
- package/dist/esm/popover.taro-ad483372.js +162 -0
- package/dist/esm/popup.taro-e756f3fc.js +150 -0
- package/dist/esm/price.taro-479f1b82.js +80 -0
- package/dist/esm/progress.taro-437b9f6a.js +66 -0
- package/dist/esm/pulltorefresh.taro-6afe4805.js +138 -0
- package/dist/esm/radio.taro-5d6ca4ad.js +153 -0
- package/dist/esm/range.taro-615e193a.js +259 -0
- package/dist/esm/rate.taro-78c66969.js +77 -0
- package/dist/esm/row.taro-8b7febd4.js +48 -0
- package/dist/esm/searchbar.taro-37ade36e.js +159 -0
- package/dist/esm/shortpassword.taro-f7292032.js +146 -0
- package/dist/esm/sidenavbar.taro-9f210df4.js +51 -0
- package/dist/esm/sidenavbaritem.taro-32a45ce6.js +12 -0
- package/dist/esm/signature.taro-c57469aa.js +146 -0
- package/dist/esm/skeleton.taro-9ff9baf4.js +71 -0
- package/dist/esm/step.taro-2f55e4f2.js +63 -0
- package/dist/esm/steps.taro-196c1f59.js +31 -0
- package/dist/esm/sticky.taro-f8ae8d5e.js +154 -0
- package/dist/esm/subsidenavbar.taro-abe07673.js +64 -0
- package/dist/esm/swipe.taro-de80fcd8.js +180 -0
- package/dist/esm/swiper.taro-4aeb8526.js +86 -0
- package/dist/esm/swiperitem.taro-ef7342e8.js +14 -0
- package/dist/esm/switch.taro-f0da73a3.js +44 -0
- package/dist/esm/tabbar.taro-18eee41f.js +55 -0
- package/dist/esm/tabbaritem.taro-89646ca1.js +47 -0
- package/dist/esm/table.taro-15a55c5d.js +100 -0
- package/dist/esm/tabpane.taro-f8d92ece.js +21 -0
- package/dist/esm/tabs.taro-66164782.js +146 -0
- package/dist/esm/tag.taro-1b4134a5.js +92 -0
- package/dist/esm/textarea.taro-c110565e.js +102 -0
- package/dist/esm/timedetail.taro-8d2acbbf.js +41 -0
- package/dist/esm/timepannel.taro-ee4c5dfa.js +22 -0
- package/dist/esm/timeselect.taro-069deedd.js +133 -0
- package/dist/esm/toast.taro-92c10e1d.js +114 -0
- package/dist/esm/trendarrow.taro-0cf43935.js +72 -0
- package/dist/esm/typings-11d83a22.js +7 -0
- package/dist/esm/uploader.taro-7e38fc37.js +519 -0
- package/dist/esm/use-client-rect-f317804e.js +10 -0
- package/dist/esm/use-props-value-7ac1b1b5.js +16 -0
- package/dist/esm/use-touch-ff43512c.js +69 -0
- package/dist/esm/video-5d106e33.js +73 -0
- package/dist/esm/virtuallist.taro-99f03769.js +195 -0
- package/dist/esm/watermark.taro-cef29c03.js +109 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.mjs +16980 -22641
- package/dist/nutui.react.umd.js +17061 -22738
- package/dist/packages/audio/audio.scss +2 -15
- package/dist/packages/badge/badge.scss +8 -18
- package/dist/packages/calendar/calendar.scss +0 -30
- package/dist/packages/cascader/cascader.scss +0 -26
- package/dist/packages/cellgroup/cellgroup.scss +20 -16
- package/dist/packages/checkbox/checkbox.scss +8 -11
- package/dist/packages/circleprogress/circleprogress.scss +0 -9
- package/dist/packages/dialog/dialog.scss +36 -65
- package/dist/packages/elevator/elevator.scss +2 -28
- package/dist/packages/empty/empty.scss +0 -9
- package/dist/packages/imagepreview/imagepreview.scss +52 -16
- package/dist/packages/input/input.scss +13 -180
- package/dist/packages/menu/menu.scss +44 -55
- package/dist/packages/menuitem/menuitem.scss +16 -26
- package/dist/packages/navbar/navbar.scss +16 -115
- package/dist/packages/noticebar/noticebar.scss +18 -19
- package/dist/packages/notify/notify.scss +1 -1
- package/dist/packages/numberkeyboard/numberkeyboard.scss +29 -77
- package/dist/packages/overlay/overlay.scss +11 -4
- package/dist/packages/picker/picker.scss +66 -137
- package/dist/packages/popup/popup.scss +0 -16
- package/dist/packages/price/price.scss +8 -0
- package/dist/packages/progress/progress.scss +19 -58
- package/dist/packages/pulltorefresh/pulltorefresh.scss +0 -8
- package/dist/packages/radio/radio.scss +13 -32
- package/dist/packages/radiogroup/radiogroup.scss +17 -51
- package/dist/packages/range/range.scss +24 -49
- package/dist/packages/row/row.scss +13 -31
- package/dist/packages/sidenavbar/sidenavbar.scss +0 -19
- package/dist/packages/step/step.scss +9 -62
- package/dist/packages/steps/steps.scss +2 -0
- package/dist/packages/swiper/swiper.scss +3 -18
- package/dist/packages/switch/switch.scss +13 -31
- package/dist/packages/tabbar/tabbar.scss +16 -22
- package/dist/packages/tabbaritem/tabbaritem.scss +9 -70
- package/dist/packages/table/table.scss +0 -56
- package/dist/packages/tabs/tabs.scss +196 -225
- package/dist/packages/textarea/textarea.scss +5 -12
- package/dist/packages/uploader/uploader.scss +2 -28
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/themes/default.scss +17 -18
- package/dist/styles/variables-jmapp.scss +120 -240
- package/dist/styles/variables.scss +139 -252
- package/dist/types/index.d.ts +572 -722
- package/package.json +2 -2
- package/dist/esm/AvatarContext-c96afdcc.js +0 -5
- package/dist/esm/Icon.js +0 -64
- package/dist/esm/UserContext-0aac9a82.js +0 -5
- package/dist/esm/UserContext-e402e1a6.js +0 -5
- package/dist/esm/UserContext-e8176108.js +0 -5
- package/dist/esm/actionsheet.taro-b76a342e.js +0 -53
- package/dist/esm/address.taro-1812caeb.js +0 -461
- package/dist/esm/animate.taro-fb7986d6.js +0 -40
- package/dist/esm/animatingnumbers.taro-03e5d61d.js +0 -104
- package/dist/esm/audio.taro-f672a68c.js +0 -162
- package/dist/esm/avatar.taro-de157a1f.js +0 -105
- package/dist/esm/avatargroup-b476ac68.js +0 -34
- package/dist/esm/backtop.taro-ba271b8f.js +0 -52
- package/dist/esm/badge.taro-ae154f41.js +0 -50
- package/dist/esm/barrage.taro-80df08d3.js +0 -94
- package/dist/esm/bem-350c1702.js +0 -5
- package/dist/esm/button.taro-a1c9512f.js +0 -65
- package/dist/esm/calendar.taro-b6b147ca.js +0 -65
- package/dist/esm/calendaritem.taro-ae167e59.js +0 -787
- package/dist/esm/can-use-dom-3eeb5af4.js +0 -6
- package/dist/esm/card.taro-5e9b34c8.js +0 -33
- package/dist/esm/cascader.taro-9c0a1a38.js +0 -447
- package/dist/esm/cell.taro-26870740.js +0 -43
- package/dist/esm/cellgroup.taro-6e901b54.js +0 -24
- package/dist/esm/checkbox.taro-785c528b.js +0 -168
- package/dist/esm/circleprogress.taro-79854448.js +0 -109
- package/dist/esm/col.taro-53eed3cc.js +0 -41
- package/dist/esm/collapse.taro-35a8a0d6.js +0 -79
- package/dist/esm/collapseitem-690eb91c.js +0 -68
- package/dist/esm/configprovider-9960f0fb.js +0 -19
- package/dist/esm/configprovider.taro-c8c54556.js +0 -45
- package/dist/esm/countdown.taro-0e6bf7a2.js +0 -225
- package/dist/esm/datepicker.taro-439e2080.js +0 -275
- package/dist/esm/dialog.taro-00ac41fd.js +0 -118
- package/dist/esm/divider.taro-6c1657ce.js +0 -31
- package/dist/esm/drag.taro-79bb8744.js +0 -110
- package/dist/esm/elevator.taro-81a11ecc.js +0 -178
- package/dist/esm/ellipsis.taro-b6cda065.js +0 -241
- package/dist/esm/empty.taro-fde835ca.js +0 -62
- package/dist/esm/fixednav.taro-39fbd47a.js +0 -54
- package/dist/esm/form.taro-0d83f1e8.js +0 -179
- package/dist/esm/formitem.taro-0de07d1e.js +0 -89
- package/dist/esm/get-scroll-parent-b4a07e65.js +0 -25
- package/dist/esm/grid.taro-3797169c.js +0 -49
- package/dist/esm/griditem.taro-04f59ae1.js +0 -80
- package/dist/esm/image.taro-edb572bb.js +0 -64
- package/dist/esm/imagepreview.taro-867ee24a.js +0 -167
- package/dist/esm/index-5bcb0ff8.js +0 -7
- package/dist/esm/indicator.taro-c10334e8.js +0 -30
- package/dist/esm/infiniteloading.taro-73c9b8ca.js +0 -141
- package/dist/esm/input.taro-10ed5500.js +0 -237
- package/dist/esm/inputnumber.taro-108c4784.js +0 -199
- package/dist/esm/layout.taro-9046d093.js +0 -11
- package/dist/esm/menu.taro-54951911.js +0 -98
- package/dist/esm/menuitem.taro-86a6bb6c.js +0 -128
- package/dist/esm/navbar.taro-69f47d51.js +0 -77
- package/dist/esm/noticebar.taro-49e7441f.js +0 -427
- package/dist/esm/notify.taro-e17c6f82.js +0 -75
- package/dist/esm/numberkeyboard.taro-81b36e5e.js +0 -159
- package/dist/esm/offsetContext-c2a746fa.js +0 -5
- package/dist/esm/overlay.taro-ad0d4775.js +0 -75
- package/dist/esm/pagination.taro-60b22b27.js +0 -91
- package/dist/esm/picker.taro-5c9030a7.js +0 -423
- package/dist/esm/popover.taro-2a57eae4.js +0 -153
- package/dist/esm/popup.taro-124b9bab.js +0 -142
- package/dist/esm/price.taro-776ed16e.js +0 -83
- package/dist/esm/progress.taro-24392ef3.js +0 -88
- package/dist/esm/pulltorefresh.taro-d5fcfcb0.js +0 -181
- package/dist/esm/radio.taro-51e10152.js +0 -177
- package/dist/esm/range.taro-7a2b6ca1.js +0 -332
- package/dist/esm/rate.taro-57341aa9.js +0 -77
- package/dist/esm/row.taro-f64d4a13.js +0 -46
- package/dist/esm/searchbar.taro-eef468bb.js +0 -152
- package/dist/esm/shortpassword.taro-9a2c98ad.js +0 -119
- package/dist/esm/sidenavbar.taro-0265812f.js +0 -35
- package/dist/esm/sidenavbaritem.taro-bb80dbf4.js +0 -12
- package/dist/esm/signature.taro-f01b2b05.js +0 -143
- package/dist/esm/skeleton.taro-64e858a2.js +0 -62
- package/dist/esm/step.taro-2ec1f283.js +0 -58
- package/dist/esm/steps.taro-c82d2252.js +0 -30
- package/dist/esm/sticky.taro-b5bde7b1.js +0 -136
- package/dist/esm/subsidenavbar.taro-3cce8442.js +0 -63
- package/dist/esm/supports-passive-c85ef996.js +0 -18
- package/dist/esm/swipe.taro-350c9a94.js +0 -177
- package/dist/esm/swiper.taro-7a94e211.js +0 -451
- package/dist/esm/swiperitem-c9e3d0d5.js +0 -29
- package/dist/esm/switch.taro-34ca8228.js +0 -50
- package/dist/esm/tabbar.taro-9acfc2fa.js +0 -59
- package/dist/esm/tabbaritem.taro-42ba353f.js +0 -55
- package/dist/esm/table.taro-3946697c.js +0 -95
- package/dist/esm/tabpane.taro-4ca340ef.js +0 -23
- package/dist/esm/tabs.taro-be8cacb5.js +0 -140
- package/dist/esm/tag.taro-0c2567de.js +0 -92
- package/dist/esm/textarea.taro-a0f79515.js +0 -94
- package/dist/esm/timedetail.taro-fce4e614.js +0 -44
- package/dist/esm/timepannel.taro-fd3d008d.js +0 -22
- package/dist/esm/timeselect.taro-5b047850.js +0 -133
- package/dist/esm/toast.taro-e4f44812.js +0 -108
- package/dist/esm/trendarrow.taro-7cf90def.js +0 -70
- package/dist/esm/typings-d8491423.js +0 -6
- package/dist/esm/uploader.taro-0cca7e97.js +0 -496
- package/dist/esm/use-client-rect-1f8ed1fe.js +0 -18
- package/dist/esm/use-props-value-ae7ee726.js +0 -15
- package/dist/esm/use-touch-db24bb5c.js +0 -69
- package/dist/esm/video-7ed508cc.js +0 -67
- package/dist/esm/virtuallist.taro-35b9bd9a.js +0 -214
- package/dist/esm/watermark.taro-c780d360.js +0 -114
- package/dist/esm/zh-CN-b4f493ba.js +0 -131
- package/dist/packages/icon/icon.scss +0 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import React, { useState, useRef } from "react";
|
|
2
|
+
import { createInnerAudioContext } from "@tarojs/taro";
|
|
3
|
+
import { Service } from "@nutui/icons-react-taro";
|
|
4
|
+
import { R as Range } from "./range.taro-615e193a.js";
|
|
5
|
+
import { B as Button } from "./button.taro-01eae688.js";
|
|
6
|
+
import { c as cn } from "./bem-cdccae08.js";
|
|
7
|
+
import { u as useConfig } from "./configprovider.taro-25758d9f.js";
|
|
8
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
9
|
+
const b = cn("audio");
|
|
10
|
+
const warn = console.warn;
|
|
11
|
+
const defaultProps = {
|
|
12
|
+
...ComponentDefaults,
|
|
13
|
+
className: "",
|
|
14
|
+
url: "",
|
|
15
|
+
style: {},
|
|
16
|
+
autoplay: false,
|
|
17
|
+
loop: false,
|
|
18
|
+
type: "progress",
|
|
19
|
+
onFastBack: (ctx) => {
|
|
20
|
+
},
|
|
21
|
+
onForward: (ctx) => {
|
|
22
|
+
},
|
|
23
|
+
onPause: (ctx) => {
|
|
24
|
+
},
|
|
25
|
+
onPlay: (ctx) => {
|
|
26
|
+
},
|
|
27
|
+
onPlayEnd: (ctx) => {
|
|
28
|
+
},
|
|
29
|
+
onCanPlay: (ctx) => {
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const Audio = (props) => {
|
|
33
|
+
const { locale } = useConfig();
|
|
34
|
+
const { className, url, style, autoplay, loop, type, onFastBack, onForward, onPause, onPlay, onPlayEnd, onCanPlay, children, iconClassPrefix, iconFontClassName, ...rest } = {
|
|
35
|
+
...defaultProps,
|
|
36
|
+
...props
|
|
37
|
+
};
|
|
38
|
+
const [playing, setPlaying] = useState(false);
|
|
39
|
+
const [totalSeconds, setTotalSeconds] = useState(0);
|
|
40
|
+
const [percent, setPercent] = useState(0);
|
|
41
|
+
const [isCanPlay, setIsCanPlay] = useState(false);
|
|
42
|
+
const [currentDuration, setCurrentDuration] = useState("00:00:00");
|
|
43
|
+
const statusRef = useRef({
|
|
44
|
+
currentTime: 0,
|
|
45
|
+
currentDuration: "00:00:00",
|
|
46
|
+
percent: 0
|
|
47
|
+
});
|
|
48
|
+
const audioRef = useRef(createInnerAudioContext());
|
|
49
|
+
const audioCtx = audioRef.current;
|
|
50
|
+
audioCtx.src = url;
|
|
51
|
+
audioCtx.autoplay = autoplay || false;
|
|
52
|
+
audioCtx.loop = loop || false;
|
|
53
|
+
audioCtx.onPause(() => {
|
|
54
|
+
props.onPause && props.onPause(audioCtx);
|
|
55
|
+
});
|
|
56
|
+
audioCtx.onEnded(() => {
|
|
57
|
+
if (props.loop) {
|
|
58
|
+
warn(locale.audio.tips || "onPlayEnd事件在loop=false时才会触发");
|
|
59
|
+
} else {
|
|
60
|
+
props.onPlayEnd && props.onPlayEnd(audioCtx);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
audioCtx.onPlay(() => {
|
|
64
|
+
const { duration } = audioCtx;
|
|
65
|
+
setTotalSeconds(Math.floor(duration));
|
|
66
|
+
props.onPlay && props.onPlay(audioCtx);
|
|
67
|
+
});
|
|
68
|
+
audioCtx.onCanplay(() => {
|
|
69
|
+
const intervalID = setInterval(function() {
|
|
70
|
+
if (audioCtx.duration !== 0) {
|
|
71
|
+
setTotalSeconds(audioCtx.duration);
|
|
72
|
+
clearInterval(intervalID);
|
|
73
|
+
}
|
|
74
|
+
}, 500);
|
|
75
|
+
setIsCanPlay(true);
|
|
76
|
+
props.onCanPlay && props.onCanPlay(audioCtx);
|
|
77
|
+
});
|
|
78
|
+
audioCtx.onTimeUpdate(() => {
|
|
79
|
+
const time = parseInt(`${audioCtx.currentTime}`);
|
|
80
|
+
const formated = formatSeconds(`${time}`);
|
|
81
|
+
statusRef.current.currentDuration = formated;
|
|
82
|
+
setPercent(time / totalSeconds * 100);
|
|
83
|
+
setCurrentDuration(formatSeconds(audioCtx.currentTime.toString()));
|
|
84
|
+
});
|
|
85
|
+
audioCtx.onError((res) => {
|
|
86
|
+
console.log("code", res.errCode);
|
|
87
|
+
console.log("message", res.errMsg);
|
|
88
|
+
});
|
|
89
|
+
function formatSeconds(value) {
|
|
90
|
+
if (!value) {
|
|
91
|
+
return "00:00:00";
|
|
92
|
+
}
|
|
93
|
+
const time = parseInt(value);
|
|
94
|
+
const hours = Math.floor(time / 3600);
|
|
95
|
+
const minutes = Math.floor((time - hours * 3600) / 60);
|
|
96
|
+
const secondss = time - hours * 3600 - minutes * 60;
|
|
97
|
+
let result = "";
|
|
98
|
+
result += `${`0${hours.toString()}`.slice(-2)}:`;
|
|
99
|
+
result += `${`0${minutes.toString()}`.slice(-2)}:`;
|
|
100
|
+
result += `0${secondss.toString()}`.slice(-2);
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
const handleBack = () => {
|
|
104
|
+
const currentTime = Math.floor(audioCtx.currentTime);
|
|
105
|
+
statusRef.current.currentTime = Math.max(currentTime - 1, 0);
|
|
106
|
+
setCurrentDuration(formatSeconds(statusRef.current.currentTime.toString()));
|
|
107
|
+
audioCtx.seek(statusRef.current.currentTime);
|
|
108
|
+
props.onFastBack && props.onFastBack(audioCtx);
|
|
109
|
+
};
|
|
110
|
+
const handleForward = () => {
|
|
111
|
+
const currentTime = Math.floor(audioCtx.currentTime);
|
|
112
|
+
statusRef.current.currentTime = Math.min(currentTime + 1, audioCtx.duration);
|
|
113
|
+
setCurrentDuration(formatSeconds(statusRef.current.currentTime.toString()));
|
|
114
|
+
audioCtx.seek(statusRef.current.currentTime);
|
|
115
|
+
props.onForward && props.onForward(audioCtx);
|
|
116
|
+
};
|
|
117
|
+
const handleStatusChange = () => {
|
|
118
|
+
setPlaying(!playing);
|
|
119
|
+
if (!playing) {
|
|
120
|
+
audioCtx.play();
|
|
121
|
+
} else {
|
|
122
|
+
audioCtx.pause();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const renderIcon = () => {
|
|
126
|
+
return React.createElement(
|
|
127
|
+
React.Fragment,
|
|
128
|
+
null,
|
|
129
|
+
React.createElement(
|
|
130
|
+
"div",
|
|
131
|
+
{ className: b("icon") },
|
|
132
|
+
React.createElement(
|
|
133
|
+
"div",
|
|
134
|
+
{ className: `${b("icon-box")} ${playing ? b("icon-play") : b("icon-stop")}`, onClick: handleStatusChange },
|
|
135
|
+
React.createElement(Service, { className: playing ? "nut-icon-loading" : "" })
|
|
136
|
+
)
|
|
137
|
+
)
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
const renderProgerss = () => {
|
|
141
|
+
return React.createElement(
|
|
142
|
+
React.Fragment,
|
|
143
|
+
null,
|
|
144
|
+
React.createElement(
|
|
145
|
+
"div",
|
|
146
|
+
{ className: b("progress") },
|
|
147
|
+
React.createElement("div", { className: "time" }, currentDuration),
|
|
148
|
+
React.createElement(
|
|
149
|
+
"div",
|
|
150
|
+
{ className: b("progress-bar-wrapper") },
|
|
151
|
+
React.createElement(Range, { value: percent, onChange: (val) => setPercent(val), currentDescription: null, maxDescription: null, minDescription: null, "inactive-color": "#cccccc", "active-color": "#fa2c19" })
|
|
152
|
+
),
|
|
153
|
+
React.createElement("div", { className: "time" }, formatSeconds(`${totalSeconds}`) || "00:00:00")
|
|
154
|
+
),
|
|
155
|
+
React.createElement(
|
|
156
|
+
"div",
|
|
157
|
+
{ className: isCanPlay ? "custom-button-group" : "custom-button-group-disable" },
|
|
158
|
+
React.createElement(Button, { type: "primary", size: "small", className: "back", onClick: handleBack }, locale.audio.back || "快退"),
|
|
159
|
+
React.createElement(Button, { type: "primary", size: "small", className: "start", onClick: handleStatusChange }, playing ? `${locale.audio.pause || "暂停"}` : `${locale.audio.start || "开始"}`),
|
|
160
|
+
React.createElement(Button, { type: "primary", size: "small", onClick: handleForward }, locale.audio.forward || "快进")
|
|
161
|
+
)
|
|
162
|
+
);
|
|
163
|
+
};
|
|
164
|
+
const renderNone = () => {
|
|
165
|
+
return React.createElement("div", { className: b("none-container"), onClick: handleStatusChange }, children);
|
|
166
|
+
};
|
|
167
|
+
const renderAudio = () => {
|
|
168
|
+
switch (type) {
|
|
169
|
+
case "icon":
|
|
170
|
+
return renderIcon();
|
|
171
|
+
case "progress":
|
|
172
|
+
return renderProgerss();
|
|
173
|
+
case "none":
|
|
174
|
+
return renderNone();
|
|
175
|
+
default:
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
return React.createElement("div", { className: `${b()} ${className}`, style, ...rest }, renderAudio());
|
|
180
|
+
};
|
|
181
|
+
Audio.defaultProps = defaultProps;
|
|
182
|
+
Audio.displayName = "NutAudio";
|
|
183
|
+
export {
|
|
184
|
+
Audio as A
|
|
185
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React, { useState, useRef, useContext, useEffect } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { I as Image } from "./image.taro-767aa000.js";
|
|
4
|
+
import { A as AvatarContext } from "./context-d0fccf11.js";
|
|
5
|
+
import { My } from "@nutui/icons-react-taro";
|
|
6
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
7
|
+
const defaultProps = {
|
|
8
|
+
...ComponentDefaults,
|
|
9
|
+
size: "",
|
|
10
|
+
shape: "round",
|
|
11
|
+
icon: "",
|
|
12
|
+
fit: "cover",
|
|
13
|
+
background: "#eee",
|
|
14
|
+
color: "#666",
|
|
15
|
+
src: "",
|
|
16
|
+
alt: ""
|
|
17
|
+
};
|
|
18
|
+
const classPrefix = `nut-avatar`;
|
|
19
|
+
const Avatar = (props) => {
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
21
|
+
const { children, size, shape, background, color, src, icon, fit, alt, className, style, onClick, onError, ...rest } = {
|
|
22
|
+
...defaultProps,
|
|
23
|
+
...props
|
|
24
|
+
};
|
|
25
|
+
const [maxSum, setMaxSum] = useState(0);
|
|
26
|
+
const [showMax, setShowMax] = useState(false);
|
|
27
|
+
const [avatarIndex, setAvatarIndex] = useState(1);
|
|
28
|
+
const avatarRef = useRef(null);
|
|
29
|
+
const parent = useContext(AvatarContext);
|
|
30
|
+
const sizeValue = ["large", "normal", "small"];
|
|
31
|
+
const classes = classNames({
|
|
32
|
+
[`nut-avatar-${((_a = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _a.size) || size || "normal"}`]: true,
|
|
33
|
+
[`nut-avatar-${((_b = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _b.shape) || shape}`]: true
|
|
34
|
+
});
|
|
35
|
+
const cls = classNames(classPrefix, classes, className);
|
|
36
|
+
const styles = {
|
|
37
|
+
width: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
|
|
38
|
+
height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
|
|
39
|
+
backgroundColor: `${background}`,
|
|
40
|
+
color: `${color}`,
|
|
41
|
+
marginLeft: avatarIndex !== 1 && ((_c = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c.gap) ? `${(_d = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _d.gap}px` : "",
|
|
42
|
+
zIndex: ((_e = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _e.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "",
|
|
43
|
+
...style
|
|
44
|
+
};
|
|
45
|
+
const maxStyles = {
|
|
46
|
+
backgroundColor: `${(_f = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _f.maxBackground}`,
|
|
47
|
+
color: `${(_g = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _g.maxColor}`
|
|
48
|
+
};
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
var _a2;
|
|
51
|
+
const avatarChildren = (_a2 = parent == null ? void 0 : parent.avatarGroupRef) == null ? void 0 : _a2.current.children;
|
|
52
|
+
if (avatarChildren) {
|
|
53
|
+
avatarLength(avatarChildren);
|
|
54
|
+
}
|
|
55
|
+
}, []);
|
|
56
|
+
const avatarLength = (children2) => {
|
|
57
|
+
var _a2, _b2, _c2;
|
|
58
|
+
for (let i = 0; i < children2.length; i++) {
|
|
59
|
+
if (children2[i] && children2[i].classList && (children2[i].classList[0] === "nut-avatar" || children2[i].classList.values().next().value === "nut-avatar")) {
|
|
60
|
+
children2[i].setAttribute("data-index", i + 1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const index = (_b2 = (_a2 = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a2.dataset) == null ? void 0 : _b2.index;
|
|
64
|
+
const maxCount = (_c2 = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c2.max;
|
|
65
|
+
setMaxSum(children2.length);
|
|
66
|
+
setAvatarIndex(index);
|
|
67
|
+
if (index === children2.length && index !== maxCount && children2.length > maxCount) {
|
|
68
|
+
setShowMax(true);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const errorEvent = () => {
|
|
72
|
+
if (props.onError) {
|
|
73
|
+
props.onError();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const clickAvatar = (e) => {
|
|
77
|
+
onClick && onClick(e);
|
|
78
|
+
};
|
|
79
|
+
return React.createElement(React.Fragment, null, (showMax || !((_h = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _h.max) || avatarIndex <= ((_i = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _i.max)) && React.createElement(
|
|
80
|
+
"div",
|
|
81
|
+
{ className: cls, ...rest, style: !showMax ? styles : maxStyles, onClick: clickAvatar, ref: avatarRef },
|
|
82
|
+
(!((_j = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _j.max) || avatarIndex <= ((_k = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _k.max)) && React.createElement(
|
|
83
|
+
React.Fragment,
|
|
84
|
+
null,
|
|
85
|
+
src && React.createElement(Image, { className: "avatar-img", src, style: { objectFit: fit }, alt, onError: errorEvent }),
|
|
86
|
+
React.isValidElement(icon) ? React.cloneElement(icon, {
|
|
87
|
+
...icon.props,
|
|
88
|
+
className: `${icon.props.className || ""} icon`
|
|
89
|
+
}) : null,
|
|
90
|
+
children && React.createElement("span", { className: "text" }, children),
|
|
91
|
+
!src && !icon && !children && React.createElement(My, { className: "icon" })
|
|
92
|
+
),
|
|
93
|
+
showMax && React.createElement("div", { className: "text" }, ((_l = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _l.maxContent) ? (_m = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _m.maxContent : `+ ${avatarIndex - ((_n = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _n.max)}`)
|
|
94
|
+
));
|
|
95
|
+
};
|
|
96
|
+
Avatar.defaultProps = defaultProps;
|
|
97
|
+
Avatar.displayName = "NutAvatar";
|
|
98
|
+
export {
|
|
99
|
+
Avatar as A
|
|
100
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { A as AvatarContext } from "./context-d0fccf11.js";
|
|
4
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
...ComponentDefaults,
|
|
7
|
+
maxContent: "",
|
|
8
|
+
max: "",
|
|
9
|
+
maxBackground: "#eee",
|
|
10
|
+
maxColor: "#666",
|
|
11
|
+
gap: "-8",
|
|
12
|
+
level: "left"
|
|
13
|
+
};
|
|
14
|
+
const classPrefix = `nut-avatar-group`;
|
|
15
|
+
const AvatarGroup = (props) => {
|
|
16
|
+
const propAvatarGroup = { ...defaultProps, ...props };
|
|
17
|
+
const { className, style, children } = propAvatarGroup;
|
|
18
|
+
const avatarGroupRef = useRef(null);
|
|
19
|
+
const cls = classNames(classPrefix, className);
|
|
20
|
+
const parentAvatar = {
|
|
21
|
+
propAvatarGroup,
|
|
22
|
+
avatarGroupRef
|
|
23
|
+
};
|
|
24
|
+
return React.createElement(
|
|
25
|
+
AvatarContext.Provider,
|
|
26
|
+
{ value: parentAvatar },
|
|
27
|
+
React.createElement("div", { className: cls, style, ref: avatarGroupRef }, children)
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
AvatarGroup.defaultProps = defaultProps;
|
|
31
|
+
AvatarGroup.displayName = "NutAvatarGroup";
|
|
32
|
+
export {
|
|
33
|
+
AvatarGroup as A
|
|
34
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { usePageScroll, pageScrollTo } from "@tarojs/taro";
|
|
3
|
+
import { Top } from "@nutui/icons-react-taro";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
6
|
+
const defaultProps = {
|
|
7
|
+
...ComponentDefaults,
|
|
8
|
+
threshold: 200,
|
|
9
|
+
zIndex: 10,
|
|
10
|
+
duration: 1e3
|
|
11
|
+
};
|
|
12
|
+
const BackTop = (props) => {
|
|
13
|
+
const { children, threshold, zIndex, className, duration, style, onClick } = {
|
|
14
|
+
...defaultProps,
|
|
15
|
+
...props
|
|
16
|
+
};
|
|
17
|
+
const classPrefix = "nut-backtop";
|
|
18
|
+
const [backTop, SetBackTop] = useState(false);
|
|
19
|
+
usePageScroll((res) => {
|
|
20
|
+
const { scrollTop } = res;
|
|
21
|
+
scrollTop >= threshold ? SetBackTop(true) : SetBackTop(false);
|
|
22
|
+
});
|
|
23
|
+
const goTop = (e) => {
|
|
24
|
+
onClick && onClick(e);
|
|
25
|
+
pageScrollTo({
|
|
26
|
+
scrollTop: 0,
|
|
27
|
+
duration: duration > 0 ? duration : 0
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const styles = style ? {
|
|
31
|
+
zIndex,
|
|
32
|
+
...style
|
|
33
|
+
} : {
|
|
34
|
+
right: "10px",
|
|
35
|
+
bottom: "20px",
|
|
36
|
+
zIndex
|
|
37
|
+
};
|
|
38
|
+
return React.createElement("div", { className: classNames(classPrefix, className, {
|
|
39
|
+
show: backTop
|
|
40
|
+
}), style: styles, onClick: (e) => {
|
|
41
|
+
goTop(e);
|
|
42
|
+
} }, children || React.createElement(Top, { width: 19, height: 19, className: "nut-backtop-main" }));
|
|
43
|
+
};
|
|
44
|
+
BackTop.defaultProps = defaultProps;
|
|
45
|
+
BackTop.displayName = "NutBackTop";
|
|
46
|
+
export {
|
|
47
|
+
BackTop as B
|
|
48
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
4
|
+
const defaultProps = {
|
|
5
|
+
...ComponentDefaults,
|
|
6
|
+
value: "",
|
|
7
|
+
dot: false,
|
|
8
|
+
max: 99,
|
|
9
|
+
top: "0",
|
|
10
|
+
right: "5",
|
|
11
|
+
color: ""
|
|
12
|
+
};
|
|
13
|
+
const Badge = (props) => {
|
|
14
|
+
const { className, style, value, max, children, dot, top, right, color } = {
|
|
15
|
+
...defaultProps,
|
|
16
|
+
...props
|
|
17
|
+
};
|
|
18
|
+
const classPrefix = "nut-badge";
|
|
19
|
+
const classes = classNames(classPrefix, className);
|
|
20
|
+
const contentClasses = classNames({ [`${classPrefix}__dot`]: dot }, `${classPrefix}__content`, `${classPrefix}__sup`);
|
|
21
|
+
function content() {
|
|
22
|
+
if (dot || typeof value === "object")
|
|
23
|
+
return null;
|
|
24
|
+
if (typeof value === "number" && typeof max === "number") {
|
|
25
|
+
return max < value ? `${max}+` : value;
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
const getStyle = () => {
|
|
30
|
+
const style2 = {};
|
|
31
|
+
style2.top = `${Number(top) || parseFloat(top) || 0}px`;
|
|
32
|
+
style2.right = `${Number(right) || parseFloat(right) || 0}px`;
|
|
33
|
+
style2.background = color;
|
|
34
|
+
return style2;
|
|
35
|
+
};
|
|
36
|
+
return React.createElement(
|
|
37
|
+
"div",
|
|
38
|
+
{ className: classes, style },
|
|
39
|
+
typeof value === "object" && value && React.createElement("div", { className: `${classPrefix}__icon` }, value),
|
|
40
|
+
React.createElement("div", null, children),
|
|
41
|
+
React.createElement("div", { className: contentClasses, style: getStyle() }, content())
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
Badge.defaultProps = defaultProps;
|
|
45
|
+
Badge.displayName = "NutBadge";
|
|
46
|
+
export {
|
|
47
|
+
Badge as B
|
|
48
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React, { useState, useRef, useImperativeHandle, useEffect } from "react";
|
|
2
|
+
import { createSelectorQuery } from "@tarojs/taro";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { c as cn } from "./bem-cdccae08.js";
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
barrageList: [],
|
|
7
|
+
frequency: 500,
|
|
8
|
+
loop: true,
|
|
9
|
+
speeds: 3e3,
|
|
10
|
+
rows: 3,
|
|
11
|
+
top: 10
|
|
12
|
+
};
|
|
13
|
+
const InternalBarrage = (props, ref) => {
|
|
14
|
+
const { className, frequency, loop, barrageList, speeds, rows, top, ...restProps } = {
|
|
15
|
+
...defaultProps,
|
|
16
|
+
...props
|
|
17
|
+
};
|
|
18
|
+
const [styleList, setStyleList] = useState([]);
|
|
19
|
+
const [baItemList, setBaItemList] = useState(barrageList);
|
|
20
|
+
const barrageListSet = useRef(barrageList);
|
|
21
|
+
const barrageBody = useRef(null);
|
|
22
|
+
const barrageContainer = useRef(null);
|
|
23
|
+
const timeId = useRef((/* @__PURE__ */ new Date()).getTime());
|
|
24
|
+
const timer = useRef(0);
|
|
25
|
+
useRef(0);
|
|
26
|
+
const b = cn("barrage");
|
|
27
|
+
const classes = classNames(className, b(""), {
|
|
28
|
+
[`nut-barrage__body${timeId.current}`]: true
|
|
29
|
+
});
|
|
30
|
+
useImperativeHandle(ref, () => ({
|
|
31
|
+
add: (word) => {
|
|
32
|
+
barrageListSet.current = [...barrageListSet.current, word];
|
|
33
|
+
run();
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
barrageListSet.current = [...barrageList];
|
|
38
|
+
run();
|
|
39
|
+
return () => {
|
|
40
|
+
clearInterval(timer.current);
|
|
41
|
+
};
|
|
42
|
+
}, [barrageList]);
|
|
43
|
+
const run = () => {
|
|
44
|
+
setBaItemList(barrageListSet.current);
|
|
45
|
+
barrageListSet.current.forEach((item, index2) => {
|
|
46
|
+
getNode(index2);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const getNode = (index2) => {
|
|
50
|
+
const query = createSelectorQuery();
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
let width = 100;
|
|
53
|
+
query.select(".nut-barrage__body" + timeId.current).boundingClientRect((rec) => {
|
|
54
|
+
width = rec.width || 300;
|
|
55
|
+
});
|
|
56
|
+
query.select(".nut-barrage__item" + index2).boundingClientRect((recs) => {
|
|
57
|
+
let height = recs.height;
|
|
58
|
+
let nodeTop = index2 % rows * (height + top) + 20 + "px";
|
|
59
|
+
styleInfo(index2, nodeTop, width);
|
|
60
|
+
}).exec();
|
|
61
|
+
}, 500);
|
|
62
|
+
};
|
|
63
|
+
const styleInfo = (index2, nodeTop, width) => {
|
|
64
|
+
let timeIndex = index2 - rows > 0 ? index2 - rows : 0;
|
|
65
|
+
let list = styleList;
|
|
66
|
+
let time = list[timeIndex] ? Number(list[timeIndex]["--time"]) : 0;
|
|
67
|
+
let obj = {
|
|
68
|
+
top: nodeTop,
|
|
69
|
+
"--time": `${frequency * index2 + time}`,
|
|
70
|
+
animationDuration: `${speeds}ms`,
|
|
71
|
+
animationIterationCount: `${loop ? "infinite" : 1}`,
|
|
72
|
+
animationDelay: `${frequency * index2 + time}ms`,
|
|
73
|
+
"--move-distance": `-${width}px`
|
|
74
|
+
};
|
|
75
|
+
list.push(obj);
|
|
76
|
+
setStyleList([...list]);
|
|
77
|
+
};
|
|
78
|
+
return React.createElement(
|
|
79
|
+
"div",
|
|
80
|
+
{ className: classes, ref: barrageBody, ...restProps },
|
|
81
|
+
React.createElement("div", { ref: barrageContainer, className: "bContainer" }, baItemList.map((item, index2) => {
|
|
82
|
+
return React.createElement("div", { className: `barrage-item nut-barrage__item${index2} move`, style: styleList[index2] }, item.length > 8 ? item.substr(0, 8) + "..." : item);
|
|
83
|
+
}))
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
const Barrage = React.forwardRef(InternalBarrage);
|
|
87
|
+
Barrage.defaultProps = defaultProps;
|
|
88
|
+
Barrage.displayName = "NutBarrage";
|
|
89
|
+
export {
|
|
90
|
+
Barrage as B
|
|
91
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { Loading } from "@nutui/icons-react-taro";
|
|
4
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
5
|
+
const prefixCls = "nut-button";
|
|
6
|
+
const defaultProps = {
|
|
7
|
+
...ComponentDefaults,
|
|
8
|
+
color: "",
|
|
9
|
+
type: "default",
|
|
10
|
+
size: "normal",
|
|
11
|
+
shape: "round",
|
|
12
|
+
fill: "solid",
|
|
13
|
+
loading: false,
|
|
14
|
+
disabled: false,
|
|
15
|
+
block: false,
|
|
16
|
+
icon: null,
|
|
17
|
+
onClick: (e) => {
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const Button = React.forwardRef((props, ref) => {
|
|
21
|
+
const { color, shape, fill, loading, disabled, type, size, block, icon, children, onClick, className, style, ...rest } = {
|
|
22
|
+
...defaultProps,
|
|
23
|
+
...props
|
|
24
|
+
};
|
|
25
|
+
const getStyle = useCallback(() => {
|
|
26
|
+
const style2 = {};
|
|
27
|
+
if (props.color) {
|
|
28
|
+
if (fill && fill === "outline") {
|
|
29
|
+
style2.color = color;
|
|
30
|
+
style2.background = "#fff";
|
|
31
|
+
if (!(color == null ? void 0 : color.includes("gradient"))) {
|
|
32
|
+
style2.borderColor = color;
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
style2.color = "#fff";
|
|
36
|
+
style2.background = color;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return style2;
|
|
40
|
+
}, [color]);
|
|
41
|
+
const handleClick = (e) => {
|
|
42
|
+
if (!loading && !disabled && onClick) {
|
|
43
|
+
onClick(e);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return (
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
// eslint-disable-next-line react/button-has-type
|
|
50
|
+
React.createElement(
|
|
51
|
+
"button",
|
|
52
|
+
{ ...rest, ref, className: classNames(prefixCls, className, props.type ? `${prefixCls}--${type}` : null, props.fill ? `${prefixCls}--${fill}` : null, {
|
|
53
|
+
[`${prefixCls}--${size}`]: size,
|
|
54
|
+
[`${prefixCls}--${shape}`]: shape,
|
|
55
|
+
[`${prefixCls}--block`]: block,
|
|
56
|
+
[`${prefixCls}--disabled`]: disabled,
|
|
57
|
+
[`${prefixCls}--loading`]: loading
|
|
58
|
+
}), style: { ...getStyle(), ...style }, onClick: (e) => handleClick(e) },
|
|
59
|
+
React.createElement(
|
|
60
|
+
"div",
|
|
61
|
+
{ className: "nut-button__warp" },
|
|
62
|
+
loading && React.createElement(Loading, { className: "nut-icon-loading" }),
|
|
63
|
+
!loading && icon ? icon : null,
|
|
64
|
+
children && React.createElement("div", { className: icon || loading ? "nut-button-text" : "" }, children)
|
|
65
|
+
)
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
Button.displayName = "NutButton";
|
|
70
|
+
export {
|
|
71
|
+
Button as B
|
|
72
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
|
+
import { P as Popup } from "./popup.taro-e756f3fc.js";
|
|
3
|
+
import { U as Utils, C as CalendarItem } from "./calendaritem.taro-3e5f114e.js";
|
|
4
|
+
import { u as useConfig } from "./configprovider.taro-25758d9f.js";
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
type: "one",
|
|
7
|
+
isAutoBackFill: false,
|
|
8
|
+
poppable: true,
|
|
9
|
+
visible: false,
|
|
10
|
+
title: "",
|
|
11
|
+
defaultValue: "",
|
|
12
|
+
startDate: Utils.getDay(0),
|
|
13
|
+
endDate: Utils.getDay(365),
|
|
14
|
+
showToday: true,
|
|
15
|
+
startText: "",
|
|
16
|
+
endText: "",
|
|
17
|
+
confirmText: "",
|
|
18
|
+
showTitle: true,
|
|
19
|
+
showSubTitle: true,
|
|
20
|
+
toDateAnimation: true,
|
|
21
|
+
onBtn: void 0,
|
|
22
|
+
onDay: void 0,
|
|
23
|
+
onTopInfo: void 0,
|
|
24
|
+
onBottomInfo: void 0,
|
|
25
|
+
onClose: () => {
|
|
26
|
+
},
|
|
27
|
+
onChoose: (param) => {
|
|
28
|
+
},
|
|
29
|
+
onSelected: (data) => {
|
|
30
|
+
},
|
|
31
|
+
onYearMonthChange: (param) => {
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const Calendar = React.forwardRef((props, ref) => {
|
|
35
|
+
const { locale } = useConfig();
|
|
36
|
+
const { children, poppable, visible, type, isAutoBackFill, title, defaultValue, startDate, endDate, showToday, startText, endText, confirmText, showTitle, showSubTitle, toDateAnimation, onBtn, onDay, onTopInfo, onBottomInfo, onClose, onChoose, onSelected, onYearMonthChange } = { ...defaultProps, ...props };
|
|
37
|
+
const calendarRef = useRef(null);
|
|
38
|
+
const close = () => {
|
|
39
|
+
onClose && onClose();
|
|
40
|
+
};
|
|
41
|
+
const choose = (param) => {
|
|
42
|
+
close();
|
|
43
|
+
onChoose && onChoose(param);
|
|
44
|
+
};
|
|
45
|
+
const closePopup = () => {
|
|
46
|
+
close();
|
|
47
|
+
};
|
|
48
|
+
const select = (param) => {
|
|
49
|
+
onSelected && onSelected(param);
|
|
50
|
+
};
|
|
51
|
+
const scrollToDate = (date) => {
|
|
52
|
+
var _a;
|
|
53
|
+
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date);
|
|
54
|
+
};
|
|
55
|
+
const yearMonthChange = (param) => {
|
|
56
|
+
onYearMonthChange && onYearMonthChange(param);
|
|
57
|
+
};
|
|
58
|
+
React.useImperativeHandle(ref, () => ({
|
|
59
|
+
scrollToDate
|
|
60
|
+
}));
|
|
61
|
+
const renderItem = () => {
|
|
62
|
+
return React.createElement(CalendarItem, { ref: calendarRef, type, isAutoBackFill, poppable, title: title || locale.calendaritem.title, defaultValue, startDate, endDate, showToday, startText: startText || locale.calendaritem.start, endText: endText || locale.calendaritem.end, confirmText: confirmText || locale.calendaritem.confirm, showTitle, showSubTitle, toDateAnimation, onBtn, onDay, onTopInfo, onBottomInfo, onChoose: choose, onSelected: select, onYearMonthChange: yearMonthChange });
|
|
63
|
+
};
|
|
64
|
+
return React.createElement(React.Fragment, null, poppable ? React.createElement(Popup, { visible, position: "bottom", round: true, duration: 0.5, closeable: true, destroyOnClose: true, onClickOverlay: closePopup, onClickCloseIcon: closePopup, style: { height: "85vh" } }, renderItem()) : renderItem());
|
|
65
|
+
});
|
|
66
|
+
Calendar.defaultProps = defaultProps;
|
|
67
|
+
Calendar.displayName = "NutCalendar";
|
|
68
|
+
export {
|
|
69
|
+
Calendar as C
|
|
70
|
+
};
|