@nutui/nutui-react-taro 2.0.0-alpha.1 → 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 +105 -0
- 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 -9
- 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 -13
- 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 -9
- package/dist/esm/SearchBar.js +11 -14
- package/dist/esm/ShortPassword.js +16 -19
- package/dist/esm/SideNavBar.js +14 -15
- 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 +16971 -22628
- package/dist/nutui.react.umd.js +17158 -22831
- package/dist/packages/badge/badge.scss +8 -18
- 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/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/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/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 +556 -704
- 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-10cc53ee.js +0 -53
- package/dist/esm/address.taro-632ca799.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-099cb4a2.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-62e764a7.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-a99a9171.js +0 -43
- 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-0f2bcf42.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-b88fcf41.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-ed9b2149.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-5028afcb.js +0 -423
- package/dist/esm/popover.taro-2a57eae4.js +0 -153
- package/dist/esm/popup.taro-020bf791.js +0 -139
- 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-75039d53.js +0 -48
- package/dist/esm/searchbar.taro-eef468bb.js +0 -152
- package/dist/esm/shortpassword.taro-681a33a1.js +0 -119
- package/dist/esm/sidenavbar.taro-d5c5b331.js +0 -33
- 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-a4b86771.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-2151eec6.js +0 -494
- 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,146 @@
|
|
|
1
|
+
import React, { useRef, useState, useEffect } from "react";
|
|
2
|
+
import { Tips } from "@nutui/icons-react-taro";
|
|
3
|
+
import { c as cn } from "./bem-cdccae08.js";
|
|
4
|
+
import { P as Popup } from "./popup.taro-e756f3fc.js";
|
|
5
|
+
import { u as useConfig } from "./configprovider.taro-25758d9f.js";
|
|
6
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
7
|
+
const defaultProps = {
|
|
8
|
+
...ComponentDefaults,
|
|
9
|
+
title: "",
|
|
10
|
+
description: "",
|
|
11
|
+
tips: "",
|
|
12
|
+
tipsIcon: null,
|
|
13
|
+
iconSize: 11,
|
|
14
|
+
visible: false,
|
|
15
|
+
modelValue: "",
|
|
16
|
+
errorMsg: "",
|
|
17
|
+
noButton: true,
|
|
18
|
+
closeOnClickOverlay: true,
|
|
19
|
+
length: 6,
|
|
20
|
+
className: "",
|
|
21
|
+
autoFocus: false,
|
|
22
|
+
onChange: (value) => {
|
|
23
|
+
},
|
|
24
|
+
onOk: (value) => {
|
|
25
|
+
},
|
|
26
|
+
onCancel: () => {
|
|
27
|
+
},
|
|
28
|
+
onClose: () => {
|
|
29
|
+
},
|
|
30
|
+
onTips: () => {
|
|
31
|
+
},
|
|
32
|
+
onComplete: (value) => {
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const ShortPassword = (props) => {
|
|
36
|
+
const { locale } = useConfig();
|
|
37
|
+
const { title, description, tips, tipsIcon, iconSize, visible, modelValue, errorMsg, noButton, closeOnClickOverlay, length, style, className, onChange, onOk, onTips, onCancel, onClose, onComplete, autoFocus, ...reset } = props;
|
|
38
|
+
const b = cn("shortpassword");
|
|
39
|
+
const textInput = useRef(null);
|
|
40
|
+
const range = (val) => {
|
|
41
|
+
return Math.min(Math.max(4, val), 6);
|
|
42
|
+
};
|
|
43
|
+
const [innerVisible, setInnerVisible] = useState(visible);
|
|
44
|
+
const [comLen, setComLen] = useState(range(Number(length)));
|
|
45
|
+
const [inputValue, setInputValue] = useState("");
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
setInnerVisible(visible);
|
|
48
|
+
}, [visible]);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (typeof modelValue !== "undefined") {
|
|
51
|
+
setInputValue(modelValue);
|
|
52
|
+
}
|
|
53
|
+
}, [modelValue]);
|
|
54
|
+
const changeValue = (e) => {
|
|
55
|
+
let inputValue2 = e.target.value;
|
|
56
|
+
if (String(inputValue2).length > comLen) {
|
|
57
|
+
inputValue2 = inputValue2.slice(0, comLen);
|
|
58
|
+
}
|
|
59
|
+
setInputValue(inputValue2);
|
|
60
|
+
if (String(inputValue2).length === comLen) {
|
|
61
|
+
onComplete && onComplete(inputValue2);
|
|
62
|
+
}
|
|
63
|
+
onChange && onChange(inputValue2);
|
|
64
|
+
};
|
|
65
|
+
const systemStyle = () => {
|
|
66
|
+
const u = navigator.userAgent;
|
|
67
|
+
const isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1;
|
|
68
|
+
const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
|
|
69
|
+
let style2 = {};
|
|
70
|
+
if (isIOS) {
|
|
71
|
+
style2 = {
|
|
72
|
+
paddingRight: "1200px"
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (isAndroid) {
|
|
76
|
+
style2 = {
|
|
77
|
+
opacity: 0,
|
|
78
|
+
zIndex: 10
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return style2;
|
|
82
|
+
};
|
|
83
|
+
const focus = () => {
|
|
84
|
+
if (textInput.current) {
|
|
85
|
+
textInput.current.focus();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const sure = () => {
|
|
89
|
+
onOk && onOk(inputValue);
|
|
90
|
+
};
|
|
91
|
+
const renderIcon = (size = "11px") => {
|
|
92
|
+
return React.isValidElement(tipsIcon) ? React.cloneElement(tipsIcon, {
|
|
93
|
+
...tipsIcon.props,
|
|
94
|
+
size
|
|
95
|
+
}) : React.createElement(Tips, { size });
|
|
96
|
+
};
|
|
97
|
+
return React.createElement(
|
|
98
|
+
"div",
|
|
99
|
+
null,
|
|
100
|
+
React.createElement(
|
|
101
|
+
Popup,
|
|
102
|
+
{ style: {
|
|
103
|
+
padding: "32px 24px 28px 24px",
|
|
104
|
+
borderRadius: "12px",
|
|
105
|
+
textAlign: "center"
|
|
106
|
+
}, visible: innerVisible, closeable: true, "close-on-click-overlay": closeOnClickOverlay, onClickOverlay: onClose, onClickCloseIcon: onClose },
|
|
107
|
+
React.createElement(
|
|
108
|
+
"div",
|
|
109
|
+
{ className: `${b()} ${className}`, style: { ...style }, ...reset },
|
|
110
|
+
React.createElement("div", { className: b("title") }, title || locale.shortpassword.title),
|
|
111
|
+
React.createElement("div", { className: b("subtitle") }, description || locale.shortpassword.description),
|
|
112
|
+
React.createElement(
|
|
113
|
+
"div",
|
|
114
|
+
{ className: b("input") },
|
|
115
|
+
React.createElement("input", { ref: textInput, className: b("input-real"), type: "number", style: systemStyle(), maxLength: 6, value: inputValue, autoFocus, onChange: (e) => changeValue(e) }),
|
|
116
|
+
React.createElement("div", { className: b("input-site") }),
|
|
117
|
+
React.createElement("div", { className: b("input-fake"), onClick: () => focus() }, [...new Array(comLen).keys()].map((item, index) => {
|
|
118
|
+
return React.createElement("div", { className: b("input-fake__li"), key: index }, String(inputValue).length > index ? React.createElement("div", { className: b("input-fake__li__icon") }) : null);
|
|
119
|
+
}))
|
|
120
|
+
),
|
|
121
|
+
React.createElement(
|
|
122
|
+
"div",
|
|
123
|
+
{ className: b("message") },
|
|
124
|
+
React.createElement("div", { className: b("message__error") }, errorMsg),
|
|
125
|
+
tips || locale.shortpassword.tips ? React.createElement(
|
|
126
|
+
"div",
|
|
127
|
+
{ className: b("message__forget") },
|
|
128
|
+
renderIcon(iconSize),
|
|
129
|
+
React.createElement("div", { className: b("message__forget-tips"), onClick: onTips }, tips || locale.shortpassword.tips)
|
|
130
|
+
) : null
|
|
131
|
+
),
|
|
132
|
+
!noButton ? React.createElement(
|
|
133
|
+
"div",
|
|
134
|
+
{ className: b("footer") },
|
|
135
|
+
React.createElement("div", { className: b("footer__cancel"), onClick: onCancel }, locale.cancel),
|
|
136
|
+
React.createElement("div", { className: b("footer__sure"), onClick: () => sure() }, locale.confirm)
|
|
137
|
+
) : null
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
ShortPassword.defaultProps = defaultProps;
|
|
143
|
+
ShortPassword.displayName = "NutShortPassword";
|
|
144
|
+
export {
|
|
145
|
+
ShortPassword as S
|
|
146
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { P as Popup } from "./popup.taro-e756f3fc.js";
|
|
3
|
+
import { O as OffsetContext } from "./offsetContext-f32a9246.js";
|
|
4
|
+
const defaultProps = {
|
|
5
|
+
showhead: false,
|
|
6
|
+
position: "left",
|
|
7
|
+
width: "80%"
|
|
8
|
+
};
|
|
9
|
+
const SideNavBar = (props) => {
|
|
10
|
+
const { title, visible, width, position, children, className, showhead, onClose, ...rest } = {
|
|
11
|
+
...defaultProps,
|
|
12
|
+
...props
|
|
13
|
+
};
|
|
14
|
+
const offset = props.offset ? Number(props.offset) : 20;
|
|
15
|
+
const [sidenavbarShow, setSidenavbarShow] = useState(true);
|
|
16
|
+
const handleClick = () => {
|
|
17
|
+
setSidenavbarShow(!sidenavbarShow);
|
|
18
|
+
};
|
|
19
|
+
return React.createElement(
|
|
20
|
+
Popup,
|
|
21
|
+
{ visible, style: { width, height: "100%" }, position, onClose },
|
|
22
|
+
React.createElement(
|
|
23
|
+
"div",
|
|
24
|
+
{ className: className ? `${className} nut-sidenavbar` : "nut-sidenavbar", ...rest },
|
|
25
|
+
React.createElement(
|
|
26
|
+
"div",
|
|
27
|
+
{ className: "nut-sidenavbar__content" },
|
|
28
|
+
React.createElement(
|
|
29
|
+
"div",
|
|
30
|
+
{ className: `nut-sidenavbar__list ${sidenavbarShow ? "nutShow" : "nutHide"}`, onClick: handleClick },
|
|
31
|
+
React.createElement(
|
|
32
|
+
"div",
|
|
33
|
+
{ className: "nut-sidenavbar__title border-bt ", style: { paddingLeft: `${offset}px` } },
|
|
34
|
+
title,
|
|
35
|
+
React.createElement("i", { className: `arrow-icon ${sidenavbarShow ? "arrow-up" : "arrow-down"}` })
|
|
36
|
+
),
|
|
37
|
+
React.createElement(
|
|
38
|
+
OffsetContext.Provider,
|
|
39
|
+
{ value: offset },
|
|
40
|
+
React.createElement("div", { className: "nut-sidenavbar__content" }, children)
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
SideNavBar.defaultProps = defaultProps;
|
|
48
|
+
SideNavBar.displayName = "NutSideNavBar";
|
|
49
|
+
export {
|
|
50
|
+
SideNavBar as S
|
|
51
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const SideNavBarItem = (props) => {
|
|
3
|
+
const { title, key, children, onClick, ...rest } = props;
|
|
4
|
+
const clickFn = (e) => {
|
|
5
|
+
e.stopPropagation();
|
|
6
|
+
onClick && onClick({ title, key });
|
|
7
|
+
};
|
|
8
|
+
return React.createElement("div", { className: "nut-subsidenavbar__item border-bt", onClick: clickFn, ...rest }, title);
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
SideNavBarItem as S
|
|
12
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import React, { useRef, useState, useEffect } from "react";
|
|
2
|
+
import { getEnv, nextTick, createSelectorQuery, canvasToTempFilePath } from "@tarojs/taro";
|
|
3
|
+
import { B as Button } from "./button.taro-01eae688.js";
|
|
4
|
+
import { c as cn } from "./bem-cdccae08.js";
|
|
5
|
+
import { u as useConfig } from "./configprovider.taro-25758d9f.js";
|
|
6
|
+
const defaultProps = {
|
|
7
|
+
canvasId: "spcanvas",
|
|
8
|
+
type: "png",
|
|
9
|
+
lineWidth: 2,
|
|
10
|
+
strokeStyle: "#000",
|
|
11
|
+
className: ""
|
|
12
|
+
};
|
|
13
|
+
const Signature = (props) => {
|
|
14
|
+
const { locale } = useConfig();
|
|
15
|
+
const { canvasId, type, lineWidth, strokeStyle, unSupportTpl, className, confirm, clear, onConfirm, onClear, ...rest } = {
|
|
16
|
+
...defaultProps,
|
|
17
|
+
...props
|
|
18
|
+
};
|
|
19
|
+
const b = cn("signature");
|
|
20
|
+
const canvasRef = useRef(null);
|
|
21
|
+
const wrapRef = useRef(null);
|
|
22
|
+
const [canvasHeight, setCanvasHeight] = useState(0);
|
|
23
|
+
const [canvasWidth, setCanvasWidth] = useState(0);
|
|
24
|
+
const ctx = useRef(null);
|
|
25
|
+
const [disalbeScroll] = useState("true");
|
|
26
|
+
const startEventHandler = (event) => {
|
|
27
|
+
if (ctx.current) {
|
|
28
|
+
ctx.current.beginPath();
|
|
29
|
+
ctx.current.lineWidth = lineWidth;
|
|
30
|
+
ctx.current.strokeStyle = strokeStyle;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const moveEventHandler = (event) => {
|
|
34
|
+
if (ctx.current) {
|
|
35
|
+
const evt = event.changedTouches[0];
|
|
36
|
+
let mouseX = evt.x || evt.clientX;
|
|
37
|
+
let mouseY = evt.y || evt.clientY;
|
|
38
|
+
if (getEnv() === "WEB" && canvasRef.current) {
|
|
39
|
+
const coverPos = canvasRef.current.getBoundingClientRect();
|
|
40
|
+
mouseX = evt.clientX - coverPos.left;
|
|
41
|
+
mouseY = evt.clientY - coverPos.top;
|
|
42
|
+
}
|
|
43
|
+
nextTick(() => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
(_a = ctx.current) == null ? void 0 : _a.lineTo(mouseX, mouseY);
|
|
46
|
+
(_b = ctx.current) == null ? void 0 : _b.stroke();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const endEventHandler = (event) => {
|
|
51
|
+
};
|
|
52
|
+
const handleClearBtn = () => {
|
|
53
|
+
if (ctx.current) {
|
|
54
|
+
ctx.current.clearRect(0, 0, canvasWidth, canvasHeight);
|
|
55
|
+
ctx.current.closePath();
|
|
56
|
+
}
|
|
57
|
+
clear && clear();
|
|
58
|
+
onClear && onClear();
|
|
59
|
+
};
|
|
60
|
+
const handleConfirmBtn = () => {
|
|
61
|
+
onSave();
|
|
62
|
+
};
|
|
63
|
+
const onSave = () => {
|
|
64
|
+
createSelectorQuery().select(`#${canvasId}`).fields({
|
|
65
|
+
node: true,
|
|
66
|
+
size: true
|
|
67
|
+
}).exec((res) => {
|
|
68
|
+
canvasToTempFilePath({
|
|
69
|
+
canvas: res[0].node,
|
|
70
|
+
fileType: props.type,
|
|
71
|
+
canvasId: `${canvasId}`,
|
|
72
|
+
success: (res2) => {
|
|
73
|
+
handleClearBtn();
|
|
74
|
+
confirm && confirm(res2.tempFilePath);
|
|
75
|
+
onConfirm && onConfirm(res2.tempFilePath);
|
|
76
|
+
},
|
|
77
|
+
fail: (res2) => {
|
|
78
|
+
console.log("保存失败");
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
const canvasSetting = (canvasDom, width, height) => {
|
|
84
|
+
const canvas = canvasDom;
|
|
85
|
+
canvas.current = canvas;
|
|
86
|
+
ctx.current = canvas.getContext("2d");
|
|
87
|
+
setCanvasWidth(width);
|
|
88
|
+
setCanvasHeight(height);
|
|
89
|
+
canvas.width = width;
|
|
90
|
+
canvas.height = height;
|
|
91
|
+
if (ctx.current) {
|
|
92
|
+
ctx.current.clearRect(0, 0, width, height);
|
|
93
|
+
ctx.current.beginPath();
|
|
94
|
+
ctx.current.lineWidth = lineWidth;
|
|
95
|
+
ctx.current.strokeStyle = strokeStyle;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const initCanvas = () => {
|
|
99
|
+
nextTick(() => {
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
if (getEnv() === "WEAPP" || getEnv() === "JD") {
|
|
102
|
+
createSelectorQuery().select(`#${canvasId}`).fields({
|
|
103
|
+
node: true,
|
|
104
|
+
size: true
|
|
105
|
+
}, (res) => {
|
|
106
|
+
const { node, width, height } = res;
|
|
107
|
+
canvasSetting(node, width, height);
|
|
108
|
+
}).exec();
|
|
109
|
+
} else {
|
|
110
|
+
const canvasDom = document.getElementById(`${canvasId}`);
|
|
111
|
+
let canvas = canvasDom;
|
|
112
|
+
if ((canvasDom == null ? void 0 : canvasDom.tagName) !== "CANVAS") {
|
|
113
|
+
canvas = canvasDom == null ? void 0 : canvasDom.getElementsByTagName("canvas")[0];
|
|
114
|
+
}
|
|
115
|
+
canvasSetting(canvas, canvasDom == null ? void 0 : canvasDom.offsetWidth, canvasDom == null ? void 0 : canvasDom.offsetHeight);
|
|
116
|
+
}
|
|
117
|
+
}, 1e3);
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
initCanvas();
|
|
122
|
+
}, []);
|
|
123
|
+
return React.createElement(
|
|
124
|
+
"div",
|
|
125
|
+
{ className: `${b()} ${className}`, ...rest },
|
|
126
|
+
React.createElement("div", { className: `${b("inner")} spcanvas_WEAPP`, ref: wrapRef }, getEnv() === "WEAPP" || getEnv() === "JD" ? React.createElement("canvas", {
|
|
127
|
+
id: canvasId,
|
|
128
|
+
ref: canvasRef,
|
|
129
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
130
|
+
// @ts-ignore
|
|
131
|
+
canvasId,
|
|
132
|
+
disalbeScroll: true,
|
|
133
|
+
type: "2d",
|
|
134
|
+
onTouchStart: startEventHandler,
|
|
135
|
+
onTouchMove: moveEventHandler,
|
|
136
|
+
onTouchEnd: endEventHandler
|
|
137
|
+
}) : React.createElement("canvas", { id: canvasId, ref: canvasRef, "canvas-id": canvasId, "disalbe-scroll": disalbeScroll, onTouchStart: startEventHandler, onTouchMove: moveEventHandler, onTouchEnd: endEventHandler, onTouchCancel: endEventHandler })),
|
|
138
|
+
React.createElement(Button, { className: `${b("btn")}`, type: "default", onClick: () => handleClearBtn() }, locale.signature.reSign),
|
|
139
|
+
React.createElement(Button, { className: `${b("btn")}`, type: "primary", onClick: () => handleConfirmBtn() }, locale.confirm)
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
Signature.defaultProps = defaultProps;
|
|
143
|
+
Signature.displayName = "NutSignature";
|
|
144
|
+
export {
|
|
145
|
+
Signature as S
|
|
146
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { A as Avatar } from "./avatar.taro-01536aff.js";
|
|
4
|
+
import { c as cn } from "./bem-cdccae08.js";
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
width: "100px",
|
|
7
|
+
height: "100px",
|
|
8
|
+
row: 1,
|
|
9
|
+
animated: false,
|
|
10
|
+
title: false,
|
|
11
|
+
avatar: false,
|
|
12
|
+
round: false,
|
|
13
|
+
avatarSize: "50px",
|
|
14
|
+
loading: false,
|
|
15
|
+
avatarShape: "round"
|
|
16
|
+
};
|
|
17
|
+
const Skeleton = (props) => {
|
|
18
|
+
const { className, width, height, animated, row, title, avatar, avatarSize, round, loading, children, avatarShape, ...restProps } = {
|
|
19
|
+
...defaultProps,
|
|
20
|
+
...props
|
|
21
|
+
};
|
|
22
|
+
const b = cn("skeleton");
|
|
23
|
+
const classes = classNames(className, b());
|
|
24
|
+
const blockClass = classNames({
|
|
25
|
+
blockClass: true,
|
|
26
|
+
"blockClass--round": round
|
|
27
|
+
});
|
|
28
|
+
const avatarClass = classNames({
|
|
29
|
+
avatarClass: true,
|
|
30
|
+
[`avatarClass--${avatarShape}`]: avatarShape
|
|
31
|
+
});
|
|
32
|
+
const repeatLines = (num) => {
|
|
33
|
+
return Array.from({ length: num }, (v, i) => i);
|
|
34
|
+
};
|
|
35
|
+
const getStyle = () => {
|
|
36
|
+
if (avatarSize) {
|
|
37
|
+
return {
|
|
38
|
+
width: avatarSize,
|
|
39
|
+
height: avatarSize
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
width: "50px",
|
|
44
|
+
height: "50px"
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
return React.createElement(React.Fragment, null, loading ? React.createElement("div", null, children) : React.createElement(
|
|
48
|
+
"div",
|
|
49
|
+
{ className: classes, ...restProps },
|
|
50
|
+
animated && React.createElement("div", { className: "skeleton-animation" }),
|
|
51
|
+
React.createElement(
|
|
52
|
+
"div",
|
|
53
|
+
{ className: "nut-skeleton-content" },
|
|
54
|
+
avatar && React.createElement(Avatar, { className: avatarClass, background: "rgb(239, 239, 239)", shape: avatarShape, style: getStyle() }),
|
|
55
|
+
row === 1 && React.createElement("div", { className: blockClass, style: { width, height } }),
|
|
56
|
+
React.createElement(
|
|
57
|
+
"div",
|
|
58
|
+
{ className: "skeleton-content-line" },
|
|
59
|
+
title && React.createElement("div", { className: "skeleton-title" }),
|
|
60
|
+
repeatLines(row).map((item, index) => {
|
|
61
|
+
return React.createElement("div", { className: blockClass, key: index, style: { width, height } });
|
|
62
|
+
})
|
|
63
|
+
)
|
|
64
|
+
)
|
|
65
|
+
));
|
|
66
|
+
};
|
|
67
|
+
Skeleton.defaultProps = defaultProps;
|
|
68
|
+
Skeleton.displayName = "NutSkeleton";
|
|
69
|
+
export {
|
|
70
|
+
Skeleton as S
|
|
71
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { D as DataContext } from "./context-ab42ba7f.js";
|
|
4
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
...ComponentDefaults,
|
|
7
|
+
title: "",
|
|
8
|
+
description: "",
|
|
9
|
+
value: 0,
|
|
10
|
+
icon: null
|
|
11
|
+
};
|
|
12
|
+
const Step = (props) => {
|
|
13
|
+
const { children, title, description, value, icon, className, ...restProps } = {
|
|
14
|
+
...defaultProps,
|
|
15
|
+
...props
|
|
16
|
+
};
|
|
17
|
+
const parent = useContext(DataContext);
|
|
18
|
+
const dot = parent.propSteps.dot;
|
|
19
|
+
const getCurrentStatus = () => {
|
|
20
|
+
const index = value;
|
|
21
|
+
if (index < +parent.propSteps.value)
|
|
22
|
+
return "finish";
|
|
23
|
+
return index === +parent.propSteps.value ? "process" : "wait";
|
|
24
|
+
};
|
|
25
|
+
const handleClickStep = () => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
((_a = parent.propSteps) == null ? void 0 : _a.onStepClick) && ((_b = parent.propSteps) == null ? void 0 : _b.onStepClick(value));
|
|
28
|
+
};
|
|
29
|
+
const classPrefix = `nut-step`;
|
|
30
|
+
const classes = classNames({
|
|
31
|
+
[`${classPrefix}-${getCurrentStatus()}`]: true
|
|
32
|
+
}, className, classPrefix);
|
|
33
|
+
const renderIconClass = () => {
|
|
34
|
+
if (icon) {
|
|
35
|
+
return `${classPrefix}-icon is-icon`;
|
|
36
|
+
}
|
|
37
|
+
if (!dot && !icon) {
|
|
38
|
+
return `${classPrefix}-icon is-text`;
|
|
39
|
+
}
|
|
40
|
+
return `${classPrefix}-icon`;
|
|
41
|
+
};
|
|
42
|
+
return React.createElement(
|
|
43
|
+
"div",
|
|
44
|
+
{ className: classes, ...restProps, onClick: handleClickStep },
|
|
45
|
+
React.createElement(
|
|
46
|
+
"div",
|
|
47
|
+
{ className: "nut-step-head" },
|
|
48
|
+
React.createElement("div", { className: "nut-step-line" }),
|
|
49
|
+
React.createElement("div", { className: renderIconClass() }, icon || !dot && React.createElement("span", { className: "nut-step-inner" }, value))
|
|
50
|
+
),
|
|
51
|
+
React.createElement(
|
|
52
|
+
"div",
|
|
53
|
+
{ className: "nut-step-main" },
|
|
54
|
+
React.createElement("span", { className: "nut-step-title" }, title),
|
|
55
|
+
description && React.createElement("span", { className: "nut-step-description" }, description)
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
Step.defaultProps = defaultProps;
|
|
60
|
+
Step.displayName = "NutStep";
|
|
61
|
+
export {
|
|
62
|
+
Step as S
|
|
63
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { D as DataContext } from "./context-ab42ba7f.js";
|
|
4
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
...ComponentDefaults,
|
|
7
|
+
value: 0,
|
|
8
|
+
direction: "horizontal",
|
|
9
|
+
dot: false
|
|
10
|
+
};
|
|
11
|
+
const Steps = (props) => {
|
|
12
|
+
const propSteps = { ...defaultProps, ...props };
|
|
13
|
+
const { children, value, direction, className, dot, onStepClick, ...restProps } = propSteps;
|
|
14
|
+
const parentSteps = {
|
|
15
|
+
propSteps
|
|
16
|
+
};
|
|
17
|
+
const classPrefix = `nut-steps`;
|
|
18
|
+
const classes = classNames({
|
|
19
|
+
[`${classPrefix}-${direction}`]: true,
|
|
20
|
+
[`${classPrefix}-dot`]: !!props.dot
|
|
21
|
+
}, className, classPrefix);
|
|
22
|
+
return React.createElement(DataContext.Provider, { value: parentSteps }, React.createElement("div", {
|
|
23
|
+
className: classes,
|
|
24
|
+
...restProps
|
|
25
|
+
}, children));
|
|
26
|
+
};
|
|
27
|
+
Steps.defaultProps = defaultProps;
|
|
28
|
+
Steps.displayName = "NutSteps";
|
|
29
|
+
export {
|
|
30
|
+
Steps as S
|
|
31
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useState, useMemo, useCallback } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { getEnv, usePageScroll, getSystemInfoSync } from "@tarojs/taro";
|
|
4
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
5
|
+
import { g as getRectByTaro } from "./use-client-rect-f317804e.js";
|
|
6
|
+
import { c as canUseDom } from "./can-use-dom-0e539bd3.js";
|
|
7
|
+
function useWatch(dep, callback, config = { immediate: false }) {
|
|
8
|
+
const { immediate } = config;
|
|
9
|
+
const prev = useRef();
|
|
10
|
+
const inited = useRef(false);
|
|
11
|
+
const stop = useRef(false);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const execute = () => callback(prev.current);
|
|
14
|
+
if (!stop.current) {
|
|
15
|
+
if (!inited.current) {
|
|
16
|
+
inited.current = true;
|
|
17
|
+
if (immediate) {
|
|
18
|
+
execute();
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
execute();
|
|
22
|
+
}
|
|
23
|
+
prev.current = dep;
|
|
24
|
+
}
|
|
25
|
+
}, [dep]);
|
|
26
|
+
return () => {
|
|
27
|
+
stop.current = true;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const defaultRoot = canUseDom ? window : void 0;
|
|
31
|
+
const overflowStylePatterns = ["scroll", "auto", "overlay"];
|
|
32
|
+
function isElement(node) {
|
|
33
|
+
const ELEMENT_NODE_TYPE = 1;
|
|
34
|
+
return node.nodeType === ELEMENT_NODE_TYPE;
|
|
35
|
+
}
|
|
36
|
+
function getScrollParent(el, root = defaultRoot) {
|
|
37
|
+
let node = el;
|
|
38
|
+
while (node && node !== root && isElement(node)) {
|
|
39
|
+
if (node === document.body) {
|
|
40
|
+
return root;
|
|
41
|
+
}
|
|
42
|
+
const { overflowY } = window.getComputedStyle(node);
|
|
43
|
+
if (overflowStylePatterns.includes(overflowY) && node.scrollHeight > node.clientHeight) {
|
|
44
|
+
return node;
|
|
45
|
+
}
|
|
46
|
+
node = node.parentNode;
|
|
47
|
+
}
|
|
48
|
+
return root;
|
|
49
|
+
}
|
|
50
|
+
const defaultProps = {
|
|
51
|
+
...ComponentDefaults,
|
|
52
|
+
position: "top",
|
|
53
|
+
zIndex: 2e3
|
|
54
|
+
};
|
|
55
|
+
const classPrefix = "nut-sticky";
|
|
56
|
+
const Sticky = (props) => {
|
|
57
|
+
const { position, zIndex, threshold, style, children, container, className, onChange, ...rest } = { ...defaultProps, ...props };
|
|
58
|
+
const stickyRef = useRef(null);
|
|
59
|
+
const rootRef = useRef(null);
|
|
60
|
+
const [rootRect, setRootRect] = useState({});
|
|
61
|
+
const [fixed, setFixed] = useState(false);
|
|
62
|
+
const [transform, setTransform] = useState(0);
|
|
63
|
+
useWatch(fixed, () => {
|
|
64
|
+
onChange && onChange(fixed);
|
|
65
|
+
});
|
|
66
|
+
const rootStyle = useMemo(() => {
|
|
67
|
+
if (!fixed) {
|
|
68
|
+
return {
|
|
69
|
+
height: "",
|
|
70
|
+
width: ""
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const style2 = {};
|
|
74
|
+
if (rootRect.height) {
|
|
75
|
+
style2.height = rootRect.height;
|
|
76
|
+
}
|
|
77
|
+
if (rootRect.width) {
|
|
78
|
+
style2.width = rootRect.width;
|
|
79
|
+
}
|
|
80
|
+
return style2;
|
|
81
|
+
}, [fixed, rootRect.height, rootRect.width]);
|
|
82
|
+
const stickyStyle = useMemo(() => {
|
|
83
|
+
if (!fixed) {
|
|
84
|
+
return {
|
|
85
|
+
height: "",
|
|
86
|
+
width: "",
|
|
87
|
+
[position]: ""
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const style2 = {};
|
|
91
|
+
if (rootRect.height)
|
|
92
|
+
style2.height = rootRect.height;
|
|
93
|
+
if (rootRect.width)
|
|
94
|
+
style2.width = rootRect.width;
|
|
95
|
+
style2.transform = `translate3d(0, ${transform}px, 0)`;
|
|
96
|
+
style2[position] = threshold;
|
|
97
|
+
style2.zIndex = zIndex;
|
|
98
|
+
return style2;
|
|
99
|
+
}, [fixed, rootRect.height, rootRect.width, transform, position]);
|
|
100
|
+
const handleScroll = async (scrollTop) => {
|
|
101
|
+
const curRootRect = await getRectByTaro(rootRef.current);
|
|
102
|
+
const stickyRect = await getRectByTaro(stickyRef.current);
|
|
103
|
+
if (curRootRect && stickyRect) {
|
|
104
|
+
setRootRect(curRootRect);
|
|
105
|
+
if (position === "top") {
|
|
106
|
+
if (container) {
|
|
107
|
+
const containerRect = await getRectByTaro(container.current);
|
|
108
|
+
const difference = containerRect.bottom - threshold - curRootRect.height;
|
|
109
|
+
const curTransform = difference < 0 ? difference : 0;
|
|
110
|
+
setTransform(curTransform);
|
|
111
|
+
const curFixed = threshold > curRootRect.top && containerRect.bottom > 0;
|
|
112
|
+
setFixed(curFixed);
|
|
113
|
+
} else {
|
|
114
|
+
setFixed(threshold > curRootRect.top);
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
const windowHeight = getSystemInfoSync().windowHeight;
|
|
118
|
+
setFixed(windowHeight - threshold < curRootRect.bottom);
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
console.log("getRectByTaro获取失败", { stickyRect, curRootRect });
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const getElement = useCallback(() => {
|
|
125
|
+
return getScrollParent(rootRef.current);
|
|
126
|
+
}, []);
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (getEnv() === "WEB" && getElement() !== window) {
|
|
129
|
+
window.addEventListener("touchmove", handleScroll, true);
|
|
130
|
+
window.addEventListener("scroll", handleScroll, true);
|
|
131
|
+
return () => {
|
|
132
|
+
window.removeEventListener("touchmove", handleScroll);
|
|
133
|
+
window.removeEventListener("scroll", handleScroll);
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}, []);
|
|
137
|
+
usePageScroll((res) => {
|
|
138
|
+
if (getEnv() === "WEAPP") {
|
|
139
|
+
handleScroll(res.scrollTop);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return React.createElement(
|
|
143
|
+
"div",
|
|
144
|
+
{ ref: rootRef, style: rootStyle, className: classNames(classPrefix, className), ...rest },
|
|
145
|
+
React.createElement("div", { className: classNames("nut-sticky--box", {
|
|
146
|
+
"nut-sticky--fixed": fixed
|
|
147
|
+
}), ref: stickyRef, style: stickyStyle }, children)
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
Sticky.defaultProps = defaultProps;
|
|
151
|
+
Sticky.displayName = "NutSticky";
|
|
152
|
+
export {
|
|
153
|
+
Sticky as S
|
|
154
|
+
};
|