@nutui/nutui-react-taro 2.0.0-alpha.5 → 2.0.0-alpha.6
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 +14 -0
- package/dist/esm/ActionSheet.js +15 -16
- package/dist/esm/Address.js +19 -20
- package/dist/esm/Animate.js +7 -8
- package/dist/esm/AnimatingNumbers.js +8 -9
- package/dist/esm/Audio.js +17 -19
- package/dist/esm/Avatar.js +11 -13
- package/dist/esm/AvatarGroup.js +8 -9
- package/dist/esm/BackTop.js +9 -10
- package/dist/esm/Badge.js +7 -8
- package/dist/esm/Barrage.js +9 -10
- package/dist/esm/Button.js +8 -9
- package/dist/esm/Calendar.js +18 -20
- package/dist/esm/CalendarItem.js +11 -13
- package/dist/esm/Card.js +12 -13
- package/dist/esm/Cascader.js +16 -19
- 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 -9
- 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 -8
- package/dist/esm/CountDown.js +8 -10
- package/dist/esm/DatePicker.js +21 -23
- package/dist/esm/Dialog.js +13 -15
- package/dist/esm/Divider.js +7 -8
- package/dist/esm/Drag.js +7 -8
- package/dist/esm/Elevator.js +9 -10
- package/dist/esm/Ellipsis.js +9 -10
- package/dist/esm/Empty.js +7 -9
- package/dist/esm/FixedNav.js +11 -13
- package/dist/esm/Form.js +10 -11
- package/dist/esm/FormItem.js +8 -9
- package/dist/esm/Grid.js +8 -10
- package/dist/esm/GridItem.js +7 -9
- package/dist/esm/Image.js +7 -9
- package/dist/esm/ImagePreview.js +19 -20
- package/dist/esm/Indicator.js +6 -7
- package/dist/esm/Infiniteloading.js +12 -14
- package/dist/esm/Input.js +11 -13
- 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 -14
- package/dist/esm/NavBar.js +7 -8
- package/dist/esm/NoticeBar.js +11 -12
- package/dist/esm/Notify.js +9 -10
- package/dist/esm/NumberKeyboard.js +16 -18
- package/dist/esm/Overlay.js +8 -9
- package/dist/esm/Pagination.js +9 -11
- package/dist/esm/Picker.js +20 -22
- package/dist/esm/Popover.js +10 -11
- package/dist/esm/Popup.js +12 -13
- package/dist/esm/Price.js +7 -8
- package/dist/esm/Progress.js +7 -8
- package/dist/esm/PullToRefresh.js +11 -13
- package/dist/esm/Radio.js +9 -10
- package/dist/esm/RadioGroup.js +9 -10
- package/dist/esm/Range.js +13 -15
- package/dist/esm/Rate.js +9 -10
- package/dist/esm/Row.js +8 -9
- package/dist/esm/SearchBar.js +11 -13
- package/dist/esm/ShortPassword.js +16 -18
- package/dist/esm/SideNavBar.js +14 -15
- package/dist/esm/SideNavBarItem.js +5 -6
- package/dist/esm/Signature.js +13 -15
- package/dist/esm/Skeleton.js +14 -16
- package/dist/esm/Step.js +10 -11
- package/dist/esm/Steps.js +9 -10
- package/dist/esm/Sticky.js +11 -12
- package/dist/esm/SubSideNavBar.js +6 -7
- package/dist/esm/Swipe.js +11 -12
- package/dist/esm/Swiper.js +10 -11
- package/dist/esm/SwiperItem.js +9 -10
- package/dist/esm/Switch.js +7 -8
- package/dist/esm/TabPane.js +6 -7
- package/dist/esm/Tabbar.js +10 -11
- package/dist/esm/TabbarItem.js +8 -9
- package/dist/esm/Table.js +9 -13
- package/dist/esm/Tabs.js +11 -12
- package/dist/esm/Tag.js +8 -9
- package/dist/esm/TextArea.js +11 -10
- package/dist/esm/TimeDetail.js +8 -10
- package/dist/esm/TimePannel.js +8 -10
- package/dist/esm/TimeSelect.js +18 -20
- package/dist/esm/Toast.js +9 -10
- package/dist/esm/TrendArrow.js +8 -9
- package/dist/esm/Uploader.js +14 -16
- package/dist/esm/UserContext-735db09f.js +5 -0
- package/dist/esm/UserContext-ab42ba7f.js +5 -0
- package/dist/esm/UserContext-fde5badc.js +5 -0
- package/dist/esm/Video.js +8 -9
- package/dist/esm/VirtualList.js +8 -10
- package/dist/esm/WaterMark.js +10 -12
- package/dist/esm/actionsheet.taro-d2217152.js +61 -0
- package/dist/esm/address.taro-1c534feb.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-ec96ef80.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-a46fdf25.js +51 -0
- package/dist/esm/cascader.taro-a8d2148e.js +463 -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-d0fccf11.js +5 -0
- package/dist/esm/countdown.taro-22200811.js +210 -0
- package/dist/esm/datepicker.taro-3f718964.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-bc162e4f.js +201 -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/get-scroll-parent-8da04f2e.js +24 -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-8832dc01.js +163 -0
- package/dist/esm/index-e3184f19.js +9 -0
- package/dist/esm/indicator.taro-f2bd212f.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-877dc947.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-b3bfd4fe.js +408 -0
- package/dist/esm/notify.taro-6b6eb6bf.js +82 -0
- package/dist/esm/numberkeyboard.taro-0a0e866a.js +183 -0
- package/dist/esm/nutui-react.es.js +211 -116
- 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-a5603921.js +468 -0
- package/dist/esm/popover.taro-ad483372.js +162 -0
- package/dist/esm/popup.taro-e756f3fc.js +150 -0
- package/dist/esm/price.taro-c4f45310.js +80 -0
- package/dist/esm/progress.taro-ff63be75.js +49 -0
- package/dist/esm/pulltorefresh.taro-c611fd92.js +179 -0
- package/dist/esm/radio.taro-3a54f4c8.js +152 -0
- package/dist/esm/range.taro-52cda918.js +325 -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-3bc01c0c.js +66 -0
- package/dist/esm/steps.taro-77e301ab.js +30 -0
- package/dist/esm/sticky.taro-3c03eb0a.js +134 -0
- package/dist/esm/subsidenavbar.taro-abe07673.js +64 -0
- package/dist/esm/supports-passive-aaaf0eff.js +17 -0
- package/dist/esm/swipe.taro-de80fcd8.js +180 -0
- package/dist/esm/swiper.taro-74cf9306.js +430 -0
- package/dist/esm/swiperitem-80df464a.js +29 -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-56e46dd3.js +137 -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-92977813.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 +505 -447
- package/dist/nutui.react.umd.js +504 -446
- package/dist/packages/cascader/cascader.scss +0 -26
- package/dist/packages/picker/picker.scss +66 -137
- package/dist/packages/table/table.scss +0 -56
- package/dist/packages/textarea/textarea.scss +5 -12
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +1 -4
- package/dist/styles/variables.scss +2 -6
- package/dist/types/index.d.ts +42 -46
- package/package.json +1 -1
- 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-12cf5a3e.js +0 -53
- package/dist/esm/address.taro-cab0ea22.js +0 -475
- package/dist/esm/animate.taro-485331bb.js +0 -41
- package/dist/esm/animatingnumbers.taro-f6eaffef.js +0 -104
- package/dist/esm/audio.taro-ff280f5e.js +0 -162
- package/dist/esm/avatar.taro-6e8f1f5c.js +0 -107
- package/dist/esm/avatargroup-f4375806.js +0 -31
- package/dist/esm/backtop.taro-8ec80d02.js +0 -52
- package/dist/esm/badge.taro-e2169fbe.js +0 -45
- package/dist/esm/barrage.taro-aa08da6c.js +0 -94
- package/dist/esm/bem-350c1702.js +0 -5
- package/dist/esm/button.taro-b50bc217.js +0 -65
- package/dist/esm/calendar.taro-2fc9b899.js +0 -65
- package/dist/esm/calendaritem.taro-2d4a8c34.js +0 -791
- package/dist/esm/can-use-dom-3eeb5af4.js +0 -6
- package/dist/esm/card.taro-0e849e94.js +0 -33
- package/dist/esm/cascader.taro-467910b2.js +0 -447
- package/dist/esm/cell.taro-ea725a95.js +0 -43
- package/dist/esm/cellgroup.taro-e05ea802.js +0 -25
- package/dist/esm/checkbox.taro-9d02f86c.js +0 -175
- package/dist/esm/circleprogress.taro-d4943109.js +0 -103
- package/dist/esm/col.taro-4477c9f7.js +0 -43
- package/dist/esm/collapse.taro-89bcadf2.js +0 -79
- package/dist/esm/collapseitem-0e228cec.js +0 -68
- package/dist/esm/configprovider.taro-ce34d482.js +0 -174
- package/dist/esm/context-c96afdcc.js +0 -5
- package/dist/esm/countdown.taro-3118ba23.js +0 -225
- package/dist/esm/datepicker.taro-2e3e955b.js +0 -275
- package/dist/esm/dialog.taro-eab19eab.js +0 -107
- package/dist/esm/divider.taro-3993d7d5.js +0 -33
- package/dist/esm/drag.taro-347dfb84.js +0 -111
- package/dist/esm/elevator.taro-1a4e3356.js +0 -193
- package/dist/esm/ellipsis.taro-e1ac99a1.js +0 -244
- package/dist/esm/empty.taro-26363c66.js +0 -56
- package/dist/esm/fixednav.taro-ddb21e87.js +0 -54
- package/dist/esm/form.taro-423b0f0a.js +0 -179
- package/dist/esm/formitem.taro-b550d29c.js +0 -89
- package/dist/esm/get-scroll-parent-b4a07e65.js +0 -25
- package/dist/esm/grid.taro-883a9c35.js +0 -49
- package/dist/esm/griditem.taro-16c7055b.js +0 -80
- package/dist/esm/image.taro-3025e659.js +0 -64
- package/dist/esm/imagepreview.taro-d511342c.js +0 -167
- package/dist/esm/index-5bcb0ff8.js +0 -7
- package/dist/esm/indicator.taro-bfb21d45.js +0 -30
- package/dist/esm/infiniteloading.taro-721bca1f.js +0 -141
- package/dist/esm/input.taro-06c1e4d5.js +0 -167
- package/dist/esm/inputnumber.taro-1f893d42.js +0 -199
- package/dist/esm/layout.taro-e4bf83cb.js +0 -11
- package/dist/esm/menu.taro-e5c68cb8.js +0 -111
- package/dist/esm/menuitem.taro-37c18382.js +0 -129
- package/dist/esm/navbar.taro-92bab9c4.js +0 -57
- package/dist/esm/noticebar.taro-cbe93c9e.js +0 -427
- package/dist/esm/notify.taro-f1079218.js +0 -75
- package/dist/esm/numberkeyboard.taro-d9b1721b.js +0 -159
- package/dist/esm/offsetContext-c2a746fa.js +0 -5
- package/dist/esm/overlay.taro-067b7202.js +0 -73
- package/dist/esm/pagination.taro-94f9be5e.js +0 -91
- package/dist/esm/picker.taro-e16b4312.js +0 -423
- package/dist/esm/popover.taro-84a55ff9.js +0 -153
- package/dist/esm/popup.taro-89cc342a.js +0 -139
- package/dist/esm/price.taro-959d82f2.js +0 -83
- package/dist/esm/progress.taro-1a7ac8a4.js +0 -40
- package/dist/esm/pulltorefresh.taro-016d0079.js +0 -181
- package/dist/esm/radio.taro-36438449.js +0 -177
- package/dist/esm/range.taro-8953e8c3.js +0 -332
- package/dist/esm/rate.taro-895bb41c.js +0 -77
- package/dist/esm/row.taro-e929ec5c.js +0 -48
- package/dist/esm/searchbar.taro-4467040f.js +0 -152
- package/dist/esm/shortpassword.taro-433b86a4.js +0 -119
- package/dist/esm/sidenavbar.taro-f8ffb7dc.js +0 -33
- package/dist/esm/sidenavbaritem.taro-6cb0821e.js +0 -12
- package/dist/esm/signature.taro-a4d9b5c9.js +0 -143
- package/dist/esm/skeleton.taro-8ec11af9.js +0 -62
- package/dist/esm/step.taro-7ea33a76.js +0 -58
- package/dist/esm/steps.taro-86753d36.js +0 -30
- package/dist/esm/sticky.taro-a142a5f2.js +0 -136
- package/dist/esm/subsidenavbar.taro-85c03291.js +0 -63
- package/dist/esm/supports-passive-c85ef996.js +0 -18
- package/dist/esm/swipe.taro-0b8cc872.js +0 -175
- package/dist/esm/swiper.taro-c0e9a56b.js +0 -451
- package/dist/esm/swiperitem-abab7606.js +0 -29
- package/dist/esm/switch.taro-e82809f6.js +0 -38
- package/dist/esm/tabbar.taro-48413fb8.js +0 -51
- package/dist/esm/tabbaritem.taro-5afa3562.js +0 -37
- package/dist/esm/table.taro-327b4248.js +0 -95
- package/dist/esm/tabpane.taro-406cc0d3.js +0 -21
- package/dist/esm/tabs.taro-d47ccfc5.js +0 -120
- package/dist/esm/tag.taro-846ee805.js +0 -92
- package/dist/esm/textarea.taro-add72cf3.js +0 -94
- package/dist/esm/timedetail.taro-82a2900b.js +0 -44
- package/dist/esm/timepannel.taro-0573bb65.js +0 -22
- package/dist/esm/timeselect.taro-29124a34.js +0 -133
- package/dist/esm/toast.taro-c509a870.js +0 -108
- package/dist/esm/trendarrow.taro-dd83ec94.js +0 -70
- package/dist/esm/typings-d8491423.js +0 -6
- package/dist/esm/uploader.taro-c70d00de.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-1c6405b4.js +0 -67
- package/dist/esm/virtuallist.taro-ba8e1f21.js +0 -214
- package/dist/esm/watermark.taro-168cdac5.js +0 -114
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useState, useEffect } from 'react';
|
|
2
|
-
import { Tips } from '@nutui/icons-react-taro';
|
|
3
|
-
import { c as cn } from './bem-350c1702.js';
|
|
4
|
-
import { P as Popup } from './popup.taro-89cc342a.js';
|
|
5
|
-
import { u as useConfig } from './configprovider.taro-ce34d482.js';
|
|
6
|
-
import { C as ComponentDefaults } from './typings-d8491423.js';
|
|
7
|
-
|
|
8
|
-
const defaultProps = {
|
|
9
|
-
...ComponentDefaults,
|
|
10
|
-
title: '',
|
|
11
|
-
description: '',
|
|
12
|
-
tips: '',
|
|
13
|
-
tipsIcon: null,
|
|
14
|
-
iconSize: 11,
|
|
15
|
-
visible: false,
|
|
16
|
-
modelValue: '',
|
|
17
|
-
errorMsg: '',
|
|
18
|
-
noButton: true,
|
|
19
|
-
closeOnClickOverlay: true,
|
|
20
|
-
length: 6,
|
|
21
|
-
className: '',
|
|
22
|
-
autoFocus: false,
|
|
23
|
-
onChange: (value) => { },
|
|
24
|
-
onOk: (value) => { },
|
|
25
|
-
onCancel: () => { },
|
|
26
|
-
onClose: () => { },
|
|
27
|
-
onTips: () => { },
|
|
28
|
-
onComplete: (value) => { },
|
|
29
|
-
};
|
|
30
|
-
const ShortPassword = (props) => {
|
|
31
|
-
const { locale } = useConfig();
|
|
32
|
-
const { title, description, tips, tipsIcon, iconSize, visible, modelValue, errorMsg, noButton, closeOnClickOverlay, length, style, className, onChange, onOk, onTips, onCancel, onClose, onComplete, autoFocus, ...reset } = props;
|
|
33
|
-
const b = cn('shortpassword');
|
|
34
|
-
const textInput = useRef(null);
|
|
35
|
-
const range = (val) => {
|
|
36
|
-
return Math.min(Math.max(4, val), 6);
|
|
37
|
-
};
|
|
38
|
-
const [innerVisible, setInnerVisible] = useState(visible);
|
|
39
|
-
const [comLen, setComLen] = useState(range(Number(length)));
|
|
40
|
-
const [inputValue, setInputValue] = useState('');
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
setInnerVisible(visible);
|
|
43
|
-
}, [visible]);
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
if (typeof modelValue !== 'undefined') {
|
|
46
|
-
setInputValue(modelValue);
|
|
47
|
-
}
|
|
48
|
-
}, [modelValue]);
|
|
49
|
-
const changeValue = (e) => {
|
|
50
|
-
let inputValue = e.target.value;
|
|
51
|
-
if (String(inputValue).length > comLen) {
|
|
52
|
-
inputValue = inputValue.slice(0, comLen);
|
|
53
|
-
}
|
|
54
|
-
setInputValue(inputValue);
|
|
55
|
-
if (String(inputValue).length === comLen) {
|
|
56
|
-
onComplete && onComplete(inputValue);
|
|
57
|
-
}
|
|
58
|
-
onChange && onChange(inputValue);
|
|
59
|
-
};
|
|
60
|
-
const systemStyle = () => {
|
|
61
|
-
const u = navigator.userAgent;
|
|
62
|
-
const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; // g
|
|
63
|
-
const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
64
|
-
let style = {};
|
|
65
|
-
if (isIOS) {
|
|
66
|
-
style = {
|
|
67
|
-
paddingRight: '1200px',
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
if (isAndroid) {
|
|
71
|
-
style = {
|
|
72
|
-
opacity: 0,
|
|
73
|
-
zIndex: 10,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
return style;
|
|
77
|
-
};
|
|
78
|
-
const focus = () => {
|
|
79
|
-
if (textInput.current) {
|
|
80
|
-
textInput.current.focus();
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
const sure = () => {
|
|
84
|
-
onOk && onOk(inputValue);
|
|
85
|
-
};
|
|
86
|
-
const renderIcon = (size = '11px') => {
|
|
87
|
-
return React.isValidElement(tipsIcon) ? (React.cloneElement(tipsIcon, {
|
|
88
|
-
...tipsIcon.props,
|
|
89
|
-
size,
|
|
90
|
-
})) : (React.createElement(Tips, { size: size }));
|
|
91
|
-
};
|
|
92
|
-
return (React.createElement("div", null,
|
|
93
|
-
React.createElement(Popup, { style: {
|
|
94
|
-
padding: '32px 24px 28px 24px',
|
|
95
|
-
borderRadius: '12px',
|
|
96
|
-
textAlign: 'center',
|
|
97
|
-
}, visible: innerVisible, closeable: true, "close-on-click-overlay": closeOnClickOverlay, onClickOverlay: onClose, onClickCloseIcon: onClose },
|
|
98
|
-
React.createElement("div", { className: `${b()} ${className}`, style: { ...style }, ...reset },
|
|
99
|
-
React.createElement("div", { className: b('title') }, title || locale.shortpassword.title),
|
|
100
|
-
React.createElement("div", { className: b('subtitle') }, description || locale.shortpassword.description),
|
|
101
|
-
React.createElement("div", { className: b('input') },
|
|
102
|
-
React.createElement("input", { ref: textInput, className: b('input-real'), type: "number", style: systemStyle(), maxLength: 6, value: inputValue, autoFocus: autoFocus, onChange: (e) => changeValue(e) }),
|
|
103
|
-
React.createElement("div", { className: b('input-site') }),
|
|
104
|
-
React.createElement("div", { className: b('input-fake'), onClick: () => focus() }, [...new Array(comLen).keys()].map((item, index) => {
|
|
105
|
-
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));
|
|
106
|
-
}))),
|
|
107
|
-
React.createElement("div", { className: b('message') },
|
|
108
|
-
React.createElement("div", { className: b('message__error') }, errorMsg),
|
|
109
|
-
tips || locale.shortpassword.tips ? (React.createElement("div", { className: b('message__forget') },
|
|
110
|
-
renderIcon(iconSize),
|
|
111
|
-
React.createElement("div", { className: b('message__forget-tips'), onClick: onTips }, tips || locale.shortpassword.tips))) : null),
|
|
112
|
-
!noButton ? (React.createElement("div", { className: b('footer') },
|
|
113
|
-
React.createElement("div", { className: b('footer__cancel'), onClick: onCancel }, locale.cancel),
|
|
114
|
-
React.createElement("div", { className: b('footer__sure'), onClick: () => sure() }, locale.confirm))) : null))));
|
|
115
|
-
};
|
|
116
|
-
ShortPassword.defaultProps = defaultProps;
|
|
117
|
-
ShortPassword.displayName = 'NutShortPassword';
|
|
118
|
-
|
|
119
|
-
export { ShortPassword as S };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { P as Popup } from './popup.taro-89cc342a.js';
|
|
3
|
-
import { O as OffsetContext } from './offsetContext-c2a746fa.js';
|
|
4
|
-
|
|
5
|
-
const defaultProps = {
|
|
6
|
-
showhead: false,
|
|
7
|
-
position: 'left',
|
|
8
|
-
width: '80%',
|
|
9
|
-
};
|
|
10
|
-
const SideNavBar = (props) => {
|
|
11
|
-
const { title, visible, width, position, children, className, showhead, onClose, ...rest } = {
|
|
12
|
-
...defaultProps,
|
|
13
|
-
...props,
|
|
14
|
-
};
|
|
15
|
-
const offset = props.offset ? Number(props.offset) : 20;
|
|
16
|
-
const [sidenavbarShow, setSidenavbarShow] = useState(true);
|
|
17
|
-
const handleClick = () => {
|
|
18
|
-
setSidenavbarShow(!sidenavbarShow);
|
|
19
|
-
};
|
|
20
|
-
return (React.createElement(Popup, { visible: visible, style: { width, height: '100%' }, position: position, onClose: onClose },
|
|
21
|
-
React.createElement("div", { className: className ? `${className} nut-sidenavbar` : 'nut-sidenavbar', ...rest },
|
|
22
|
-
React.createElement("div", { className: "nut-sidenavbar__content" },
|
|
23
|
-
React.createElement("div", { className: `nut-sidenavbar__list ${sidenavbarShow ? 'nutShow' : 'nutHide'}`, onClick: handleClick },
|
|
24
|
-
React.createElement("div", { className: "nut-sidenavbar__title border-bt ", style: { paddingLeft: `${offset}px` } },
|
|
25
|
-
title,
|
|
26
|
-
React.createElement("i", { className: `arrow-icon ${sidenavbarShow ? 'arrow-up' : 'arrow-down'}` })),
|
|
27
|
-
React.createElement(OffsetContext.Provider, { value: offset },
|
|
28
|
-
React.createElement("div", { className: "nut-sidenavbar__content" }, children)))))));
|
|
29
|
-
};
|
|
30
|
-
SideNavBar.defaultProps = defaultProps;
|
|
31
|
-
SideNavBar.displayName = 'NutSideNavBar';
|
|
32
|
-
|
|
33
|
-
export { SideNavBar as S };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
const SideNavBarItem = (props) => {
|
|
4
|
-
const { title, key, children, onClick, ...rest } = props;
|
|
5
|
-
const clickFn = (e) => {
|
|
6
|
-
e.stopPropagation();
|
|
7
|
-
onClick && onClick({ title, key });
|
|
8
|
-
};
|
|
9
|
-
return (React.createElement("div", { className: "nut-subsidenavbar__item border-bt", onClick: clickFn, ...rest }, title));
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { SideNavBarItem as S };
|
|
@@ -1,143 +0,0 @@
|
|
|
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-b50bc217.js';
|
|
4
|
-
import { c as cn } from './bem-350c1702.js';
|
|
5
|
-
import { u as useConfig } from './configprovider.taro-ce34d482.js';
|
|
6
|
-
|
|
7
|
-
/* eslint-disable react/no-unknown-property */
|
|
8
|
-
const defaultProps = {
|
|
9
|
-
canvasId: 'spcanvas',
|
|
10
|
-
type: 'png',
|
|
11
|
-
lineWidth: 2,
|
|
12
|
-
strokeStyle: '#000',
|
|
13
|
-
className: '',
|
|
14
|
-
};
|
|
15
|
-
const Signature = (props) => {
|
|
16
|
-
const { locale } = useConfig();
|
|
17
|
-
const { canvasId, type, lineWidth, strokeStyle, unSupportTpl, className, confirm, clear, onConfirm, onClear, ...rest } = {
|
|
18
|
-
...defaultProps,
|
|
19
|
-
...props,
|
|
20
|
-
};
|
|
21
|
-
const b = cn('signature');
|
|
22
|
-
const canvasRef = useRef(null);
|
|
23
|
-
const wrapRef = useRef(null);
|
|
24
|
-
const [canvasHeight, setCanvasHeight] = useState(0);
|
|
25
|
-
const [canvasWidth, setCanvasWidth] = useState(0);
|
|
26
|
-
const ctx = useRef(null);
|
|
27
|
-
const [disalbeScroll] = useState('true');
|
|
28
|
-
const startEventHandler = (event) => {
|
|
29
|
-
if (ctx.current) {
|
|
30
|
-
ctx.current.beginPath();
|
|
31
|
-
ctx.current.lineWidth = lineWidth;
|
|
32
|
-
ctx.current.strokeStyle = strokeStyle;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const moveEventHandler = (event) => {
|
|
36
|
-
if (ctx.current) {
|
|
37
|
-
const evt = event.changedTouches[0];
|
|
38
|
-
let mouseX = evt.x || evt.clientX;
|
|
39
|
-
let mouseY = evt.y || evt.clientY;
|
|
40
|
-
if (getEnv() === 'WEB' && canvasRef.current) {
|
|
41
|
-
const coverPos = canvasRef.current.getBoundingClientRect();
|
|
42
|
-
mouseX = evt.clientX - coverPos.left;
|
|
43
|
-
mouseY = evt.clientY - coverPos.top;
|
|
44
|
-
}
|
|
45
|
-
nextTick(() => {
|
|
46
|
-
// ctx.current.lineCap = 'round'
|
|
47
|
-
// ctx.current.lineJoin = 'round'
|
|
48
|
-
ctx.current?.lineTo(mouseX, mouseY);
|
|
49
|
-
ctx.current?.stroke();
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const endEventHandler = (event) => { };
|
|
54
|
-
const handleClearBtn = () => {
|
|
55
|
-
if (ctx.current) {
|
|
56
|
-
ctx.current.clearRect(0, 0, canvasWidth, canvasHeight);
|
|
57
|
-
ctx.current.closePath();
|
|
58
|
-
}
|
|
59
|
-
clear && clear();
|
|
60
|
-
onClear && onClear();
|
|
61
|
-
};
|
|
62
|
-
const handleConfirmBtn = () => {
|
|
63
|
-
onSave();
|
|
64
|
-
};
|
|
65
|
-
const onSave = () => {
|
|
66
|
-
createSelectorQuery()
|
|
67
|
-
.select(`#${canvasId}`)
|
|
68
|
-
.fields({
|
|
69
|
-
node: true,
|
|
70
|
-
size: true,
|
|
71
|
-
})
|
|
72
|
-
.exec((res) => {
|
|
73
|
-
canvasToTempFilePath({
|
|
74
|
-
canvas: res[0].node,
|
|
75
|
-
fileType: props.type,
|
|
76
|
-
canvasId: `${canvasId}`,
|
|
77
|
-
success: (res) => {
|
|
78
|
-
handleClearBtn();
|
|
79
|
-
confirm && confirm(res.tempFilePath);
|
|
80
|
-
onConfirm && onConfirm(res.tempFilePath);
|
|
81
|
-
},
|
|
82
|
-
fail: (res) => {
|
|
83
|
-
console.log('保存失败');
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
const canvasSetting = (canvasDom, width, height) => {
|
|
89
|
-
const canvas = canvasDom;
|
|
90
|
-
canvas.current = canvas;
|
|
91
|
-
ctx.current = canvas.getContext('2d');
|
|
92
|
-
setCanvasWidth(width);
|
|
93
|
-
setCanvasHeight(height);
|
|
94
|
-
canvas.width = width;
|
|
95
|
-
canvas.height = height;
|
|
96
|
-
if (ctx.current) {
|
|
97
|
-
ctx.current.clearRect(0, 0, width, height);
|
|
98
|
-
ctx.current.beginPath();
|
|
99
|
-
ctx.current.lineWidth = lineWidth;
|
|
100
|
-
ctx.current.strokeStyle = strokeStyle;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
const initCanvas = () => {
|
|
104
|
-
nextTick(() => {
|
|
105
|
-
setTimeout(() => {
|
|
106
|
-
if (getEnv() === 'WEAPP' || getEnv() === 'JD') {
|
|
107
|
-
createSelectorQuery()
|
|
108
|
-
.select(`#${canvasId}`)
|
|
109
|
-
.fields({
|
|
110
|
-
node: true,
|
|
111
|
-
size: true,
|
|
112
|
-
}, (res) => {
|
|
113
|
-
const { node, width, height } = res;
|
|
114
|
-
canvasSetting(node, width, height);
|
|
115
|
-
})
|
|
116
|
-
.exec();
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
const canvasDom = document.getElementById(`${canvasId}`);
|
|
120
|
-
let canvas = canvasDom;
|
|
121
|
-
if (canvasDom?.tagName !== 'CANVAS') {
|
|
122
|
-
canvas = canvasDom?.getElementsByTagName('canvas')[0];
|
|
123
|
-
}
|
|
124
|
-
canvasSetting(canvas, canvasDom?.offsetWidth, canvasDom?.offsetHeight);
|
|
125
|
-
}
|
|
126
|
-
}, 1000);
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
initCanvas();
|
|
131
|
-
}, []);
|
|
132
|
-
return (React.createElement("div", { className: `${b()} ${className}`, ...rest },
|
|
133
|
-
React.createElement("div", { className: `${b('inner')} spcanvas_WEAPP`, ref: wrapRef }, getEnv() === 'WEAPP' || getEnv() === 'JD' ? (React.createElement("canvas", { id: canvasId, ref: canvasRef,
|
|
134
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
135
|
-
// @ts-ignore
|
|
136
|
-
canvasId: canvasId, disalbeScroll: true, type: "2d", onTouchStart: startEventHandler, onTouchMove: moveEventHandler, onTouchEnd: endEventHandler })) : (React.createElement("canvas", { id: canvasId, ref: canvasRef, "canvas-id": canvasId, "disalbe-scroll": disalbeScroll, onTouchStart: startEventHandler, onTouchMove: moveEventHandler, onTouchEnd: endEventHandler, onTouchCancel: endEventHandler }))),
|
|
137
|
-
React.createElement(Button, { className: `${b('btn')}`, type: "default", onClick: () => handleClearBtn() }, locale.signature.reSign),
|
|
138
|
-
React.createElement(Button, { className: `${b('btn')}`, type: "primary", onClick: () => handleConfirmBtn() }, locale.confirm)));
|
|
139
|
-
};
|
|
140
|
-
Signature.defaultProps = defaultProps;
|
|
141
|
-
Signature.displayName = 'NutSignature';
|
|
142
|
-
|
|
143
|
-
export { Signature as S };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { A as Avatar } from './avatar.taro-6e8f1f5c.js';
|
|
4
|
-
import { c as cn } from './bem-350c1702.js';
|
|
5
|
-
|
|
6
|
-
const defaultProps = {
|
|
7
|
-
width: '100px',
|
|
8
|
-
height: '100px',
|
|
9
|
-
row: 1,
|
|
10
|
-
animated: false,
|
|
11
|
-
title: false,
|
|
12
|
-
avatar: false,
|
|
13
|
-
round: false,
|
|
14
|
-
avatarSize: '50px',
|
|
15
|
-
loading: false,
|
|
16
|
-
avatarShape: 'round',
|
|
17
|
-
};
|
|
18
|
-
const Skeleton = (props) => {
|
|
19
|
-
const { className, width, height, animated, row, title, avatar, avatarSize, round, loading, children, avatarShape, ...restProps } = {
|
|
20
|
-
...defaultProps,
|
|
21
|
-
...props,
|
|
22
|
-
};
|
|
23
|
-
const b = cn('skeleton');
|
|
24
|
-
const classes = classNames(className, b());
|
|
25
|
-
const blockClass = classNames({
|
|
26
|
-
blockClass: true,
|
|
27
|
-
'blockClass--round': round,
|
|
28
|
-
});
|
|
29
|
-
const avatarClass = classNames({
|
|
30
|
-
avatarClass: true,
|
|
31
|
-
[`avatarClass--${avatarShape}`]: avatarShape,
|
|
32
|
-
});
|
|
33
|
-
const repeatLines = (num) => {
|
|
34
|
-
return Array.from({ length: num }, (v, i) => i);
|
|
35
|
-
};
|
|
36
|
-
const getStyle = () => {
|
|
37
|
-
if (avatarSize) {
|
|
38
|
-
return {
|
|
39
|
-
width: avatarSize,
|
|
40
|
-
height: avatarSize,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
width: '50px',
|
|
45
|
-
height: '50px',
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
return (React.createElement(React.Fragment, null, loading ? (React.createElement("div", null, children)) : (React.createElement("div", { className: classes, ...restProps },
|
|
49
|
-
animated && React.createElement("div", { className: "skeleton-animation" }),
|
|
50
|
-
React.createElement("div", { className: "nut-skeleton-content" },
|
|
51
|
-
avatar && (React.createElement(Avatar, { className: avatarClass, background: "rgb(239, 239, 239)", shape: avatarShape, style: getStyle() })),
|
|
52
|
-
row === 1 && (React.createElement("div", { className: blockClass, style: { width, height } })),
|
|
53
|
-
React.createElement("div", { className: "skeleton-content-line" },
|
|
54
|
-
title && React.createElement("div", { className: "skeleton-title" }),
|
|
55
|
-
repeatLines(row).map((item, index) => {
|
|
56
|
-
return (React.createElement("div", { className: blockClass, key: index, style: { width, height } }));
|
|
57
|
-
})))))));
|
|
58
|
-
};
|
|
59
|
-
Skeleton.defaultProps = defaultProps;
|
|
60
|
-
Skeleton.displayName = 'NutSkeleton';
|
|
61
|
-
|
|
62
|
-
export { Skeleton as S };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { D as DataContext } from './UserContext-e402e1a6.js';
|
|
4
|
-
import { c as cn } from './bem-350c1702.js';
|
|
5
|
-
import { C as ComponentDefaults } from './typings-d8491423.js';
|
|
6
|
-
|
|
7
|
-
const defaultProps = {
|
|
8
|
-
...ComponentDefaults,
|
|
9
|
-
title: '',
|
|
10
|
-
content: '',
|
|
11
|
-
activeIndex: 0,
|
|
12
|
-
icon: '',
|
|
13
|
-
};
|
|
14
|
-
const Step = (props) => {
|
|
15
|
-
const { children, title, content, activeIndex, icon, className, renderContent, ...restProps } = {
|
|
16
|
-
...defaultProps,
|
|
17
|
-
...props,
|
|
18
|
-
};
|
|
19
|
-
const parent = useContext(DataContext);
|
|
20
|
-
const dot = parent.propSteps.progressDot;
|
|
21
|
-
const getCurrentStatus = () => {
|
|
22
|
-
const index = activeIndex;
|
|
23
|
-
if (index < +parent.propSteps.current)
|
|
24
|
-
return 'finish';
|
|
25
|
-
return index === +parent.propSteps.current ? 'process' : 'wait';
|
|
26
|
-
};
|
|
27
|
-
const handleClickStep = () => {
|
|
28
|
-
parent.propSteps?.onClickStep && parent.propSteps?.onClickStep(activeIndex);
|
|
29
|
-
parent.propSteps?.clickStep && parent.propSteps?.clickStep(activeIndex);
|
|
30
|
-
};
|
|
31
|
-
const b = cn('step');
|
|
32
|
-
const classes = classNames({
|
|
33
|
-
[`${b('')}-${getCurrentStatus()}`]: true,
|
|
34
|
-
}, className, b(''));
|
|
35
|
-
const renderIconClass = () => {
|
|
36
|
-
if (!dot && icon) {
|
|
37
|
-
return 'nut-step-icon is-icon';
|
|
38
|
-
}
|
|
39
|
-
if (!dot && !icon) {
|
|
40
|
-
return 'nut-step-icon is-text';
|
|
41
|
-
}
|
|
42
|
-
return 'nut-step-icon';
|
|
43
|
-
};
|
|
44
|
-
return (React.createElement("div", { className: classes, ...restProps, onClick: handleClickStep },
|
|
45
|
-
React.createElement("div", { className: "nut-step-head" },
|
|
46
|
-
React.createElement("div", { className: "nut-step-line" }),
|
|
47
|
-
React.createElement("div", { className: renderIconClass() }, React.isValidElement(icon)
|
|
48
|
-
? icon
|
|
49
|
-
: !dot && React.createElement("span", { className: "nut-step-inner" }, activeIndex))),
|
|
50
|
-
React.createElement("div", { className: "nut-step-main" },
|
|
51
|
-
React.createElement("span", { className: "nut-step-title" }, title),
|
|
52
|
-
content && React.createElement("span", { className: "nut-step-content" }, content),
|
|
53
|
-
renderContent && (React.createElement("span", { className: "nut-step-content" }, renderContent())))));
|
|
54
|
-
};
|
|
55
|
-
Step.defaultProps = defaultProps;
|
|
56
|
-
Step.displayName = 'NutStep';
|
|
57
|
-
|
|
58
|
-
export { Step as S };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { D as DataContext } from './UserContext-e402e1a6.js';
|
|
4
|
-
import { c as cn } from './bem-350c1702.js';
|
|
5
|
-
|
|
6
|
-
const defaultProps = {
|
|
7
|
-
current: 0,
|
|
8
|
-
direction: 'horizontal',
|
|
9
|
-
progressDot: false,
|
|
10
|
-
};
|
|
11
|
-
const Steps = (props) => {
|
|
12
|
-
const propSteps = { ...defaultProps, ...props };
|
|
13
|
-
const { children, current, direction, className, progressDot, clickStep, onClickStep, ...restProps } = propSteps;
|
|
14
|
-
const parentSteps = {
|
|
15
|
-
propSteps,
|
|
16
|
-
};
|
|
17
|
-
const b = cn('steps');
|
|
18
|
-
const classes = classNames({
|
|
19
|
-
[`${b('')}-${direction}`]: true,
|
|
20
|
-
[`${b('')}-dot`]: !!props.progressDot,
|
|
21
|
-
}, className, b(''));
|
|
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
|
-
|
|
30
|
-
export { Steps as S };
|
|
@@ -1,136 +0,0 @@
|
|
|
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-d8491423.js';
|
|
5
|
-
import { g as getRectByTaro } from './use-client-rect-1f8ed1fe.js';
|
|
6
|
-
import { g as getScrollParent } from './get-scroll-parent-b4a07e65.js';
|
|
7
|
-
|
|
8
|
-
function useWatch(dep, callback, config = { immediate: false }) {
|
|
9
|
-
const { immediate } = config;
|
|
10
|
-
const prev = useRef();
|
|
11
|
-
const inited = useRef(false);
|
|
12
|
-
const stop = useRef(false);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
const execute = () => callback(prev.current);
|
|
15
|
-
if (!stop.current) {
|
|
16
|
-
if (!inited.current) {
|
|
17
|
-
inited.current = true;
|
|
18
|
-
if (immediate) {
|
|
19
|
-
execute();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
execute();
|
|
24
|
-
}
|
|
25
|
-
prev.current = dep;
|
|
26
|
-
}
|
|
27
|
-
}, [dep]);
|
|
28
|
-
return () => {
|
|
29
|
-
stop.current = true;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const defaultProps = {
|
|
34
|
-
...ComponentDefaults,
|
|
35
|
-
position: 'top',
|
|
36
|
-
zIndex: 2000,
|
|
37
|
-
};
|
|
38
|
-
const classPrefix = 'nut-sticky';
|
|
39
|
-
const Sticky = (props) => {
|
|
40
|
-
const { position, zIndex, threshold, style, children, container, className, onChange, ...rest } = { ...defaultProps, ...props };
|
|
41
|
-
const stickyRef = useRef(null);
|
|
42
|
-
const rootRef = useRef(null);
|
|
43
|
-
const [rootRect, setRootRect] = useState({});
|
|
44
|
-
const [fixed, setFixed] = useState(false);
|
|
45
|
-
const [transform, setTransform] = useState(0); // 相对容器偏移距离
|
|
46
|
-
useWatch(fixed, () => {
|
|
47
|
-
onChange && onChange(fixed);
|
|
48
|
-
});
|
|
49
|
-
const rootStyle = useMemo(() => {
|
|
50
|
-
if (!fixed) {
|
|
51
|
-
return {
|
|
52
|
-
height: '',
|
|
53
|
-
width: '',
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
const style = {};
|
|
57
|
-
if (rootRect.height) {
|
|
58
|
-
style.height = rootRect.height;
|
|
59
|
-
}
|
|
60
|
-
if (rootRect.width) {
|
|
61
|
-
style.width = rootRect.width;
|
|
62
|
-
}
|
|
63
|
-
return style;
|
|
64
|
-
}, [fixed, rootRect.height, rootRect.width]);
|
|
65
|
-
const stickyStyle = useMemo(() => {
|
|
66
|
-
if (!fixed) {
|
|
67
|
-
return {
|
|
68
|
-
height: '',
|
|
69
|
-
width: '',
|
|
70
|
-
[position]: '',
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
const style = {};
|
|
74
|
-
if (rootRect.height)
|
|
75
|
-
style.height = rootRect.height;
|
|
76
|
-
if (rootRect.width)
|
|
77
|
-
style.width = rootRect.width;
|
|
78
|
-
style.transform = `translate3d(0, ${transform}px, 0)`;
|
|
79
|
-
style[position] = threshold;
|
|
80
|
-
style.zIndex = zIndex;
|
|
81
|
-
return style;
|
|
82
|
-
}, [fixed, rootRect.height, rootRect.width, transform, position]);
|
|
83
|
-
const handleScroll = async (scrollTop) => {
|
|
84
|
-
const curRootRect = await getRectByTaro(rootRef.current);
|
|
85
|
-
const stickyRect = await getRectByTaro(stickyRef.current);
|
|
86
|
-
if (curRootRect && stickyRect) {
|
|
87
|
-
setRootRect(curRootRect);
|
|
88
|
-
if (position === 'top') {
|
|
89
|
-
if (container) {
|
|
90
|
-
const containerRect = await getRectByTaro(container.current);
|
|
91
|
-
const difference = containerRect.bottom - threshold - curRootRect.height;
|
|
92
|
-
const curTransform = difference < 0 ? difference : 0;
|
|
93
|
-
setTransform(curTransform);
|
|
94
|
-
const curFixed = threshold > curRootRect.top && containerRect.bottom > 0;
|
|
95
|
-
setFixed(curFixed);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
setFixed(threshold > curRootRect.top);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
const windowHeight = getSystemInfoSync().windowHeight;
|
|
103
|
-
setFixed(windowHeight - threshold < curRootRect.bottom);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
console.log('getRectByTaro获取失败', { stickyRect, curRootRect });
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
const getElement = useCallback(() => {
|
|
111
|
-
return getScrollParent(rootRef.current);
|
|
112
|
-
}, []);
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
if (getEnv() === 'WEB' && getElement() !== window) {
|
|
115
|
-
window.addEventListener('touchmove', handleScroll, true);
|
|
116
|
-
window.addEventListener('scroll', handleScroll, true);
|
|
117
|
-
return () => {
|
|
118
|
-
window.removeEventListener('touchmove', handleScroll);
|
|
119
|
-
window.removeEventListener('scroll', handleScroll);
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
}, []);
|
|
123
|
-
usePageScroll((res) => {
|
|
124
|
-
if (getEnv() === 'WEAPP') {
|
|
125
|
-
handleScroll(res.scrollTop);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
return (React.createElement("div", { ref: rootRef, style: rootStyle, className: classNames(classPrefix, className), ...rest },
|
|
129
|
-
React.createElement("div", { className: classNames('nut-sticky--box', {
|
|
130
|
-
'nut-sticky--fixed': fixed,
|
|
131
|
-
}), ref: stickyRef, style: stickyStyle }, children)));
|
|
132
|
-
};
|
|
133
|
-
Sticky.defaultProps = defaultProps;
|
|
134
|
-
Sticky.displayName = 'NutSticky';
|
|
135
|
-
|
|
136
|
-
export { Sticky as S };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React, { useState, useContext, useRef, useCallback, useEffect } from 'react';
|
|
2
|
-
import { O as OffsetContext } from './offsetContext-c2a746fa.js';
|
|
3
|
-
|
|
4
|
-
const defaultProps = {
|
|
5
|
-
open: true,
|
|
6
|
-
};
|
|
7
|
-
const SubSideNavBar = (props) => {
|
|
8
|
-
const { title, key, children, onClick, open, ...rest } = {
|
|
9
|
-
...defaultProps,
|
|
10
|
-
...props,
|
|
11
|
-
};
|
|
12
|
-
const [subShow, setSubShow] = useState(open);
|
|
13
|
-
const offset = useContext(OffsetContext);
|
|
14
|
-
const listRef = useRef(null);
|
|
15
|
-
const setListLevel = useCallback((nodeList, level = 1) => {
|
|
16
|
-
const titleClass = nodeList[0].className;
|
|
17
|
-
if (titleClass.includes('nut-subsidenavbar__title')) {
|
|
18
|
-
const left = offset * (level + 1);
|
|
19
|
-
nodeList[0].style.paddingLeft = `${left}px`;
|
|
20
|
-
}
|
|
21
|
-
const childNodes = nodeList[1] &&
|
|
22
|
-
nodeList[1].children &&
|
|
23
|
-
Array.from(nodeList[1].children).filter((item) => item.nodeType !== 3 && item.nodeType !== 8);
|
|
24
|
-
childNodes.forEach((item) => {
|
|
25
|
-
const itemClass = item.className;
|
|
26
|
-
if (itemClass.includes('nut-subsidenavbar__item')) {
|
|
27
|
-
const left = offset * (level + 2);
|
|
28
|
-
item.style.paddingLeft = `${left}px`;
|
|
29
|
-
}
|
|
30
|
-
if (itemClass.includes('nut-subsidenavbar__list')) {
|
|
31
|
-
let level = item.getAttribute('level')
|
|
32
|
-
? Number(item.getAttribute('level'))
|
|
33
|
-
: 1;
|
|
34
|
-
level += 1;
|
|
35
|
-
item.setAttribute('level', level.toString());
|
|
36
|
-
item.children && setListLevel(item.children, level);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}, [offset]);
|
|
40
|
-
const clickFn = (e) => {
|
|
41
|
-
e.stopPropagation();
|
|
42
|
-
setSubShow(!subShow);
|
|
43
|
-
const isShow = !subShow;
|
|
44
|
-
onClick && onClick({ title, key, isShow });
|
|
45
|
-
};
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
const childNodes = listRef.current?.children;
|
|
48
|
-
listRef.current?.setAttribute('level', '1');
|
|
49
|
-
childNodes && setListLevel(childNodes);
|
|
50
|
-
}, [setListLevel]);
|
|
51
|
-
const divClass = subShow
|
|
52
|
-
? 'nut-subsidenavbar__list nutShow'
|
|
53
|
-
: 'nut-subsidenavbar__list nutHide';
|
|
54
|
-
const iconClass = subShow ? 'arrow-icon arrow-down' : 'arrow-icon arrow-up';
|
|
55
|
-
return (React.createElement("div", { className: divClass, ref: listRef, onClick: clickFn, ...rest },
|
|
56
|
-
React.createElement("div", { className: "nut-subsidenavbar__title border-bt" },
|
|
57
|
-
title,
|
|
58
|
-
" ",
|
|
59
|
-
React.createElement("i", { className: iconClass })),
|
|
60
|
-
React.createElement("div", { className: "nut-subsidenavbar__content" }, children)));
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export { SubSideNavBar as S };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { c as canUseDom } from './can-use-dom-3eeb5af4.js';
|
|
2
|
-
|
|
3
|
-
let passiveSupported = false;
|
|
4
|
-
if (canUseDom) {
|
|
5
|
-
try {
|
|
6
|
-
const opts = Object.defineProperty({}, 'passive', {
|
|
7
|
-
get() {
|
|
8
|
-
passiveSupported = true;
|
|
9
|
-
},
|
|
10
|
-
});
|
|
11
|
-
window.addEventListener('test-passive-supported', null, opts);
|
|
12
|
-
}
|
|
13
|
-
catch (e) {
|
|
14
|
-
console.log(e);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { passiveSupported as p };
|