@nutui/nutui-react-taro 2.0.22 → 2.0.23
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 +13 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/ActionSheet.js +6 -3
- package/dist/esm/Address/style/style.css +1 -1
- package/dist/esm/Address.js +7 -5
- package/dist/esm/Audio.js +3 -3
- package/dist/esm/Calendar/style/style.css +1 -1
- package/dist/esm/Calendar.js +7 -4
- package/dist/esm/CalendarCard/style/css.js +1 -0
- package/dist/esm/CalendarCard/style/index.js +2 -0
- package/dist/esm/CalendarCard/style/style.css +1 -0
- package/dist/esm/CalendarCard.js +11 -0
- package/dist/esm/CalendarItem.js +2 -1
- package/dist/esm/Cascader/style/style.css +1 -1
- package/dist/esm/Cascader.js +6 -4
- package/dist/esm/DatePicker/style/style.css +1 -1
- package/dist/esm/DatePicker.js +6 -6
- package/dist/esm/Dialog/style/style.css +1 -1
- package/dist/esm/Dialog.js +4 -2
- package/dist/esm/FixedNav/style/style.css +1 -1
- package/dist/esm/FixedNav.js +5 -2
- package/dist/esm/ImagePreview/style/style.css +1 -1
- package/dist/esm/ImagePreview.js +5 -3
- package/dist/esm/Menu/style/style.css +1 -1
- package/dist/esm/Menu.js +5 -3
- package/dist/esm/MenuItem/style/style.css +1 -1
- package/dist/esm/MenuItem.js +4 -2
- package/dist/esm/NoticeBar/style/style.css +1 -1
- package/dist/esm/NoticeBar.js +1 -1
- package/dist/esm/NumberKeyboard/style/style.css +1 -1
- package/dist/esm/NumberKeyboard.js +6 -3
- package/dist/esm/Overlay/style/style.css +1 -1
- package/dist/esm/Overlay.js +4 -1
- package/dist/esm/Picker/style/style.css +1 -1
- package/dist/esm/Picker.js +5 -5
- package/dist/esm/Popover/style/style.css +1 -1
- package/dist/esm/Popover.js +5 -3
- package/dist/esm/Popup/style/style.css +1 -1
- package/dist/esm/Popup.js +5 -2
- package/dist/esm/PullToRefresh.js +2 -2
- package/dist/esm/Range.js +2 -2
- package/dist/esm/SearchBar.js +1 -1
- package/dist/esm/ShortPassword/style/style.css +1 -1
- package/dist/esm/ShortPassword.js +6 -3
- package/dist/esm/SideNavBar/style/style.css +1 -1
- package/dist/esm/SideNavBar.js +6 -3
- package/dist/esm/Sticky.js +2 -2
- package/dist/esm/Swipe.js +2 -2
- package/dist/esm/TimeSelect/style/style.css +1 -1
- package/dist/esm/TimeSelect.js +6 -3
- package/dist/esm/Toast.js +5 -3
- package/dist/esm/Tour/style/style.css +1 -1
- package/dist/esm/Tour.js +6 -4
- package/dist/esm/{actionsheet.taro-4ce9962a.js → actionsheet.taro-c3556cf1.js} +1 -1
- package/dist/esm/{address.taro-4295c3b3.js → address.taro-315e935e.js} +2 -2
- package/dist/esm/{audio.taro-abacd130.js → audio.taro-c98ee643.js} +1 -1
- package/dist/esm/{calendar.taro-802f92e1.js → calendar.taro-7c342305.js} +3 -2
- package/dist/esm/calendarcard.taro-cef184a2.js +400 -0
- package/dist/esm/{calendaritem.taro-f1995224.js → calendaritem.taro-da659861.js} +4 -218
- package/dist/esm/{cascader.taro-9070043a.js → cascader.taro-fe8472ca.js} +1 -1
- package/dist/esm/date-04589b69.js +222 -0
- package/dist/esm/{datepicker.taro-59c99fd7.js → datepicker.taro-5d8f0e45.js} +3 -3
- package/dist/esm/{dialog.taro-eb61fb7a.js → dialog.taro-2e0e7c57.js} +3 -2
- package/dist/esm/{fixednav.taro-0d998d65.js → fixednav.taro-bd96e277.js} +1 -1
- package/dist/esm/get-scroll-parent-3d880563.js +25 -0
- package/dist/esm/{imagepreview.taro-8bbafaa4.js → imagepreview.taro-44db4eba.js} +1 -1
- package/dist/esm/{menu.taro-cad143e1.js → menu.taro-f3e49415.js} +1 -1
- package/dist/esm/{menuitem.taro-60e01217.js → menuitem.taro-0045e4a8.js} +1 -1
- package/dist/esm/{noticebar.taro-bc771bc9.js → noticebar.taro-11fe07b1.js} +7 -8
- package/dist/esm/{numberkeyboard.taro-ec8f8435.js → numberkeyboard.taro-7d5a8c83.js} +1 -1
- package/dist/esm/nutui-react.es.js +46 -43
- package/dist/esm/overlay.taro-ad4b4c8a.js +153 -0
- package/dist/esm/{picker.taro-11d54577.js → picker.taro-4cbe43f7.js} +24 -27
- package/dist/esm/{popover.taro-539d15e4.js → popover.taro-076ba3ac.js} +1 -1
- package/dist/esm/{popup.taro-3273aa87.js → popup.taro-6f68b86f.js} +7 -7
- package/dist/esm/{pulltorefresh.taro-f3ab76c2.js → pulltorefresh.taro-57993124.js} +2 -2
- package/dist/esm/{range.taro-021442f5.js → range.taro-5254c32d.js} +3 -3
- package/dist/esm/{searchbar.taro-7daf43fc.js → searchbar.taro-9729e815.js} +7 -6
- package/dist/esm/{shortpassword.taro-b01da5b3.js → shortpassword.taro-e29734ce.js} +1 -1
- package/dist/esm/{sidenavbar.taro-97230c40.js → sidenavbar.taro-f1b1b6f0.js} +1 -1
- package/dist/esm/{sticky.taro-2b9a5231.js → sticky.taro-bee7a130.js} +1 -21
- package/dist/esm/{swipe.taro-3d5c4b51.js → swipe.taro-20be8e8c.js} +11 -6
- package/dist/esm/{timeselect.taro-892ca807.js → timeselect.taro-58a9729d.js} +1 -1
- package/dist/esm/{toast.taro-3bdf6d67.js → toast.taro-d63f6e12.js} +1 -1
- package/dist/esm/{tour.taro-b38e06a5.js → tour.taro-2c596c1e.js} +1 -1
- package/dist/esm/types/src/packages/calendarcard/__tests__/calendarcard.spec.d.ts +1 -0
- package/dist/esm/types/src/packages/calendarcard/calendarcard.d.ts +24 -0
- package/dist/esm/types/src/packages/calendarcard/calendarcard.taro.d.ts +24 -0
- package/dist/esm/types/src/packages/calendarcard/demo.d.ts +3 -0
- package/dist/esm/types/src/packages/calendarcard/demo.taro.d.ts +3 -0
- package/dist/esm/types/src/packages/calendarcard/icon.d.ts +5 -0
- package/dist/esm/types/src/packages/calendarcard/icon.taro.d.ts +5 -0
- package/dist/esm/types/src/packages/calendarcard/index.d.ts +3 -0
- package/dist/esm/types/src/packages/calendarcard/index.taro.d.ts +3 -0
- package/dist/esm/types/src/packages/calendarcard/types.d.ts +11 -0
- package/dist/esm/types/src/packages/calendarcard/utils.d.ts +19 -0
- package/dist/esm/types/src/packages/datepicker/datepicker.d.ts +2 -1
- package/dist/esm/types/src/packages/datepicker/datepicker.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/nutui.react.build.d.ts +2 -1
- package/dist/esm/types/src/packages/nutui.react.d.ts +3 -1
- package/dist/esm/types/src/packages/nutui.react.scss.d.ts +1 -0
- package/dist/esm/types/src/packages/nutui.react.taro.d.ts +3 -1
- package/dist/esm/types/src/packages/nutui.react.taro.scss.d.ts +1 -0
- package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +2 -1
- package/dist/esm/types/src/packages/picker/picker.d.ts +2 -0
- package/dist/esm/types/src/packages/picker/picker.taro.d.ts +2 -0
- package/dist/esm/types/src/utils/use-lock-scoll-taro.d.ts +2 -0
- package/dist/esm/types/src/utils/use-lock-scroll.d.ts +2 -0
- package/dist/esm/types/src/utils/use-touch.d.ts +8 -9
- package/dist/esm/use-touch-38cf73ae.js +61 -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/tr-TR.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.es.js +787 -325
- package/dist/nutui.react.umd.js +786 -324
- package/dist/packages/calendarcard/calendarcard.scss +104 -0
- package/dist/packages/noticebar/noticebar.scss +1 -0
- package/dist/packages/overlay/overlay.scss +5 -0
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/themes/default.scss +1 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/packages/calendarcard/calendarcard.taro.d.ts +76 -0
- package/dist/types/packages/calendarcard/icon.taro.d.ts +5 -0
- package/dist/types/packages/calendarcard/index.taro.d.ts +3 -0
- package/dist/types/packages/calendarcard/types.d.ts +11 -0
- package/dist/types/packages/calendarcard/utils.d.ts +19 -0
- package/dist/types/packages/datepicker/datepicker.taro.d.ts +6 -1
- package/dist/types/packages/picker/picker.taro.d.ts +6 -0
- package/dist/types/utils/use-lock-scoll-taro.d.ts +1 -0
- package/dist/types/utils/use-lock-scroll.d.ts +2 -0
- package/dist/types/utils/use-touch.d.ts +8 -9
- package/package.json +1 -1
- package/dist/esm/can-use-dom-0e539bd3.js +0 -4
- package/dist/esm/overlay.taro-626840fc.js +0 -73
- package/dist/esm/types/src/packages/dialog/dialogwrap.taro.d.ts +0 -14
- package/dist/esm/use-touch-ff43512c.js +0 -69
- package/dist/types/packages/overlay/index.d.ts +0 -3
- package/dist/types/packages/overlay/overlay.d.ts +0 -14
- package/dist/types/packages/picker/index.d.ts +0 -4
- package/dist/types/packages/picker/picker.d.ts +0 -23
- package/dist/types/packages/picker/pickerpanel.d.ts +0 -15
- package/dist/types/packages/popup/index.d.ts +0 -3
- package/dist/types/packages/popup/popup.d.ts +0 -24
|
@@ -3,7 +3,7 @@ import { C } from "./cell.taro-010b73ed.js";
|
|
|
3
3
|
import { C as C2 } from "./cellgroup.taro-9dc59f11.js";
|
|
4
4
|
import { C as C3 } from "./configprovider.taro-c5ff4877.js";
|
|
5
5
|
import { I } from "./image.taro-c2441b71.js";
|
|
6
|
-
import { O } from "./overlay.taro-
|
|
6
|
+
import { O } from "./overlay.taro-ad4b4c8a.js";
|
|
7
7
|
import { C as C4 } from "./col.taro-23d5f6bd.js";
|
|
8
8
|
import { D } from "./divider.taro-c61ab869.js";
|
|
9
9
|
import { G } from "./grid.taro-13674639.js";
|
|
@@ -11,67 +11,68 @@ import { G as G2 } from "./griditem.taro-9e1c493c.js";
|
|
|
11
11
|
import { L } from "./layout.taro-7711a89c.js";
|
|
12
12
|
import { R } from "./row.taro-a71fbf76.js";
|
|
13
13
|
import { S } from "./space.taro-a7e4ced4.js";
|
|
14
|
-
import { S as S2 } from "./sticky.taro-
|
|
14
|
+
import { S as S2 } from "./sticky.taro-bee7a130.js";
|
|
15
15
|
import { B as B2 } from "./backtop.taro-910bbef1.js";
|
|
16
16
|
import { E } from "./elevator.taro-cdf3dba7.js";
|
|
17
|
-
import { F } from "./fixednav.taro-
|
|
17
|
+
import { F } from "./fixednav.taro-bd96e277.js";
|
|
18
18
|
import { N } from "./navbar.taro-23394f73.js";
|
|
19
|
-
import { S as S3 } from "./sidenavbar.taro-
|
|
19
|
+
import { S as S3 } from "./sidenavbar.taro-f1b1b6f0.js";
|
|
20
20
|
import { S as S4 } from "./sidenavbaritem.taro-69b0784d.js";
|
|
21
21
|
import { S as S5 } from "./subsidenavbar.taro-797ce379.js";
|
|
22
22
|
import { T } from "./tabbar.taro-d7af9698.js";
|
|
23
23
|
import { T as T2 } from "./tabbaritem.taro-c7113661.js";
|
|
24
24
|
import { T as T3 } from "./tabpane.taro-d0eea168.js";
|
|
25
25
|
import { T as T4 } from "./tabs.taro-f4239f2d.js";
|
|
26
|
-
import { A } from "./address.taro-
|
|
27
|
-
import { C as C5 } from "./calendar.taro-
|
|
28
|
-
import { C as C6 } from "./calendaritem.taro-
|
|
29
|
-
import { C as C7 } from "./
|
|
30
|
-
import { C as C8
|
|
31
|
-
import {
|
|
26
|
+
import { A } from "./address.taro-315e935e.js";
|
|
27
|
+
import { C as C5 } from "./calendar.taro-7c342305.js";
|
|
28
|
+
import { C as C6 } from "./calendaritem.taro-da659861.js";
|
|
29
|
+
import { C as C7 } from "./calendarcard.taro-cef184a2.js";
|
|
30
|
+
import { C as C8 } from "./cascader.taro-fe8472ca.js";
|
|
31
|
+
import { C as C9, a } from "./checkbox.taro-b113a84d.js";
|
|
32
|
+
import { D as D2 } from "./datepicker.taro-5d8f0e45.js";
|
|
32
33
|
import { default as default2 } from "./Form.js";
|
|
33
34
|
import { F as F2 } from "./formitem.taro-17dac26c.js";
|
|
34
35
|
import { I as I2 } from "./input.taro-a71ef3d2.js";
|
|
35
36
|
import { I as I3 } from "./inputnumber.taro-5f60d969.js";
|
|
36
|
-
import { M } from "./menu.taro-
|
|
37
|
-
import { M as M2 } from "./menuitem.taro-
|
|
38
|
-
import { N as N2 } from "./numberkeyboard.taro-
|
|
39
|
-
import { P } from "./picker.taro-
|
|
37
|
+
import { M } from "./menu.taro-f3e49415.js";
|
|
38
|
+
import { M as M2 } from "./menuitem.taro-0045e4a8.js";
|
|
39
|
+
import { N as N2 } from "./numberkeyboard.taro-7d5a8c83.js";
|
|
40
|
+
import { P } from "./picker.taro-4cbe43f7.js";
|
|
40
41
|
import { R as R2, a as a2 } from "./radio.taro-a1956aa2.js";
|
|
41
|
-
import { R as R3 } from "./range.taro-
|
|
42
|
+
import { R as R3 } from "./range.taro-5254c32d.js";
|
|
42
43
|
import { R as R4 } from "./rate.taro-8f34772f.js";
|
|
43
|
-
import { S as S6 } from "./searchbar.taro-
|
|
44
|
-
import { S as S7 } from "./shortpassword.taro-
|
|
44
|
+
import { S as S6 } from "./searchbar.taro-9729e815.js";
|
|
45
|
+
import { S as S7 } from "./shortpassword.taro-e29734ce.js";
|
|
45
46
|
import { S as S8 } from "./signature.taro-3e0c2694.js";
|
|
46
47
|
import { S as S9 } from "./switch.taro-1c7715e8.js";
|
|
47
48
|
import { T as T5 } from "./textarea.taro-d1c63f86.js";
|
|
48
49
|
import { U } from "./uploader.taro-aa39a03f.js";
|
|
49
|
-
import { A as A2 } from "./actionsheet.taro-
|
|
50
|
+
import { A as A2 } from "./actionsheet.taro-c3556cf1.js";
|
|
50
51
|
import { B as B3 } from "./badge.taro-ffca952e.js";
|
|
51
|
-
import { B as B4 } from "./dialog.taro-
|
|
52
|
+
import { B as B4 } from "./dialog.taro-2e0e7c57.js";
|
|
52
53
|
import { D as D3 } from "./drag.taro-ce333e51.js";
|
|
53
54
|
import { E as E2 } from "./empty.taro-05f15f93.js";
|
|
54
55
|
import { I as I4 } from "./infiniteloading.taro-cb3b949e.js";
|
|
55
56
|
import { L as L2 } from "./loading.taro-0799622f.js";
|
|
56
|
-
import { N as N3 } from "./noticebar.taro-
|
|
57
|
+
import { N as N3 } from "./noticebar.taro-11fe07b1.js";
|
|
57
58
|
import { N as N4 } from "./notify.taro-6798c31f.js";
|
|
58
|
-
import { P as P2 } from "./popover.taro-
|
|
59
|
-
import { P as P3 } from "./popup.taro-
|
|
60
|
-
import { P as P4 } from "./pulltorefresh.taro-
|
|
59
|
+
import { P as P2 } from "./popover.taro-076ba3ac.js";
|
|
60
|
+
import { P as P3 } from "./popup.taro-6f68b86f.js";
|
|
61
|
+
import { P as P4 } from "./pulltorefresh.taro-57993124.js";
|
|
61
62
|
import { S as S10 } from "./skeleton.taro-a0bb88d4.js";
|
|
62
|
-
import { S as S11 } from "./swipe.taro-
|
|
63
|
-
import { T as T6 } from "./toast.taro-
|
|
63
|
+
import { S as S11 } from "./swipe.taro-20be8e8c.js";
|
|
64
|
+
import { T as T6 } from "./toast.taro-d63f6e12.js";
|
|
64
65
|
import { A as A3 } from "./animate.taro-37bf4eab.js";
|
|
65
66
|
import { default as default3 } from "./AnimatingNumbers.js";
|
|
66
|
-
import { A as A4 } from "./audio.taro-
|
|
67
|
+
import { A as A4 } from "./audio.taro-c98ee643.js";
|
|
67
68
|
import { A as A5 } from "./avatar.taro-68369036.js";
|
|
68
69
|
import { A as A6 } from "./avatargroup.taro-1f8b7174.js";
|
|
69
|
-
import { C as
|
|
70
|
-
import { C as
|
|
71
|
-
import { C as
|
|
72
|
-
import { C as
|
|
70
|
+
import { C as C10 } from "./circleprogress.taro-417e1d3f.js";
|
|
71
|
+
import { C as C11 } from "./collapse.taro-341f8941.js";
|
|
72
|
+
import { C as C12 } from "./collapseitem.taro-e99fb1a2.js";
|
|
73
|
+
import { C as C13 } from "./countdown.taro-7caa9578.js";
|
|
73
74
|
import { E as E3 } from "./ellipsis.taro-cd36ab2d.js";
|
|
74
|
-
import { I as I5 } from "./imagepreview.taro-
|
|
75
|
+
import { I as I5 } from "./imagepreview.taro-44db4eba.js";
|
|
75
76
|
import { I as I6 } from "./indicator.taro-092f9f4e.js";
|
|
76
77
|
import { P as P5 } from "./pagination.taro-be383e8b.js";
|
|
77
78
|
import { P as P6 } from "./price.taro-0bd3f07a.js";
|
|
@@ -82,13 +83,13 @@ import { default as default4 } from "./Swiper.js";
|
|
|
82
83
|
import { S as S14 } from "./swiperitem.taro-da39a67b.js";
|
|
83
84
|
import { T as T7 } from "./table.taro-a7dcb564.js";
|
|
84
85
|
import { T as T8 } from "./tag.taro-518b9c70.js";
|
|
85
|
-
import { T as T9 } from "./tour.taro-
|
|
86
|
+
import { T as T9 } from "./tour.taro-2c596c1e.js";
|
|
86
87
|
import { V } from "./video.taro-672ca6b8.js";
|
|
87
88
|
import { V as V2 } from "./virtuallist.taro-c75a4e71.js";
|
|
88
89
|
import { B as B5 } from "./barrage.taro-d77c34b4.js";
|
|
89
|
-
import { C as
|
|
90
|
+
import { C as C14 } from "./card.taro-c0e9cfba.js";
|
|
90
91
|
import { T as T10 } from "./timedetail.taro-958b8c07.js";
|
|
91
|
-
import { T as T11 } from "./timeselect.taro-
|
|
92
|
+
import { T as T11 } from "./timeselect.taro-58a9729d.js";
|
|
92
93
|
import { T as T12 } from "./trendarrow.taro-e6b635ae.js";
|
|
93
94
|
import { W } from "./watermark.taro-311b59d2.js";
|
|
94
95
|
import "react";
|
|
@@ -100,14 +101,15 @@ import "./index-21e61675.js";
|
|
|
100
101
|
import "@tarojs/components";
|
|
101
102
|
import "./px-check-f83a9dc3.js";
|
|
102
103
|
import "react-transition-group";
|
|
104
|
+
import "./use-touch-38cf73ae.js";
|
|
105
|
+
import "./get-scroll-parent-3d880563.js";
|
|
103
106
|
import "./UserContext-ab42ba7f.js";
|
|
104
107
|
import "./get-rect-by-taro-fe02fe2b.js";
|
|
105
|
-
import "./can-use-dom-0e539bd3.js";
|
|
106
108
|
import "./context-f32a9246.js";
|
|
107
109
|
import "./use-props-value-7637d900.js";
|
|
108
110
|
import "./use-force-update-9cd7c164.js";
|
|
109
111
|
import "./raf-a9ff50ad.js";
|
|
110
|
-
import "./
|
|
112
|
+
import "./date-04589b69.js";
|
|
111
113
|
import "./index-e3184f19.js";
|
|
112
114
|
import "./use-custom-event-bb9c7f2e.js";
|
|
113
115
|
import "react-dom";
|
|
@@ -126,19 +128,20 @@ export {
|
|
|
126
128
|
B5 as Barrage,
|
|
127
129
|
B as Button,
|
|
128
130
|
C5 as Calendar,
|
|
131
|
+
C7 as CalendarCard,
|
|
129
132
|
C6 as CalendarItem,
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
C14 as Card,
|
|
134
|
+
C8 as Cascader,
|
|
132
135
|
C as Cell,
|
|
133
136
|
C2 as CellGroup,
|
|
134
|
-
|
|
137
|
+
C9 as Checkbox,
|
|
135
138
|
a as CheckboxGroup,
|
|
136
|
-
|
|
139
|
+
C10 as CircleProgress,
|
|
137
140
|
C4 as Col,
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
C11 as Collapse,
|
|
142
|
+
C12 as CollapseItem,
|
|
140
143
|
C3 as ConfigProvider,
|
|
141
|
-
|
|
144
|
+
C13 as CountDown,
|
|
142
145
|
D2 as DatePicker,
|
|
143
146
|
B4 as Dialog,
|
|
144
147
|
D as Divider,
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React__default, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { CSSTransition } from "react-transition-group";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { View } from "@tarojs/components";
|
|
5
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
6
|
+
import { getEnv } from "@tarojs/taro";
|
|
7
|
+
import { u as useTouch } from "./use-touch-38cf73ae.js";
|
|
8
|
+
import { c as canUseDom, g as getScrollParent } from "./get-scroll-parent-3d880563.js";
|
|
9
|
+
let passiveSupported = false;
|
|
10
|
+
if (canUseDom) {
|
|
11
|
+
try {
|
|
12
|
+
const opts = Object.defineProperty({}, "passive", {
|
|
13
|
+
get() {
|
|
14
|
+
passiveSupported = true;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
window.addEventListener("test-passive-supported", null, opts);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
console.log(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
let totalLockCount = 0;
|
|
23
|
+
const BODY_LOCK_CLASS = "nut-overflow-hidden";
|
|
24
|
+
function getScrollableElement(el) {
|
|
25
|
+
let current = el == null ? void 0 : el.parentElement;
|
|
26
|
+
while (current) {
|
|
27
|
+
if (current.clientHeight < current.scrollHeight) {
|
|
28
|
+
return current;
|
|
29
|
+
}
|
|
30
|
+
current = current.parentElement;
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
function useLockScroll(rootRef, shouldLock) {
|
|
35
|
+
const touch = useTouch();
|
|
36
|
+
const onTouchMove = (event) => {
|
|
37
|
+
touch.move(event);
|
|
38
|
+
const direction = touch.deltaY.current > 0 ? "10" : "01";
|
|
39
|
+
const el = getScrollParent(event.target, rootRef.current);
|
|
40
|
+
if (!el)
|
|
41
|
+
return;
|
|
42
|
+
if (shouldLock === "strict") {
|
|
43
|
+
const scrollableParent = getScrollableElement(event.target);
|
|
44
|
+
if (scrollableParent === document.body || scrollableParent === document.documentElement) {
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const { scrollHeight, offsetHeight, scrollTop } = el;
|
|
50
|
+
let status = "11";
|
|
51
|
+
if (scrollTop === 0) {
|
|
52
|
+
status = offsetHeight >= scrollHeight ? "00" : "01";
|
|
53
|
+
} else if (scrollTop + offsetHeight >= scrollHeight) {
|
|
54
|
+
status = "10";
|
|
55
|
+
}
|
|
56
|
+
if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
|
|
57
|
+
if (event.cancelable) {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const lock = () => {
|
|
63
|
+
document.addEventListener("touchstart", touch.start);
|
|
64
|
+
document.addEventListener("touchmove", onTouchMove, passiveSupported ? { passive: false } : false);
|
|
65
|
+
if (!totalLockCount) {
|
|
66
|
+
document.body.classList.add(BODY_LOCK_CLASS);
|
|
67
|
+
}
|
|
68
|
+
totalLockCount++;
|
|
69
|
+
};
|
|
70
|
+
const unlock = () => {
|
|
71
|
+
if (totalLockCount) {
|
|
72
|
+
document.removeEventListener("touchstart", touch.start);
|
|
73
|
+
document.removeEventListener("touchmove", onTouchMove);
|
|
74
|
+
totalLockCount--;
|
|
75
|
+
if (!totalLockCount) {
|
|
76
|
+
document.body.classList.remove(BODY_LOCK_CLASS);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (shouldLock) {
|
|
82
|
+
lock();
|
|
83
|
+
return () => {
|
|
84
|
+
unlock();
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}, [shouldLock]);
|
|
88
|
+
}
|
|
89
|
+
const useLockScrollTaro = (shouldLock) => {
|
|
90
|
+
const refObject = useRef(null);
|
|
91
|
+
if (getEnv() === "WEB") {
|
|
92
|
+
useLockScroll(refObject, shouldLock);
|
|
93
|
+
}
|
|
94
|
+
return refObject;
|
|
95
|
+
};
|
|
96
|
+
const defaultOverlayProps = {
|
|
97
|
+
...ComponentDefaults,
|
|
98
|
+
zIndex: 1e3,
|
|
99
|
+
duration: 300,
|
|
100
|
+
closeOnOverlayClick: true,
|
|
101
|
+
visible: false,
|
|
102
|
+
lockScroll: true,
|
|
103
|
+
onClick: (event) => {
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const Overlay = (props) => {
|
|
107
|
+
const { children, zIndex, duration, className, closeOnOverlayClick, visible, lockScroll, style, afterShow, afterClose, onClick, ...rest } = {
|
|
108
|
+
...defaultOverlayProps,
|
|
109
|
+
...props
|
|
110
|
+
};
|
|
111
|
+
const [innerVisible, setInnerVisible] = useState(visible);
|
|
112
|
+
const classPrefix = `nut-overlay`;
|
|
113
|
+
const nodeRef = useLockScrollTaro(!!props.lockScroll && innerVisible);
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (visible) {
|
|
116
|
+
setInnerVisible(true);
|
|
117
|
+
} else {
|
|
118
|
+
setInnerVisible(false);
|
|
119
|
+
}
|
|
120
|
+
}, [visible]);
|
|
121
|
+
const classes = classNames(className, classPrefix);
|
|
122
|
+
const styles = {
|
|
123
|
+
...style
|
|
124
|
+
};
|
|
125
|
+
const handleClick = (e) => {
|
|
126
|
+
if (closeOnOverlayClick) {
|
|
127
|
+
onClick && onClick(e);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const onHandleOpened = (e) => {
|
|
131
|
+
afterShow && afterShow();
|
|
132
|
+
};
|
|
133
|
+
const onHandleClosed = (e) => {
|
|
134
|
+
afterClose && afterClose();
|
|
135
|
+
};
|
|
136
|
+
return React__default.createElement(
|
|
137
|
+
React__default.Fragment,
|
|
138
|
+
null,
|
|
139
|
+
React__default.createElement(
|
|
140
|
+
CSSTransition,
|
|
141
|
+
{ nodeRef, classNames: `${classPrefix}-slide`, unmountOnExit: true, timeout: duration, in: innerVisible, onEntered: onHandleOpened, onExited: onHandleClosed },
|
|
142
|
+
React__default.createElement(View, { ref: nodeRef, className: classes, style: styles, ...rest, catchMove: lockScroll, onClick: handleClick }, children)
|
|
143
|
+
)
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
Overlay.defaultProps = defaultOverlayProps;
|
|
147
|
+
Overlay.displayName = "NutOverlay";
|
|
148
|
+
export {
|
|
149
|
+
Overlay as O,
|
|
150
|
+
defaultOverlayProps as d,
|
|
151
|
+
passiveSupported as p,
|
|
152
|
+
useLockScrollTaro as u
|
|
153
|
+
};
|
|
@@ -2,26 +2,13 @@ import React__default, { useState, useRef, useEffect, useImperativeHandle } from
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import Taro from "@tarojs/taro";
|
|
4
4
|
import { View, PickerView, PickerViewColumn } from "@tarojs/components";
|
|
5
|
-
import { P as Popup } from "./popup.taro-
|
|
6
|
-
import { u as useTouch } from "./use-touch-
|
|
5
|
+
import { P as Popup } from "./popup.taro-6f68b86f.js";
|
|
6
|
+
import { u as useTouch } from "./use-touch-38cf73ae.js";
|
|
7
7
|
import { g as getRectByTaro } from "./get-rect-by-taro-fe02fe2b.js";
|
|
8
|
-
import {
|
|
8
|
+
import { p as passiveSupported } from "./overlay.taro-ad4b4c8a.js";
|
|
9
9
|
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
10
10
|
import { u as usePropsValue } from "./use-props-value-7637d900.js";
|
|
11
11
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
12
|
-
let passiveSupported = false;
|
|
13
|
-
if (canUseDom) {
|
|
14
|
-
try {
|
|
15
|
-
const opts = Object.defineProperty({}, "passive", {
|
|
16
|
-
get() {
|
|
17
|
-
passiveSupported = true;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
window.addEventListener("test-passive-supported", null, opts);
|
|
21
|
-
} catch (e) {
|
|
22
|
-
console.log(e);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
12
|
const InternalPickerPanel = (props, ref) => {
|
|
26
13
|
const { keyIndex = 0, defaultValue, options = [], threeDimensional = true, duration = 1e3, itemShow = false, chooseItem } = props;
|
|
27
14
|
const touch = useTouch();
|
|
@@ -37,7 +24,7 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
37
24
|
let timer;
|
|
38
25
|
const listRef = useRef(null);
|
|
39
26
|
const rollerRef = useRef(null);
|
|
40
|
-
const
|
|
27
|
+
const pickerPanelRef = useRef(null);
|
|
41
28
|
const [startTime, setStartTime] = useState(0);
|
|
42
29
|
const [startY, setStartY] = useState(0);
|
|
43
30
|
const transformY = useRef(0);
|
|
@@ -83,11 +70,11 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
83
70
|
}
|
|
84
71
|
};
|
|
85
72
|
const setChooseValue = (move) => {
|
|
86
|
-
chooseItem
|
|
73
|
+
chooseItem == null ? void 0 : chooseItem(options == null ? void 0 : options[Math.round(-move / lineSpacing.current)], keyIndex);
|
|
87
74
|
};
|
|
88
75
|
const touchStart = (event) => {
|
|
89
76
|
touch.start(event);
|
|
90
|
-
setStartY(touch.deltaY);
|
|
77
|
+
setStartY(touch.deltaY.current);
|
|
91
78
|
setStartTime(Date.now());
|
|
92
79
|
transformY.current = scrollDistance;
|
|
93
80
|
};
|
|
@@ -97,13 +84,13 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
97
84
|
moving.current = true;
|
|
98
85
|
preventDefault(event, true);
|
|
99
86
|
}
|
|
100
|
-
const move = touch.deltaY - startY;
|
|
87
|
+
const move = touch.deltaY.current - startY;
|
|
101
88
|
setMove(move);
|
|
102
89
|
};
|
|
103
90
|
const touchEnd = () => {
|
|
104
91
|
if (!moving.current)
|
|
105
92
|
return;
|
|
106
|
-
const move = touch.deltaY - startY;
|
|
93
|
+
const move = touch.deltaY.current - startY;
|
|
107
94
|
const moveTime = Date.now() - startTime;
|
|
108
95
|
if (moveTime <= INERTIA_TIME && Math.abs(move) > INERTIA_DISTANCE) {
|
|
109
96
|
const distance = momentum(move, moveTime);
|
|
@@ -150,9 +137,7 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
150
137
|
setChooseValue(scrollDistance);
|
|
151
138
|
};
|
|
152
139
|
const preventDefault = (event, isStopPropagation) => {
|
|
153
|
-
|
|
154
|
-
event.preventDefault();
|
|
155
|
-
}
|
|
140
|
+
event.preventDefault();
|
|
156
141
|
if (isStopPropagation) {
|
|
157
142
|
event.stopPropagation();
|
|
158
143
|
}
|
|
@@ -193,9 +178,21 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
193
178
|
stopMomentum,
|
|
194
179
|
moving: moving.current
|
|
195
180
|
}));
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
const eventOptions = passiveSupported ? { passive: false, once: true } : false;
|
|
183
|
+
const element = pickerPanelRef.current;
|
|
184
|
+
element.addEventListener("touchstart", touchStart, eventOptions);
|
|
185
|
+
element.addEventListener("touchmove", touchMove, eventOptions);
|
|
186
|
+
element.addEventListener("touchend", touchEnd, eventOptions);
|
|
187
|
+
return () => {
|
|
188
|
+
element.removeEventListener("touchstart", touchStart, eventOptions);
|
|
189
|
+
element.removeEventListener("touchmove", touchMove, eventOptions);
|
|
190
|
+
element.removeEventListener("touchend", touchEnd, eventOptions);
|
|
191
|
+
};
|
|
192
|
+
});
|
|
196
193
|
return React__default.createElement(
|
|
197
194
|
"div",
|
|
198
|
-
{ className: "nut-picker-list", ref:
|
|
195
|
+
{ className: "nut-picker-list", ref: pickerPanelRef },
|
|
199
196
|
React__default.createElement(
|
|
200
197
|
"div",
|
|
201
198
|
{ className: "nut-picker-roller", ref: rollerRef, style: threeDimensional ? touchRollerStyle() : touchTileStyle(), onTransitionEnd: stopMomentum },
|
|
@@ -250,7 +247,7 @@ const defaultProps = {
|
|
|
250
247
|
};
|
|
251
248
|
const InternalPicker = (props, ref) => {
|
|
252
249
|
const { locale } = useConfig();
|
|
253
|
-
const { children, visible, title, options = [], defaultValue = [], className, style, threeDimensional, duration, onConfirm, onClose, afterClose, onChange, ...rest } = { ...defaultProps, ...props };
|
|
250
|
+
const { children, visible, title, options = [], popupProps = {}, defaultValue = [], className, style, threeDimensional, duration, onConfirm, onClose, afterClose, onChange, ...rest } = { ...defaultProps, ...props };
|
|
254
251
|
const classPrefix = "nut-picker";
|
|
255
252
|
const classes = classNames(classPrefix, className);
|
|
256
253
|
const [selectedValue, setSelectedValue] = usePropsValue({
|
|
@@ -481,7 +478,7 @@ const InternalPicker = (props, ref) => {
|
|
|
481
478
|
typeof children === "function" && children(selectedValue),
|
|
482
479
|
React__default.createElement(
|
|
483
480
|
Popup,
|
|
484
|
-
{ visible: innerVisible, position: "bottom", afterClose: () => {
|
|
481
|
+
{ ...popupProps, visible: innerVisible, position: "bottom", afterClose: () => {
|
|
485
482
|
closePicker();
|
|
486
483
|
} },
|
|
487
484
|
React__default.createElement(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default, { useRef, useState, useEffect } from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import Taro, { createSelectorQuery } from "@tarojs/taro";
|
|
4
|
-
import { P as Popup } from "./popup.taro-
|
|
4
|
+
import { P as Popup } from "./popup.taro-6f68b86f.js";
|
|
5
5
|
import { a as getRect, g as getRectByTaro } from "./get-rect-by-taro-fe02fe2b.js";
|
|
6
6
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
7
7
|
const defaultProps = {
|
|
@@ -4,7 +4,7 @@ import { CSSTransition } from "react-transition-group";
|
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import { Close } from "@nutui/icons-react-taro";
|
|
6
6
|
import { View } from "@tarojs/components";
|
|
7
|
-
import { d as defaultOverlayProps, O as Overlay } from "./overlay.taro-
|
|
7
|
+
import { d as defaultOverlayProps, u as useLockScrollTaro, O as Overlay } from "./overlay.taro-ad4b4c8a.js";
|
|
8
8
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
9
9
|
const defaultProps = {
|
|
10
10
|
...ComponentDefaults,
|
|
@@ -27,13 +27,15 @@ const defaultProps = {
|
|
|
27
27
|
onCloseIconClick: (e) => true,
|
|
28
28
|
...defaultOverlayProps
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
const _zIndex = 1100;
|
|
31
31
|
const Popup = (props) => {
|
|
32
32
|
const { children, visible, overlay, closeOnOverlayClick, overlayStyle, overlayClassName, zIndex, lockScroll, duration, closeable, closeIconPosition, closeIcon, left, title, style, transition, round, position, className, destroyOnClose, portal, onOpen, onClose, onOverlayClick, onCloseIconClick, afterShow, afterClose, onClick } = { ...defaultProps, ...props };
|
|
33
|
-
|
|
33
|
+
let innerIndex = zIndex || _zIndex;
|
|
34
|
+
const [index, setIndex] = useState(innerIndex);
|
|
34
35
|
const [innerVisible, setInnerVisible] = useState(visible);
|
|
35
36
|
const [showChildren, setShowChildren] = useState(true);
|
|
36
37
|
const [transitionName, setTransitionName] = useState("");
|
|
38
|
+
const refObject = useLockScrollTaro(innerVisible && lockScroll);
|
|
37
39
|
const classPrefix = "nut-popup";
|
|
38
40
|
const baseStyle = {
|
|
39
41
|
zIndex: index
|
|
@@ -59,9 +61,7 @@ const Popup = (props) => {
|
|
|
59
61
|
const open = () => {
|
|
60
62
|
if (!innerVisible) {
|
|
61
63
|
setInnerVisible(true);
|
|
62
|
-
|
|
63
|
-
setIndex(++_zIndex);
|
|
64
|
-
}
|
|
64
|
+
setIndex(++innerIndex);
|
|
65
65
|
}
|
|
66
66
|
if (destroyOnClose) {
|
|
67
67
|
setShowChildren(true);
|
|
@@ -130,7 +130,7 @@ const Popup = (props) => {
|
|
|
130
130
|
{ classNames: transitionName, unmountOnExit: true, timeout: duration, in: innerVisible, onEntered: onHandleOpened, onExited: onHandleClosed },
|
|
131
131
|
React__default.createElement(
|
|
132
132
|
View,
|
|
133
|
-
{ style: popStyles, className: popClassName, onClick: onHandleClick },
|
|
133
|
+
{ ref: refObject, style: popStyles, className: popClassName, onClick: onHandleClick, catchMove: lockScroll },
|
|
134
134
|
renderTitle(),
|
|
135
135
|
renderIcon(),
|
|
136
136
|
showChildren ? children : ""
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default, { useRef, useState } from "react";
|
|
2
2
|
import { View } from "@tarojs/components";
|
|
3
3
|
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
4
|
-
import { u as useTouch } from "./use-touch-
|
|
4
|
+
import { u as useTouch } from "./use-touch-38cf73ae.js";
|
|
5
5
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
6
6
|
function bound(position, min, max) {
|
|
7
7
|
let ret = position;
|
|
@@ -86,7 +86,7 @@ const PullToRefresh = (p) => {
|
|
|
86
86
|
touch.move(e);
|
|
87
87
|
if (touch.isVertical()) {
|
|
88
88
|
pullingRef.current = true;
|
|
89
|
-
setHeight(Math.max(rubberbandIfOutOfBounds(touch.deltaY, 0, 0, headHeight * 5, 0.5), 0));
|
|
89
|
+
setHeight(Math.max(rubberbandIfOutOfBounds(touch.deltaY.current, 0, 0, headHeight * 5, 0.5), 0));
|
|
90
90
|
setStatus(height > threshold ? "canRelease" : "pulling");
|
|
91
91
|
}
|
|
92
92
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default, { useState, useRef, useEffect, useCallback } from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { View } from "@tarojs/components";
|
|
4
|
-
import { u as useTouch } from "./use-touch-
|
|
4
|
+
import { u as useTouch } from "./use-touch-38cf73ae.js";
|
|
5
5
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
6
6
|
import { u as usePropsValue } from "./use-props-value-7637d900.js";
|
|
7
7
|
import { g as getRectByTaro } from "./get-rect-by-taro-fe02fe2b.js";
|
|
@@ -187,11 +187,11 @@ const Range = (props) => {
|
|
|
187
187
|
touch.move(event);
|
|
188
188
|
setDragStatus("draging");
|
|
189
189
|
const rect = await getRectByTaro(root.current);
|
|
190
|
-
let delta = touch.deltaX;
|
|
190
|
+
let delta = touch.deltaX.current;
|
|
191
191
|
let total = rect.width;
|
|
192
192
|
let diff = delta / total * scope();
|
|
193
193
|
if (vertical) {
|
|
194
|
-
delta = touch.deltaY;
|
|
194
|
+
delta = touch.deltaY.current;
|
|
195
195
|
total = rect.height;
|
|
196
196
|
diff = delta / total * scope();
|
|
197
197
|
}
|
|
@@ -30,10 +30,11 @@ const SearchBar = (props) => {
|
|
|
30
30
|
searchSelf && searchSelf.focus();
|
|
31
31
|
};
|
|
32
32
|
const change = (event) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
if (value === event.target.value)
|
|
34
|
+
return;
|
|
35
|
+
onChange && (onChange == null ? void 0 : onChange(event.target.value, event));
|
|
36
|
+
setValue(event.target.value);
|
|
37
|
+
event.target.value === "" && forceFocus();
|
|
37
38
|
};
|
|
38
39
|
const focus = (event) => {
|
|
39
40
|
const { value: value2 } = event.target;
|
|
@@ -46,7 +47,7 @@ const SearchBar = (props) => {
|
|
|
46
47
|
onBlur && (onBlur == null ? void 0 : onBlur(value2, event));
|
|
47
48
|
};
|
|
48
49
|
useEffect(() => {
|
|
49
|
-
setValue(props.value);
|
|
50
|
+
setValue(props.value || "");
|
|
50
51
|
}, [props.value]);
|
|
51
52
|
useEffect(() => {
|
|
52
53
|
autoFocus && forceFocus();
|
|
@@ -89,8 +90,8 @@ const SearchBar = (props) => {
|
|
|
89
90
|
return;
|
|
90
91
|
}
|
|
91
92
|
setValue("");
|
|
92
|
-
onClear && onClear(event);
|
|
93
93
|
forceFocus();
|
|
94
|
+
onClear && onClear(event);
|
|
94
95
|
};
|
|
95
96
|
const onKeypress = (e) => {
|
|
96
97
|
if (e.key === "Enter" || e.keyCode === 13) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default, { useMemo, useEffect } from "react";
|
|
2
2
|
import { Tips } from "@nutui/icons-react-taro";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
-
import { P as Popup } from "./popup.taro-
|
|
4
|
+
import { P as Popup } from "./popup.taro-6f68b86f.js";
|
|
5
5
|
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
6
6
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
7
7
|
import { u as usePropsValue } from "./use-props-value-7637d900.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { useState } from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
|
-
import { P as Popup } from "./popup.taro-
|
|
3
|
+
import { P as Popup } from "./popup.taro-6f68b86f.js";
|
|
4
4
|
import { O as OffsetContext } from "./context-f32a9246.js";
|
|
5
5
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
6
6
|
const defaultProps = {
|
|
@@ -3,7 +3,7 @@ import classNames from "classnames";
|
|
|
3
3
|
import { getEnv, usePageScroll, getSystemInfoSync } from "@tarojs/taro";
|
|
4
4
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
5
5
|
import { g as getRectByTaro } from "./get-rect-by-taro-fe02fe2b.js";
|
|
6
|
-
import {
|
|
6
|
+
import { g as getScrollParent } from "./get-scroll-parent-3d880563.js";
|
|
7
7
|
function useWatch(dep, callback, config = { immediate: false }) {
|
|
8
8
|
const { immediate } = config;
|
|
9
9
|
const prev = useRef();
|
|
@@ -27,26 +27,6 @@ function useWatch(dep, callback, config = { immediate: false }) {
|
|
|
27
27
|
stop.current = true;
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
const defaultRoot = canUseDom ? window : void 0;
|
|
31
|
-
const overflowStylePatterns = ["scroll", "auto", "overlay"];
|
|
32
|
-
function isElement(node) {
|
|
33
|
-
const ELEMENT_NODE_TYPE = 1;
|
|
34
|
-
return node.nodeType === ELEMENT_NODE_TYPE;
|
|
35
|
-
}
|
|
36
|
-
function getScrollParent(el, root = defaultRoot) {
|
|
37
|
-
let node = el;
|
|
38
|
-
while (node && node !== root && isElement(node)) {
|
|
39
|
-
if (node === document.body) {
|
|
40
|
-
return root;
|
|
41
|
-
}
|
|
42
|
-
const { overflowY } = window.getComputedStyle(node);
|
|
43
|
-
if (overflowStylePatterns.includes(overflowY) && node.scrollHeight > node.clientHeight) {
|
|
44
|
-
return node;
|
|
45
|
-
}
|
|
46
|
-
node = node.parentNode;
|
|
47
|
-
}
|
|
48
|
-
return root;
|
|
49
|
-
}
|
|
50
30
|
const defaultProps = {
|
|
51
31
|
...ComponentDefaults,
|
|
52
32
|
position: "top",
|