@nutui/nutui-react-taro 2.0.0-alpha.4 → 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 +29 -0
- package/dist/esm/ActionSheet.js +15 -16
- package/dist/esm/Address.js +19 -22
- package/dist/esm/Animate.js +7 -8
- package/dist/esm/AnimatingNumbers.js +8 -9
- package/dist/esm/Audio.js +17 -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 -8
- 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 -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 -9
- package/dist/esm/CountDown.js +8 -11
- package/dist/esm/DatePicker.js +21 -24
- package/dist/esm/Dialog.js +13 -16
- 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 -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 +19 -20
- package/dist/esm/Indicator.js +6 -7
- package/dist/esm/Infiniteloading.js +12 -15
- package/dist/esm/Input.js +11 -14
- 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 -19
- package/dist/esm/Overlay.js +8 -9
- package/dist/esm/Pagination.js +9 -12
- package/dist/esm/Picker.js +20 -23
- 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 -14
- package/dist/esm/Radio.js +9 -10
- package/dist/esm/RadioGroup.js +9 -10
- package/dist/esm/Range.js +13 -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 +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/style/index.js +1 -1
- package/dist/esm/Tabbar.js +10 -11
- package/dist/esm/TabbarItem.js +8 -9
- 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 -17
- 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 -11
- package/dist/esm/WaterMark.js +10 -13
- 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 -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-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 +924 -776
- package/dist/nutui.react.umd.js +923 -775
- 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/empty/empty.scss +0 -9
- package/dist/packages/picker/picker.scss +66 -137
- package/dist/packages/tabbar/tabbar.scss +1 -0
- 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/themes/default.scss +0 -1
- package/dist/styles/variables-jmapp.scss +1 -4
- package/dist/styles/variables.scss +2 -6
- package/dist/types/index.d.ts +80 -91
- package/package.json +1 -1
- 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-12cf5a3e.js +0 -53
- package/dist/esm/address.taro-67e32c33.js +0 -461
- package/dist/esm/animate.taro-485331bb.js +0 -41
- package/dist/esm/animatingnumbers.taro-f6eaffef.js +0 -104
- package/dist/esm/audio.taro-51eafc9d.js +0 -162
- package/dist/esm/avatar.taro-a840f345.js +0 -105
- package/dist/esm/avatargroup-0eadb514.js +0 -34
- 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-b3ebdc35.js +0 -65
- package/dist/esm/calendaritem.taro-ab1ec154.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-660faffc.js +0 -24
- package/dist/esm/checkbox.taro-ae460d3a.js +0 -168
- 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-9960f0fb.js +0 -19
- package/dist/esm/configprovider.taro-43a3c646.js +0 -45
- package/dist/esm/countdown.taro-c14b5c1f.js +0 -225
- package/dist/esm/datepicker.taro-7d522ff8.js +0 -275
- package/dist/esm/dialog.taro-f9ca73a2.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-360a831f.js +0 -185
- package/dist/esm/ellipsis.taro-79044d54.js +0 -241
- package/dist/esm/empty.taro-f8585835.js +0 -62
- package/dist/esm/fixednav.taro-cca9a6df.js +0 -54
- package/dist/esm/form.taro-7413d868.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-10eb7716.js +0 -49
- package/dist/esm/griditem.taro-fb15eeec.js +0 -80
- package/dist/esm/image.taro-b897a058.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-cce53c60.js +0 -141
- package/dist/esm/input.taro-1aca4a45.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-10ab54d6.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-df441058.js +0 -91
- package/dist/esm/picker.taro-9f1bb6a4.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-37dadbc5.js +0 -181
- package/dist/esm/radio.taro-36438449.js +0 -177
- package/dist/esm/range.taro-432d20d7.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-4aa300df.js +0 -152
- package/dist/esm/shortpassword.taro-99645f99.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-e5ede25a.js +0 -143
- package/dist/esm/skeleton.taro-fabd423a.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-b18a73ff.js +0 -177
- 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-eca757f3.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-e256e741.js +0 -94
- package/dist/esm/timedetail.taro-cae362b9.js +0 -44
- package/dist/esm/timepannel.taro-d6f4cf80.js +0 -22
- package/dist/esm/timeselect.taro-804199f9.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-716f9a50.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-0bd611cb.js +0 -214
- package/dist/esm/watermark.taro-8966896a.js +0 -114
- package/dist/esm/zh-CN-b4f493ba.js +0 -131
- package/dist/packages/icon/icon.scss +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import React, { useRef, useState, useEffect } from "react";
|
|
2
|
+
import { getEnv } from "@tarojs/taro";
|
|
3
|
+
import { Search, CircleClose } from "@nutui/icons-react-taro";
|
|
4
|
+
import { c as cn } from "./bem-cdccae08.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
|
+
placeholder: "",
|
|
10
|
+
shape: "square",
|
|
11
|
+
disabled: false,
|
|
12
|
+
maxLength: 9999,
|
|
13
|
+
clearable: true,
|
|
14
|
+
clearSize: "12px",
|
|
15
|
+
align: "left",
|
|
16
|
+
readonly: true,
|
|
17
|
+
autoFocus: false,
|
|
18
|
+
label: "",
|
|
19
|
+
leftinIcon: React.createElement(Search, { size: "12" })
|
|
20
|
+
};
|
|
21
|
+
const SearchBar = (props) => {
|
|
22
|
+
const searchbarBem = cn("searchbar");
|
|
23
|
+
const { locale } = useConfig();
|
|
24
|
+
const searchRef = useRef(null);
|
|
25
|
+
const [value, setValue] = useState(() => props.value);
|
|
26
|
+
const { placeholder, shape, className, disabled, maxLength, clearable, clearSize, align, readOnly, autoFocus, label, actionText, leftinIcon, rightinIcon, leftoutIcon, rightoutIcon, onChange, onFocus, onBlur, onClear, onCancel, onSearch, onClickInput, onClickLeftinIcon, onClickLeftoutIcon, onClickRightinIcon, onClickRightoutIcon } = {
|
|
27
|
+
...defaultProps,
|
|
28
|
+
...props
|
|
29
|
+
};
|
|
30
|
+
const alignClass = `${align}`;
|
|
31
|
+
const forceFocus = () => {
|
|
32
|
+
const searchSelf = searchRef.current;
|
|
33
|
+
searchSelf && searchSelf.focus();
|
|
34
|
+
};
|
|
35
|
+
const change = (event) => {
|
|
36
|
+
const { value: value2 } = event.target;
|
|
37
|
+
onChange && (onChange == null ? void 0 : onChange(value2, event));
|
|
38
|
+
setValue(value2);
|
|
39
|
+
value2 === "" && forceFocus();
|
|
40
|
+
};
|
|
41
|
+
const focus = (event) => {
|
|
42
|
+
const { value: value2 } = event.target;
|
|
43
|
+
onFocus && (onFocus == null ? void 0 : onFocus(value2, event));
|
|
44
|
+
};
|
|
45
|
+
const blur = (event) => {
|
|
46
|
+
const searchSelf = searchRef.current;
|
|
47
|
+
searchSelf && searchSelf.blur();
|
|
48
|
+
const { value: value2 } = event.target;
|
|
49
|
+
onBlur && (onBlur == null ? void 0 : onBlur(value2, event));
|
|
50
|
+
};
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
setValue(props.value);
|
|
53
|
+
}, [props.value]);
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
autoFocus && forceFocus();
|
|
56
|
+
}, [autoFocus]);
|
|
57
|
+
const renderField = () => {
|
|
58
|
+
return React.createElement("input", { className: `${searchbarBem("input")} ${searchbarBem(alignClass)} ${shape === "round" ? searchbarBem("round") : ""} ${clearable ? searchbarBem("input-clear") : ""}`, ref: searchRef, style: { ...props.style }, value: value || "", placeholder: placeholder || locale.placeholder, disabled, readOnly, maxLength, onKeyPress: onKeypress, onChange: (e) => change(e), onFocus: (e) => focus(e), onBlur: (e) => blur(e), onClick: (e) => clickInput(e) });
|
|
59
|
+
};
|
|
60
|
+
const clickInput = (e) => {
|
|
61
|
+
onClickInput && onClickInput(e);
|
|
62
|
+
};
|
|
63
|
+
const renderLeftinIcon = () => {
|
|
64
|
+
if (!leftinIcon)
|
|
65
|
+
return null;
|
|
66
|
+
return React.createElement("div", { className: `${searchbarBem("leftin-icon")} ${searchbarBem("icon")}`, onClick: (e) => clickLeftIcon("in-left", e) }, leftinIcon);
|
|
67
|
+
};
|
|
68
|
+
const renderLeftoutIcon = () => {
|
|
69
|
+
if (!leftoutIcon)
|
|
70
|
+
return null;
|
|
71
|
+
return React.createElement("div", { className: `${searchbarBem("leftout-icon")}`, onClick: (e) => clickLeftIcon("out-left", e) }, leftoutIcon);
|
|
72
|
+
};
|
|
73
|
+
const clickLeftIcon = (flag, event) => {
|
|
74
|
+
if (flag === "in-left") {
|
|
75
|
+
onClickLeftinIcon && onClickLeftinIcon(value, event);
|
|
76
|
+
} else {
|
|
77
|
+
onClickLeftoutIcon && onClickLeftoutIcon(value, event);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const renderRightinIcon = () => {
|
|
81
|
+
if (!rightinIcon)
|
|
82
|
+
return null;
|
|
83
|
+
return React.createElement("div", { className: `${searchbarBem("rightin-icon")} ${searchbarBem("icon")}`, onClick: (e) => clickRightIcon("in-right", e) }, rightinIcon);
|
|
84
|
+
};
|
|
85
|
+
const renderRightoutIcon = () => {
|
|
86
|
+
if (!rightoutIcon)
|
|
87
|
+
return null;
|
|
88
|
+
return React.createElement("div", { className: `${searchbarBem("rightout-icon")}`, onClick: (e) => clickRightIcon("out-right", e) }, rightoutIcon);
|
|
89
|
+
};
|
|
90
|
+
const clickRightIcon = (flag, event) => {
|
|
91
|
+
if (flag === "in-left") {
|
|
92
|
+
onClickRightinIcon && onClickRightinIcon(value, event);
|
|
93
|
+
} else {
|
|
94
|
+
onClickRightoutIcon && onClickRightoutIcon(value, event);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const handleClear = () => {
|
|
98
|
+
return React.createElement(
|
|
99
|
+
"div",
|
|
100
|
+
{ className: `${searchbarBem("clear")} ${rightinIcon ? "pos-right" : ""}`, onClick: (e) => clearaVal(e) },
|
|
101
|
+
React.createElement(CircleClose, { size: clearSize, color: "#555" })
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
const clearaVal = (event) => {
|
|
105
|
+
if (disabled || readOnly) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
setValue("");
|
|
109
|
+
onClear && onClear(event);
|
|
110
|
+
forceFocus();
|
|
111
|
+
};
|
|
112
|
+
const renderRightLabel = () => {
|
|
113
|
+
if (actionText) {
|
|
114
|
+
return React.createElement("div", { className: searchbarBem("action-text"), onClick: search }, actionText);
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
};
|
|
118
|
+
const onKeypress = (e) => {
|
|
119
|
+
if (e.keyCode === 13) {
|
|
120
|
+
if (typeof e.cancelable !== "boolean" || e.cancelable) {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
}
|
|
123
|
+
onSearch && onSearch(value);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const search = () => {
|
|
127
|
+
onSearch && onSearch(value);
|
|
128
|
+
};
|
|
129
|
+
const renderLabel = () => {
|
|
130
|
+
if (label) {
|
|
131
|
+
return React.createElement("div", { className: searchbarBem("label") }, label);
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
};
|
|
135
|
+
const envClass = () => {
|
|
136
|
+
return getEnv() === "WEB" ? "nut-searchbar-taro" : "";
|
|
137
|
+
};
|
|
138
|
+
return React.createElement(
|
|
139
|
+
"div",
|
|
140
|
+
{ className: `${searchbarBem()} ${envClass()} ${disabled ? searchbarBem("disabled") : ""} ${className || ""}`, style: { ...props.style, background: props.background } },
|
|
141
|
+
renderLeftoutIcon(),
|
|
142
|
+
renderLabel(),
|
|
143
|
+
React.createElement(
|
|
144
|
+
"div",
|
|
145
|
+
{ className: `${searchbarBem("content")}`, style: { background: props.inputBackground } },
|
|
146
|
+
renderLeftinIcon(),
|
|
147
|
+
React.createElement("div", { className: "nut-searchbar__input-box" }, renderField()),
|
|
148
|
+
renderRightinIcon(),
|
|
149
|
+
clearable && value && handleClear()
|
|
150
|
+
),
|
|
151
|
+
renderRightoutIcon(),
|
|
152
|
+
renderRightLabel()
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
SearchBar.defaultProps = defaultProps;
|
|
156
|
+
SearchBar.displayName = "NutSearchBar";
|
|
157
|
+
export {
|
|
158
|
+
SearchBar as S
|
|
159
|
+
};
|
|
@@ -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,66 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { D as DataContext } from "./UserContext-fde5badc.js";
|
|
4
|
+
import { c as cn } from "./bem-cdccae08.js";
|
|
5
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
6
|
+
const defaultProps = {
|
|
7
|
+
...ComponentDefaults,
|
|
8
|
+
title: "",
|
|
9
|
+
content: "",
|
|
10
|
+
activeIndex: 0,
|
|
11
|
+
icon: ""
|
|
12
|
+
};
|
|
13
|
+
const Step = (props) => {
|
|
14
|
+
const { children, title, content, activeIndex, icon, className, renderContent, ...restProps } = {
|
|
15
|
+
...defaultProps,
|
|
16
|
+
...props
|
|
17
|
+
};
|
|
18
|
+
const parent = useContext(DataContext);
|
|
19
|
+
const dot = parent.propSteps.progressDot;
|
|
20
|
+
const getCurrentStatus = () => {
|
|
21
|
+
const index = activeIndex;
|
|
22
|
+
if (index < +parent.propSteps.current)
|
|
23
|
+
return "finish";
|
|
24
|
+
return index === +parent.propSteps.current ? "process" : "wait";
|
|
25
|
+
};
|
|
26
|
+
const handleClickStep = () => {
|
|
27
|
+
var _a, _b, _c, _d;
|
|
28
|
+
((_a = parent.propSteps) == null ? void 0 : _a.onClickStep) && ((_b = parent.propSteps) == null ? void 0 : _b.onClickStep(activeIndex));
|
|
29
|
+
((_c = parent.propSteps) == null ? void 0 : _c.clickStep) && ((_d = parent.propSteps) == null ? void 0 : _d.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(
|
|
45
|
+
"div",
|
|
46
|
+
{ className: classes, ...restProps, onClick: handleClickStep },
|
|
47
|
+
React.createElement(
|
|
48
|
+
"div",
|
|
49
|
+
{ className: "nut-step-head" },
|
|
50
|
+
React.createElement("div", { className: "nut-step-line" }),
|
|
51
|
+
React.createElement("div", { className: renderIconClass() }, React.isValidElement(icon) ? icon : !dot && React.createElement("span", { className: "nut-step-inner" }, activeIndex))
|
|
52
|
+
),
|
|
53
|
+
React.createElement(
|
|
54
|
+
"div",
|
|
55
|
+
{ className: "nut-step-main" },
|
|
56
|
+
React.createElement("span", { className: "nut-step-title" }, title),
|
|
57
|
+
content && React.createElement("span", { className: "nut-step-content" }, content),
|
|
58
|
+
renderContent && React.createElement("span", { className: "nut-step-content" }, renderContent())
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
Step.defaultProps = defaultProps;
|
|
63
|
+
Step.displayName = "NutStep";
|
|
64
|
+
export {
|
|
65
|
+
Step as S
|
|
66
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { D as DataContext } from "./UserContext-fde5badc.js";
|
|
4
|
+
import { c as cn } from "./bem-cdccae08.js";
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
current: 0,
|
|
7
|
+
direction: "horizontal",
|
|
8
|
+
progressDot: false
|
|
9
|
+
};
|
|
10
|
+
const Steps = (props) => {
|
|
11
|
+
const propSteps = { ...defaultProps, ...props };
|
|
12
|
+
const { children, current, direction, className, progressDot, clickStep, onClickStep, ...restProps } = propSteps;
|
|
13
|
+
const parentSteps = {
|
|
14
|
+
propSteps
|
|
15
|
+
};
|
|
16
|
+
const b = cn("steps");
|
|
17
|
+
const classes = classNames({
|
|
18
|
+
[`${b("")}-${direction}`]: true,
|
|
19
|
+
[`${b("")}-dot`]: !!props.progressDot
|
|
20
|
+
}, className, b(""));
|
|
21
|
+
return React.createElement(DataContext.Provider, { value: parentSteps }, React.createElement("div", {
|
|
22
|
+
className: classes,
|
|
23
|
+
...restProps
|
|
24
|
+
}, children));
|
|
25
|
+
};
|
|
26
|
+
Steps.defaultProps = defaultProps;
|
|
27
|
+
Steps.displayName = "NutSteps";
|
|
28
|
+
export {
|
|
29
|
+
Steps as S
|
|
30
|
+
};
|