@nutui/nutui-react-taro 2.0.0-alpha.5 → 2.0.0-alpha.7
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 +18 -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-0a2694ed.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-b75f20ff.js +139 -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 +507 -447
- package/dist/nutui.react.umd.js +506 -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
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
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
|
+
const defaultProps = {
|
|
7
|
+
confirmText: "",
|
|
8
|
+
title: "",
|
|
9
|
+
visible: false,
|
|
10
|
+
overlay: false,
|
|
11
|
+
type: "default",
|
|
12
|
+
customKey: [],
|
|
13
|
+
className: "",
|
|
14
|
+
randomKeys: false,
|
|
15
|
+
popClass: "",
|
|
16
|
+
onClose: () => {
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const NumberKeyboard = (props) => {
|
|
20
|
+
const { locale } = useConfig();
|
|
21
|
+
const { title, confirmText, visible, overlay, type, customKey, randomKeys, popClass, style, className, onChange, onDelete, onClose } = props;
|
|
22
|
+
const b = cn("numberkeyboard");
|
|
23
|
+
const [show, setShow] = useState(visible);
|
|
24
|
+
const [clickKeyIndex, setClickKeyIndex] = useState(void 0);
|
|
25
|
+
const [keysList, setKeysList] = useState([]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setShow(visible);
|
|
28
|
+
}, [visible]);
|
|
29
|
+
const defaultKey = () => {
|
|
30
|
+
let leftBottomKey = {
|
|
31
|
+
id: "lock",
|
|
32
|
+
type: "lock"
|
|
33
|
+
};
|
|
34
|
+
if (customKey) {
|
|
35
|
+
const customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
36
|
+
if (customKeys.length > 0) {
|
|
37
|
+
const newCustomKey = customKeys[0];
|
|
38
|
+
leftBottomKey = {
|
|
39
|
+
id: newCustomKey,
|
|
40
|
+
type: "custom"
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return [
|
|
45
|
+
...getBasicKeys(),
|
|
46
|
+
leftBottomKey,
|
|
47
|
+
{ id: 0, type: "number" },
|
|
48
|
+
{ id: "delete", type: "delete" }
|
|
49
|
+
];
|
|
50
|
+
};
|
|
51
|
+
const getBasicKeys = () => {
|
|
52
|
+
const keys = [];
|
|
53
|
+
for (let i = 1; i <= 9; i++) {
|
|
54
|
+
keys.push({ id: i, type: "number" });
|
|
55
|
+
}
|
|
56
|
+
if (randomKeys) {
|
|
57
|
+
return keys.sort(() => Math.random() > 0.5 ? 1 : -1);
|
|
58
|
+
}
|
|
59
|
+
return keys;
|
|
60
|
+
};
|
|
61
|
+
const genCustomKeys = () => {
|
|
62
|
+
const keys = getBasicKeys();
|
|
63
|
+
if (!customKey)
|
|
64
|
+
return [];
|
|
65
|
+
let customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
66
|
+
if (customKeys.length > 2) {
|
|
67
|
+
customKeys = [customKeys[0], customKeys[1]];
|
|
68
|
+
}
|
|
69
|
+
if (customKeys.length === 2 && props.title && props.type !== "rightColumn") {
|
|
70
|
+
customKeys = [customKeys[0]];
|
|
71
|
+
}
|
|
72
|
+
if (customKeys.length === 1) {
|
|
73
|
+
if (props.title && props.type !== "rightColumn") {
|
|
74
|
+
keys.push({ id: customKeys[0], type: "custom" }, { id: 0, type: "number" }, { id: "delete", type: "delete" });
|
|
75
|
+
} else {
|
|
76
|
+
keys.push({ id: 0, type: "number" }, { id: customKeys[0], type: "custom" });
|
|
77
|
+
}
|
|
78
|
+
} else if (customKeys.length === 2) {
|
|
79
|
+
keys.push({ id: customKeys[0], type: "custom" }, { id: 0, type: "number" }, { id: customKeys[1], type: "custom" });
|
|
80
|
+
}
|
|
81
|
+
return keys;
|
|
82
|
+
};
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (props.type === "rightColumn" || props.title !== "") {
|
|
85
|
+
setKeysList(genCustomKeys());
|
|
86
|
+
} else {
|
|
87
|
+
setKeysList(defaultKey());
|
|
88
|
+
}
|
|
89
|
+
}, []);
|
|
90
|
+
const onTouchstart = (item, event) => {
|
|
91
|
+
event.stopPropagation();
|
|
92
|
+
setClickKeyIndex(item.id);
|
|
93
|
+
if (item.type === "number" || item.type === "custom") {
|
|
94
|
+
onChange && onChange(item.id);
|
|
95
|
+
}
|
|
96
|
+
if (item.type === "lock") {
|
|
97
|
+
onClose && onClose();
|
|
98
|
+
}
|
|
99
|
+
if (item.type === "delete") {
|
|
100
|
+
onDelete && onDelete();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const onTouchMove = (event) => {
|
|
104
|
+
event.stopPropagation();
|
|
105
|
+
};
|
|
106
|
+
const onTouchEnd = (event) => {
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
setClickKeyIndex(void 0);
|
|
109
|
+
};
|
|
110
|
+
return React.createElement(
|
|
111
|
+
"div",
|
|
112
|
+
null,
|
|
113
|
+
React.createElement(
|
|
114
|
+
Popup,
|
|
115
|
+
{ visible: show, overlay, position: "bottom", className: popClass, onClickOverlay: onClose, onClickCloseIcon: onClose, overlayStyle: { backgroundColor: "rgba(0, 0, 0, 0)" } },
|
|
116
|
+
React.createElement(
|
|
117
|
+
"div",
|
|
118
|
+
{ className: `${b()} ${className}`, style: { ...style } },
|
|
119
|
+
title ? React.createElement(
|
|
120
|
+
"div",
|
|
121
|
+
{ className: b("header") },
|
|
122
|
+
React.createElement("h3", { className: b("header__tit") }, title),
|
|
123
|
+
type === "default" ? React.createElement("span", { className: b("header__close"), onClick: onClose }, locale.done) : null
|
|
124
|
+
) : null,
|
|
125
|
+
React.createElement(
|
|
126
|
+
"div",
|
|
127
|
+
{ className: b("body") },
|
|
128
|
+
React.createElement("div", { className: b("body__keys") }, keysList == null ? void 0 : keysList.map((item, index) => {
|
|
129
|
+
return React.createElement(
|
|
130
|
+
"div",
|
|
131
|
+
{ key: index, className: classNames({
|
|
132
|
+
"key-board-wrapper": true,
|
|
133
|
+
"key-board-wrapper-large": item.id === 0 && type === "rightColumn" && Array.isArray(customKey) && customKey.length === 1
|
|
134
|
+
}) },
|
|
135
|
+
React.createElement(
|
|
136
|
+
"div",
|
|
137
|
+
{ className: classNames({
|
|
138
|
+
key: true,
|
|
139
|
+
active: item.id === clickKeyIndex,
|
|
140
|
+
lock: item.type === "lock",
|
|
141
|
+
delete: item.type === "delete"
|
|
142
|
+
}), onTouchStart: (event) => onTouchstart(item, event), onTouchMove, onTouchEnd },
|
|
143
|
+
item.type === "number" || item.type === "custom" ? React.createElement("div", null, item.id) : null,
|
|
144
|
+
item.type === "lock" ? React.createElement("img", { src: "https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png", alt: "" }) : null,
|
|
145
|
+
item.type === "delete" ? React.createElement("img", { src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png", alt: "" }) : null
|
|
146
|
+
)
|
|
147
|
+
);
|
|
148
|
+
})),
|
|
149
|
+
type === "rightColumn" ? React.createElement(
|
|
150
|
+
"div",
|
|
151
|
+
{ className: b("sidebar") },
|
|
152
|
+
React.createElement(
|
|
153
|
+
"div",
|
|
154
|
+
{ className: "key-board-wrapper" },
|
|
155
|
+
React.createElement(
|
|
156
|
+
"div",
|
|
157
|
+
{ className: classNames({
|
|
158
|
+
key: true,
|
|
159
|
+
active: clickKeyIndex === "delete"
|
|
160
|
+
}), onTouchStart: (event) => onTouchstart({ id: "delete", type: "delete" }, event), onTouchMove, onTouchEnd },
|
|
161
|
+
React.createElement("img", { src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png", alt: "" })
|
|
162
|
+
)
|
|
163
|
+
),
|
|
164
|
+
React.createElement(
|
|
165
|
+
"div",
|
|
166
|
+
{ className: "key-board-wrapper key-board-finish", onClick: onClose },
|
|
167
|
+
React.createElement("div", { className: classNames({
|
|
168
|
+
key: true,
|
|
169
|
+
finish: true,
|
|
170
|
+
activeFinsh: clickKeyIndex === "finish"
|
|
171
|
+
}) }, confirmText || locale.done)
|
|
172
|
+
)
|
|
173
|
+
) : null
|
|
174
|
+
)
|
|
175
|
+
)
|
|
176
|
+
)
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
NumberKeyboard.defaultProps = defaultProps;
|
|
180
|
+
NumberKeyboard.displayName = "NutNumberKeyboard";
|
|
181
|
+
export {
|
|
182
|
+
NumberKeyboard as N
|
|
183
|
+
};
|
|
@@ -1,116 +1,211 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
import
|
|
93
|
-
import
|
|
94
|
-
import
|
|
95
|
-
import
|
|
96
|
-
import
|
|
97
|
-
import
|
|
98
|
-
import
|
|
99
|
-
import
|
|
100
|
-
import
|
|
101
|
-
import
|
|
102
|
-
import
|
|
103
|
-
import
|
|
104
|
-
import
|
|
105
|
-
import
|
|
106
|
-
import
|
|
107
|
-
import
|
|
108
|
-
import
|
|
109
|
-
import
|
|
110
|
-
import
|
|
111
|
-
import
|
|
112
|
-
import
|
|
113
|
-
import
|
|
114
|
-
import
|
|
115
|
-
import
|
|
116
|
-
import
|
|
1
|
+
import { B } from "./button.taro-01eae688.js";
|
|
2
|
+
import { C } from "./cell.taro-4e31d1fa.js";
|
|
3
|
+
import { C as C2 } from "./cellgroup.taro-a790d91b.js";
|
|
4
|
+
import { C as C3 } from "./configprovider.taro-25758d9f.js";
|
|
5
|
+
import { I } from "./image.taro-767aa000.js";
|
|
6
|
+
import { O } from "./overlay.taro-75012bd3.js";
|
|
7
|
+
import { C as C4 } from "./col.taro-d6a46a7d.js";
|
|
8
|
+
import { D } from "./divider.taro-0cb5f894.js";
|
|
9
|
+
import { G } from "./grid.taro-fbbd8618.js";
|
|
10
|
+
import { G as G2 } from "./griditem.taro-b0c37077.js";
|
|
11
|
+
import { L } from "./layout.taro-9659a928.js";
|
|
12
|
+
import { R } from "./row.taro-8b7febd4.js";
|
|
13
|
+
import { S } from "./sticky.taro-3c03eb0a.js";
|
|
14
|
+
import { B as B2 } from "./backtop.taro-7de36464.js";
|
|
15
|
+
import { E } from "./elevator.taro-bc162e4f.js";
|
|
16
|
+
import { F } from "./fixednav.taro-28e5f776.js";
|
|
17
|
+
import { N } from "./navbar.taro-5e1a0835.js";
|
|
18
|
+
import { S as S2 } from "./sidenavbar.taro-9f210df4.js";
|
|
19
|
+
import { S as S3 } from "./sidenavbaritem.taro-32a45ce6.js";
|
|
20
|
+
import { S as S4 } from "./subsidenavbar.taro-abe07673.js";
|
|
21
|
+
import { T } from "./tabbar.taro-18eee41f.js";
|
|
22
|
+
import { T as T2 } from "./tabbaritem.taro-89646ca1.js";
|
|
23
|
+
import { T as T3 } from "./tabpane.taro-f8d92ece.js";
|
|
24
|
+
import { T as T4 } from "./tabs.taro-b75f20ff.js";
|
|
25
|
+
import { A } from "./address.taro-1c534feb.js";
|
|
26
|
+
import { C as C5 } from "./calendar.taro-10a6cb11.js";
|
|
27
|
+
import { C as C6 } from "./calendaritem.taro-3e5f114e.js";
|
|
28
|
+
import { C as C7 } from "./cascader.taro-0a2694ed.js";
|
|
29
|
+
import { C as C8, a } from "./checkbox.taro-016074da.js";
|
|
30
|
+
import { D as D2 } from "./datepicker.taro-3f718964.js";
|
|
31
|
+
import { F as F2 } from "./form.taro-b06754e8.js";
|
|
32
|
+
import { F as F3 } from "./formitem.taro-b326809d.js";
|
|
33
|
+
import { I as I2 } from "./input.taro-27d686c9.js";
|
|
34
|
+
import { I as I3 } from "./inputnumber.taro-877dc947.js";
|
|
35
|
+
import { M } from "./menu.taro-cd0fef41.js";
|
|
36
|
+
import { M as M2 } from "./menuitem.taro-6076bffa.js";
|
|
37
|
+
import { N as N2 } from "./numberkeyboard.taro-0a0e866a.js";
|
|
38
|
+
import { P } from "./picker.taro-a5603921.js";
|
|
39
|
+
import { R as R2, a as a2 } from "./radio.taro-3a54f4c8.js";
|
|
40
|
+
import { R as R3 } from "./range.taro-52cda918.js";
|
|
41
|
+
import { R as R4 } from "./rate.taro-78c66969.js";
|
|
42
|
+
import { S as S5 } from "./searchbar.taro-37ade36e.js";
|
|
43
|
+
import { S as S6 } from "./shortpassword.taro-f7292032.js";
|
|
44
|
+
import { S as S7 } from "./signature.taro-c57469aa.js";
|
|
45
|
+
import { S as S8 } from "./switch.taro-f0da73a3.js";
|
|
46
|
+
import { T as T5 } from "./textarea.taro-c110565e.js";
|
|
47
|
+
import { U } from "./uploader.taro-92977813.js";
|
|
48
|
+
import { A as A2 } from "./actionsheet.taro-d2217152.js";
|
|
49
|
+
import { B as B3 } from "./badge.taro-872605bf.js";
|
|
50
|
+
import { B as B4 } from "./dialog.taro-290eb9a6.js";
|
|
51
|
+
import { D as D3 } from "./drag.taro-48e1ff38.js";
|
|
52
|
+
import { E as E2 } from "./empty.taro-ca792f57.js";
|
|
53
|
+
import { I as I4 } from "./infiniteloading.taro-f8f23ac6.js";
|
|
54
|
+
import { N as N3 } from "./noticebar.taro-b3bfd4fe.js";
|
|
55
|
+
import { N as N4 } from "./notify.taro-6b6eb6bf.js";
|
|
56
|
+
import { P as P2 } from "./popover.taro-ad483372.js";
|
|
57
|
+
import { P as P3 } from "./pulltorefresh.taro-c611fd92.js";
|
|
58
|
+
import { S as S9 } from "./skeleton.taro-9ff9baf4.js";
|
|
59
|
+
import { S as S10 } from "./swipe.taro-de80fcd8.js";
|
|
60
|
+
import { P as P4 } from "./popup.taro-e756f3fc.js";
|
|
61
|
+
import { T as T6 } from "./toast.taro-92c10e1d.js";
|
|
62
|
+
import { A as A3 } from "./animate.taro-c8b29242.js";
|
|
63
|
+
import { A as A4 } from "./animatingnumbers.taro-c2a52dbd.js";
|
|
64
|
+
import { A as A5 } from "./audio.taro-ec96ef80.js";
|
|
65
|
+
import { A as A6 } from "./avatar.taro-01536aff.js";
|
|
66
|
+
import { A as A7 } from "./avatargroup-ad5ffb46.js";
|
|
67
|
+
import { C as C9 } from "./circleprogress.taro-7149e09d.js";
|
|
68
|
+
import { C as C10 } from "./collapse.taro-3d997680.js";
|
|
69
|
+
import { C as C11 } from "./collapseitem-f4571575.js";
|
|
70
|
+
import { C as C12 } from "./countdown.taro-22200811.js";
|
|
71
|
+
import { E as E3 } from "./ellipsis.taro-f9688dd7.js";
|
|
72
|
+
import { I as I5 } from "./imagepreview.taro-8832dc01.js";
|
|
73
|
+
import { I as I6 } from "./indicator.taro-f2bd212f.js";
|
|
74
|
+
import { V } from "./virtuallist.taro-99f03769.js";
|
|
75
|
+
import { P as P5 } from "./pagination.taro-63607c3b.js";
|
|
76
|
+
import { P as P6 } from "./price.taro-c4f45310.js";
|
|
77
|
+
import { P as P7 } from "./progress.taro-ff63be75.js";
|
|
78
|
+
import { S as S11 } from "./step.taro-3bc01c0c.js";
|
|
79
|
+
import { S as S12 } from "./steps.taro-77e301ab.js";
|
|
80
|
+
import { S as S13 } from "./swiper.taro-74cf9306.js";
|
|
81
|
+
import { S as S14 } from "./swiperitem-80df464a.js";
|
|
82
|
+
import { T as T7 } from "./table.taro-15a55c5d.js";
|
|
83
|
+
import { T as T8 } from "./tag.taro-1b4134a5.js";
|
|
84
|
+
import { V as V2 } from "./video-5d106e33.js";
|
|
85
|
+
import { B as B5 } from "./barrage.taro-c8cb9864.js";
|
|
86
|
+
import { C as C13 } from "./card.taro-a46fdf25.js";
|
|
87
|
+
import { T as T9 } from "./timedetail.taro-8d2acbbf.js";
|
|
88
|
+
import { T as T10 } from "./timepannel.taro-ee4c5dfa.js";
|
|
89
|
+
import { T as T11 } from "./timeselect.taro-069deedd.js";
|
|
90
|
+
import { T as T12 } from "./trendarrow.taro-0cf43935.js";
|
|
91
|
+
import { W } from "./watermark.taro-cef29c03.js";
|
|
92
|
+
import "react";
|
|
93
|
+
import "classnames";
|
|
94
|
+
import "@nutui/icons-react-taro";
|
|
95
|
+
import "./typings-11d83a22.js";
|
|
96
|
+
import "@tarojs/components";
|
|
97
|
+
import "./UserContext-ab42ba7f.js";
|
|
98
|
+
import "@tarojs/taro";
|
|
99
|
+
import "./use-client-rect-f317804e.js";
|
|
100
|
+
import "./get-scroll-parent-8da04f2e.js";
|
|
101
|
+
import "./can-use-dom-0e539bd3.js";
|
|
102
|
+
import "./offsetContext-f32a9246.js";
|
|
103
|
+
import "./use-props-value-7ac1b1b5.js";
|
|
104
|
+
import "./bem-cdccae08.js";
|
|
105
|
+
import "@bem-react/classname";
|
|
106
|
+
import "./ConfigProvider.js";
|
|
107
|
+
import "react-transition-group";
|
|
108
|
+
import "./use-touch-ff43512c.js";
|
|
109
|
+
import "./supports-passive-aaaf0eff.js";
|
|
110
|
+
import "./index-e3184f19.js";
|
|
111
|
+
import "@use-gesture/react";
|
|
112
|
+
import "@react-spring/web";
|
|
113
|
+
import "react-dom";
|
|
114
|
+
import "./context-d0fccf11.js";
|
|
115
|
+
import "./UserContext-fde5badc.js";
|
|
116
|
+
import "./UserContext-735db09f.js";
|
|
117
|
+
export {
|
|
118
|
+
A2 as ActionSheet,
|
|
119
|
+
A as Address,
|
|
120
|
+
A3 as Animate,
|
|
121
|
+
A4 as AnimatingNumbers,
|
|
122
|
+
A5 as Audio,
|
|
123
|
+
A6 as Avatar,
|
|
124
|
+
A7 as AvatarGroup,
|
|
125
|
+
B2 as BackTop,
|
|
126
|
+
B3 as Badge,
|
|
127
|
+
B5 as Barrage,
|
|
128
|
+
B as Button,
|
|
129
|
+
C5 as Calendar,
|
|
130
|
+
C6 as CalendarItem,
|
|
131
|
+
C13 as Card,
|
|
132
|
+
C7 as Cascader,
|
|
133
|
+
C as Cell,
|
|
134
|
+
C2 as CellGroup,
|
|
135
|
+
C8 as Checkbox,
|
|
136
|
+
a as CheckboxGroup,
|
|
137
|
+
C9 as CircleProgress,
|
|
138
|
+
C4 as Col,
|
|
139
|
+
C10 as Collapse,
|
|
140
|
+
C11 as CollapseItem,
|
|
141
|
+
C3 as ConfigProvider,
|
|
142
|
+
C12 as CountDown,
|
|
143
|
+
D2 as DatePicker,
|
|
144
|
+
B4 as Dialog,
|
|
145
|
+
D as Divider,
|
|
146
|
+
D3 as Drag,
|
|
147
|
+
E as Elevator,
|
|
148
|
+
E3 as Ellipsis,
|
|
149
|
+
E2 as Empty,
|
|
150
|
+
F as FixedNav,
|
|
151
|
+
F2 as Form,
|
|
152
|
+
F3 as FormItem,
|
|
153
|
+
G as Grid,
|
|
154
|
+
G2 as GridItem,
|
|
155
|
+
I as Image,
|
|
156
|
+
I5 as ImagePreview,
|
|
157
|
+
I6 as Indicator,
|
|
158
|
+
I4 as Infiniteloading,
|
|
159
|
+
I2 as Input,
|
|
160
|
+
I3 as InputNumber,
|
|
161
|
+
L as Layout,
|
|
162
|
+
M as Menu,
|
|
163
|
+
M2 as MenuItem,
|
|
164
|
+
N as NavBar,
|
|
165
|
+
N3 as NoticeBar,
|
|
166
|
+
N4 as Notify,
|
|
167
|
+
N2 as NumberKeyboard,
|
|
168
|
+
O as Overlay,
|
|
169
|
+
P5 as Pagination,
|
|
170
|
+
P as Picker,
|
|
171
|
+
P2 as Popover,
|
|
172
|
+
P4 as Popup,
|
|
173
|
+
P6 as Price,
|
|
174
|
+
P7 as Progress,
|
|
175
|
+
P3 as PullToRefresh,
|
|
176
|
+
R2 as Radio,
|
|
177
|
+
a2 as RadioGroup,
|
|
178
|
+
R3 as Range,
|
|
179
|
+
R4 as Rate,
|
|
180
|
+
R as Row,
|
|
181
|
+
S5 as SearchBar,
|
|
182
|
+
S6 as ShortPassword,
|
|
183
|
+
S2 as SideNavBar,
|
|
184
|
+
S3 as SideNavBarItem,
|
|
185
|
+
S7 as Signature,
|
|
186
|
+
S9 as Skeleton,
|
|
187
|
+
S11 as Step,
|
|
188
|
+
S12 as Steps,
|
|
189
|
+
S as Sticky,
|
|
190
|
+
S4 as SubSideNavBar,
|
|
191
|
+
S10 as Swipe,
|
|
192
|
+
S13 as Swiper,
|
|
193
|
+
S14 as SwiperItem,
|
|
194
|
+
S8 as Switch,
|
|
195
|
+
T3 as TabPane,
|
|
196
|
+
T as Tabbar,
|
|
197
|
+
T2 as TabbarItem,
|
|
198
|
+
T7 as Table,
|
|
199
|
+
T4 as Tabs,
|
|
200
|
+
T8 as Tag,
|
|
201
|
+
T5 as TextArea,
|
|
202
|
+
T9 as TimeDetail,
|
|
203
|
+
T10 as TimePannel,
|
|
204
|
+
T11 as TimeSelect,
|
|
205
|
+
T6 as Toast,
|
|
206
|
+
T12 as TrendArrow,
|
|
207
|
+
U as Uploader,
|
|
208
|
+
V2 as Video,
|
|
209
|
+
V as VirtualList,
|
|
210
|
+
W as WaterMark
|
|
211
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { View } from "@tarojs/components";
|
|
4
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
5
|
+
const defaultOverlayProps = {
|
|
6
|
+
...ComponentDefaults,
|
|
7
|
+
zIndex: 1e3,
|
|
8
|
+
duration: 0.3,
|
|
9
|
+
closeOnOverlayClick: true,
|
|
10
|
+
visible: false,
|
|
11
|
+
lockScroll: true,
|
|
12
|
+
onClick: (event) => {
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const Overlay = (props) => {
|
|
16
|
+
const { children, zIndex, duration, className, closeOnOverlayClick, visible, lockScroll, style, afterShow, afterClose, onClick, ...rest } = {
|
|
17
|
+
...defaultOverlayProps,
|
|
18
|
+
...props
|
|
19
|
+
};
|
|
20
|
+
const classPrefix = `nut-overlay`;
|
|
21
|
+
const renderRef = useRef(true);
|
|
22
|
+
const intervalCloseRef = useRef(0);
|
|
23
|
+
const intervalShowRef = useRef(0);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (visible) {
|
|
26
|
+
intervalShowRef.current = window.setTimeout(() => {
|
|
27
|
+
afterShow && afterShow();
|
|
28
|
+
}, duration * 1e3 * 0.8);
|
|
29
|
+
}
|
|
30
|
+
lock();
|
|
31
|
+
}, [visible]);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
return () => {
|
|
34
|
+
clearTimeout(intervalCloseRef.current);
|
|
35
|
+
clearTimeout(intervalShowRef.current);
|
|
36
|
+
document.body.classList.remove("nut-overflow-hidden");
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
const classes = classNames({
|
|
40
|
+
"nut-overlay-fade-leave-active": !renderRef.current && !visible,
|
|
41
|
+
"nut-overlay-fade-enter-active": visible,
|
|
42
|
+
"nut-overlay-first-render": renderRef.current && !visible,
|
|
43
|
+
"nut-overlay-hidden-render": !visible
|
|
44
|
+
}, className, classPrefix);
|
|
45
|
+
const styles = {
|
|
46
|
+
zIndex,
|
|
47
|
+
animationDuration: `${props.duration}s`,
|
|
48
|
+
...style
|
|
49
|
+
};
|
|
50
|
+
const lock = () => {
|
|
51
|
+
if (lockScroll && visible) {
|
|
52
|
+
document.body.classList.add("nut-overflow-hidden");
|
|
53
|
+
} else {
|
|
54
|
+
document.body.classList.remove("nut-overflow-hidden");
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const handleClick = (e) => {
|
|
58
|
+
if (closeOnOverlayClick) {
|
|
59
|
+
onClick && onClick(e);
|
|
60
|
+
renderRef.current = false;
|
|
61
|
+
intervalCloseRef.current = window.setTimeout(() => {
|
|
62
|
+
afterClose && afterClose();
|
|
63
|
+
}, duration * 1e3 * 0.8);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
return React.createElement(
|
|
67
|
+
React.Fragment,
|
|
68
|
+
null,
|
|
69
|
+
React.createElement(View, { className: classes, style: styles, ...rest, catchMove: lockScroll, onClick: handleClick }, children)
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
Overlay.defaultProps = defaultOverlayProps;
|
|
73
|
+
Overlay.displayName = "NutOverlay";
|
|
74
|
+
export {
|
|
75
|
+
Overlay as O,
|
|
76
|
+
defaultOverlayProps as d
|
|
77
|
+
};
|