@nutui/nutui-react 3.0.4 → 3.0.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 +48 -0
- package/dist/cjs/packages/badge/badge.js +4 -3
- package/dist/cjs/packages/badge/style/badge.scss +7 -8
- package/dist/cjs/packages/badge/style/style.css +13 -15
- package/dist/cjs/packages/configprovider/types.d.ts +1 -1
- package/dist/cjs/packages/datepicker/style/style.css +3 -1
- package/dist/cjs/packages/datepickerview/style/style.css +3 -1
- package/dist/cjs/packages/empty/style/index.js +1 -0
- package/dist/cjs/packages/empty/style/style.css +389 -0
- package/dist/cjs/packages/fixednav/fixednav.js +3 -2
- package/dist/cjs/packages/fixednav/style/fixednav.scss +43 -39
- package/dist/cjs/packages/fixednav/style/style.css +56 -51
- package/dist/cjs/packages/imagepreview/imagepreview.js +49 -84
- package/dist/cjs/packages/imagepreview/style/imagepreview.scss +2 -1
- package/dist/cjs/packages/imagepreview/style/style.css +2 -1
- package/dist/cjs/packages/indicator/indicator.js +1 -1
- package/dist/cjs/packages/inputnumber/inputnumber.js +2 -2
- package/dist/cjs/packages/lottie/index.d.ts +1 -1
- package/dist/cjs/packages/lottie/index.js +2 -2
- package/dist/cjs/packages/notify/Notification.d.ts +3 -9
- package/dist/cjs/packages/notify/Notification.js +28 -8
- package/dist/cjs/packages/notify/notify.d.ts +0 -4
- package/dist/cjs/packages/notify/notify.js +6 -34
- package/dist/cjs/packages/notify/style/notify.scss +39 -36
- package/dist/cjs/packages/notify/style/style.css +36 -31
- package/dist/cjs/packages/nutui.react.d.ts +1 -0
- package/dist/cjs/packages/nutui.react.js +1 -0
- package/dist/cjs/packages/picker/style/style.css +3 -1
- package/dist/cjs/packages/pickerview/pickerroller.js +11 -6
- package/dist/cjs/packages/pickerview/style/pickerview.scss +3 -1
- package/dist/cjs/packages/pickerview/style/style.css +3 -1
- package/dist/cjs/packages/resultpage/style/index.js +1 -0
- package/dist/cjs/packages/resultpage/style/style.css +389 -0
- package/dist/cjs/packages/skeleton/skeleton.js +64 -49
- package/dist/cjs/packages/skeleton/style/index.js +0 -1
- package/dist/cjs/packages/skeleton/style/skeleton.scss +40 -46
- package/dist/cjs/packages/skeleton/style/style.css +32 -175
- package/dist/cjs/packages/switch/style/style.css +5 -0
- package/dist/cjs/packages/switch/style/switch.scss +5 -0
- package/dist/cjs/packages/switch/switch.js +22 -11
- package/dist/cjs/packages/tabbar/style/style.css +58 -54
- package/dist/cjs/packages/tabbar/style/tabbar.scss +28 -19
- package/dist/cjs/packages/tabbar/tabbar.js +28 -10
- package/dist/cjs/packages/tabbaritem/style/style.css +34 -36
- package/dist/cjs/packages/tabbaritem/style/tabbaritem.scss +32 -29
- package/dist/cjs/packages/tabbaritem/tabbaritem.js +34 -13
- package/dist/cjs/packages/toast/Notification.js +1 -1
- package/dist/cjs/types/spec/badge/base.d.ts +1 -0
- package/dist/cjs/types/spec/indicator/base.d.ts +1 -1
- package/dist/cjs/types/spec/notify/base.d.ts +7 -2
- package/dist/cjs/types/spec/searchbar/taro.d.ts +10 -7
- package/dist/cjs/types/spec/skeleton/base.d.ts +7 -5
- package/dist/cjs/types/spec/switch/base.d.ts +3 -2
- package/dist/cjs/types/spec/switch/h5.d.ts +1 -1
- package/dist/cjs/types/spec/switch/taro.d.ts +1 -4
- package/dist/cjs/types/spec/tabbar/base.d.ts +7 -4
- package/dist/es/packages/badge/badge.js +4 -3
- package/dist/es/packages/badge/style/badge.scss +7 -8
- package/dist/es/packages/badge/style/style.css +13 -15
- package/dist/es/packages/configprovider/types.d.ts +1 -1
- package/dist/es/packages/datepicker/style/style.css +3 -1
- package/dist/es/packages/datepickerview/style/style.css +3 -1
- package/dist/es/packages/empty/style/index.js +1 -0
- package/dist/es/packages/empty/style/style.css +389 -0
- package/dist/es/packages/fixednav/fixednav.js +3 -2
- package/dist/es/packages/fixednav/style/fixednav.scss +43 -39
- package/dist/es/packages/fixednav/style/style.css +56 -51
- package/dist/es/packages/imagepreview/imagepreview.js +49 -84
- package/dist/es/packages/imagepreview/style/imagepreview.scss +2 -1
- package/dist/es/packages/imagepreview/style/style.css +2 -1
- package/dist/es/packages/indicator/indicator.js +1 -1
- package/dist/es/packages/inputnumber/inputnumber.js +2 -2
- package/dist/es/packages/lottie/index.d.ts +1 -1
- package/dist/es/packages/lottie/index.js +1 -1
- package/dist/es/packages/notify/Notification.d.ts +3 -9
- package/dist/es/packages/notify/Notification.js +28 -8
- package/dist/es/packages/notify/notify.d.ts +0 -4
- package/dist/es/packages/notify/notify.js +6 -34
- package/dist/es/packages/notify/style/notify.scss +39 -36
- package/dist/es/packages/notify/style/style.css +36 -31
- package/dist/es/packages/picker/style/style.css +3 -1
- package/dist/es/packages/pickerview/pickerroller.js +10 -6
- package/dist/es/packages/pickerview/style/pickerview.scss +3 -1
- package/dist/es/packages/pickerview/style/style.css +3 -1
- package/dist/es/packages/resultpage/style/index.js +1 -0
- package/dist/es/packages/resultpage/style/style.css +389 -0
- package/dist/es/packages/skeleton/skeleton.js +63 -49
- package/dist/es/packages/skeleton/style/index.js +0 -1
- package/dist/es/packages/skeleton/style/skeleton.scss +40 -46
- package/dist/es/packages/skeleton/style/style.css +32 -175
- package/dist/es/packages/switch/style/style.css +5 -0
- package/dist/es/packages/switch/style/switch.scss +5 -0
- package/dist/es/packages/switch/switch.js +21 -11
- package/dist/es/packages/tabbar/style/style.css +58 -54
- package/dist/es/packages/tabbar/style/tabbar.scss +28 -19
- package/dist/es/packages/tabbar/tabbar.js +27 -10
- package/dist/es/packages/tabbaritem/style/style.css +34 -36
- package/dist/es/packages/tabbaritem/style/tabbaritem.scss +32 -29
- package/dist/es/packages/tabbaritem/tabbaritem.js +34 -13
- package/dist/es/packages/toast/Notification.js +1 -1
- package/dist/es/types/spec/badge/base.d.ts +4 -0
- package/dist/es/types/spec/indicator/base.d.ts +1 -1
- package/dist/es/types/spec/notify/base.d.ts +22 -5
- package/dist/es/types/spec/searchbar/taro.d.ts +10 -7
- package/dist/es/types/spec/skeleton/base.d.ts +19 -14
- package/dist/es/types/spec/switch/base.d.ts +6 -2
- package/dist/es/types/spec/switch/h5.d.ts +1 -1
- package/dist/es/types/spec/switch/taro.d.ts +1 -4
- package/dist/es/types/spec/tabbar/base.d.ts +7 -4
- package/dist/nutui.react.umd.js +394 -373
- package/dist/style.css +1 -1
- package/dist/style.scss +49 -49
- package/dist/styles/theme-dark.scss +2 -0
- package/dist/styles/theme-default.scss +2 -0
- package/dist/styles/themes/dark.css +1 -1
- package/dist/styles/themes/default.css +1 -1
- package/dist/styles/themes/jmapp.css +1 -1
- package/dist/styles/themes/jrkf.css +1 -1
- package/dist/styles/variables-jmapp.scss +24 -1
- package/dist/styles/variables-jrkf.scss +24 -1
- package/dist/styles/variables.scss +37 -38
- package/package.json +1 -1
- /package/dist/cjs/packages/lottie/{web.d.ts → lottie.d.ts} +0 -0
- /package/dist/cjs/packages/lottie/{web.js → lottie.js} +0 -0
- /package/dist/es/packages/lottie/{web.d.ts → lottie.d.ts} +0 -0
- /package/dist/es/packages/lottie/{web.js → lottie.js} +0 -0
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
text(message: string | React.ReactNode, option?: {}): void;
|
|
4
|
-
success(message: string | React.ReactNode, option?: {}): void;
|
|
5
|
-
primary(message: string | React.ReactNode, option?: {}): void;
|
|
6
|
-
danger(message: string | React.ReactNode, option?: {}): void;
|
|
7
|
-
warn(message: string | React.ReactNode, option?: {}): void;
|
|
8
4
|
hide(): void;
|
|
9
5
|
};
|
|
10
6
|
export default _default;
|
|
@@ -18,9 +18,13 @@ var _typings = require("../../utils/typings");
|
|
|
18
18
|
var messageInstance = null;
|
|
19
19
|
var options = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
|
|
20
20
|
id: '',
|
|
21
|
-
duration: 3000,
|
|
22
|
-
type: 'danger',
|
|
23
21
|
position: 'top',
|
|
22
|
+
distance: 8,
|
|
23
|
+
navHeight: 57,
|
|
24
|
+
closeable: false,
|
|
25
|
+
leftIcon: null,
|
|
26
|
+
rightIcon: null,
|
|
27
|
+
duration: 3000,
|
|
24
28
|
onClose: function onClose() {},
|
|
25
29
|
onClick: function onClick() {}
|
|
26
30
|
});
|
|
@@ -53,38 +57,6 @@ var _default = {
|
|
|
53
57
|
type: 'base'
|
|
54
58
|
}, option));
|
|
55
59
|
},
|
|
56
|
-
success: function success(message) {
|
|
57
|
-
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
58
|
-
errorMsg(message);
|
|
59
|
-
return notice((0, _object_spread._)({
|
|
60
|
-
message: message,
|
|
61
|
-
type: 'success'
|
|
62
|
-
}, option));
|
|
63
|
-
},
|
|
64
|
-
primary: function primary(message) {
|
|
65
|
-
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
66
|
-
errorMsg(message);
|
|
67
|
-
return notice((0, _object_spread._)({
|
|
68
|
-
message: message,
|
|
69
|
-
type: 'primary'
|
|
70
|
-
}, option));
|
|
71
|
-
},
|
|
72
|
-
danger: function danger(message) {
|
|
73
|
-
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
74
|
-
errorMsg(message);
|
|
75
|
-
return notice((0, _object_spread._)({
|
|
76
|
-
message: message,
|
|
77
|
-
type: 'danger'
|
|
78
|
-
}, option));
|
|
79
|
-
},
|
|
80
|
-
warn: function warn(message) {
|
|
81
|
-
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
82
|
-
errorMsg(message);
|
|
83
|
-
return notice((0, _object_spread._)({
|
|
84
|
-
message: message,
|
|
85
|
-
type: 'warning'
|
|
86
|
-
}, option));
|
|
87
|
-
},
|
|
88
60
|
hide: function hide() {
|
|
89
61
|
if (messageInstance) {
|
|
90
62
|
messageInstance.destroy();
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/*入场动画过程*/
|
|
7
7
|
.fade-enter-active {
|
|
8
8
|
opacity: 1;
|
|
9
|
-
transition: opacity
|
|
9
|
+
transition: opacity 300ms ease-in;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/*入场动画结束*/
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
/*离场动画过程*/
|
|
23
23
|
.fade-exit-active {
|
|
24
24
|
opacity: 0;
|
|
25
|
-
transition: opacity
|
|
25
|
+
transition: opacity 300ms ease-out;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/*离场动画结束*/
|
|
@@ -38,56 +38,59 @@
|
|
|
38
38
|
/*页面第一次加载时的动画过程*/
|
|
39
39
|
.fade-appear-active {
|
|
40
40
|
opacity: 1;
|
|
41
|
-
transition: opacity
|
|
41
|
+
transition: opacity 300ms;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.nut-notify {
|
|
45
|
+
position: fixed;
|
|
46
|
+
left: 8px;
|
|
47
|
+
right: 8px;
|
|
48
|
+
z-index: $notify-z-index;
|
|
45
49
|
display: flex;
|
|
46
|
-
justify-content: center;
|
|
47
50
|
align-items: center;
|
|
48
51
|
box-sizing: border-box;
|
|
49
|
-
padding: $notify-padding;
|
|
50
|
-
color: $notify-text-color;
|
|
51
|
-
font-size: $notify-font-size;
|
|
52
|
-
white-space: pre-wrap;
|
|
53
|
-
word-wrap: break-word;
|
|
54
52
|
height: $notify-height;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&-popup-bottom {
|
|
71
|
-
bottom: 0;
|
|
53
|
+
padding: $notify-padding;
|
|
54
|
+
border-radius: $notify-border-radius;
|
|
55
|
+
box-shadow: $notify-box-shadow;
|
|
56
|
+
background-color: $notify-background-color;
|
|
57
|
+
|
|
58
|
+
&-content {
|
|
59
|
+
flex: 1;
|
|
60
|
+
text-align: center;
|
|
61
|
+
min-width: 0;
|
|
62
|
+
font-size: $notify-font-size;
|
|
63
|
+
color: $notify-text-color;
|
|
64
|
+
white-space: nowrap;
|
|
65
|
+
overflow: hidden;
|
|
72
66
|
}
|
|
73
67
|
|
|
74
|
-
&-
|
|
75
|
-
|
|
68
|
+
&-ellipsis {
|
|
69
|
+
text-overflow: ellipsis;
|
|
76
70
|
}
|
|
77
71
|
|
|
78
|
-
&-
|
|
79
|
-
|
|
72
|
+
&-layout-left {
|
|
73
|
+
text-align: left;
|
|
80
74
|
}
|
|
81
75
|
|
|
82
|
-
&-
|
|
83
|
-
|
|
76
|
+
&-left-icon,
|
|
77
|
+
&-right-icon {
|
|
78
|
+
display: inline-flex;
|
|
84
79
|
}
|
|
85
80
|
|
|
86
|
-
&-
|
|
87
|
-
|
|
81
|
+
&-left-icon {
|
|
82
|
+
margin-right: 6px;
|
|
83
|
+
.nut-icon {
|
|
84
|
+
height: 16px;
|
|
85
|
+
width: 16px;
|
|
86
|
+
}
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
&-
|
|
91
|
-
|
|
89
|
+
&-right-icon {
|
|
90
|
+
margin-left: 6px;
|
|
91
|
+
.nut-icon {
|
|
92
|
+
height: 12px;
|
|
93
|
+
width: 12px;
|
|
94
|
+
}
|
|
92
95
|
}
|
|
93
96
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
/*入场动画过程*/
|
|
12
12
|
.fade-enter-active {
|
|
13
13
|
opacity: 1;
|
|
14
|
-
transition: opacity
|
|
14
|
+
transition: opacity 300ms ease-in;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/*入场动画结束*/
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
/*离场动画过程*/
|
|
28
28
|
.fade-exit-active {
|
|
29
29
|
opacity: 0;
|
|
30
|
-
transition: opacity
|
|
30
|
+
transition: opacity 300ms ease-out;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/*离场动画结束*/
|
|
@@ -43,47 +43,52 @@
|
|
|
43
43
|
/*页面第一次加载时的动画过程*/
|
|
44
44
|
.fade-appear-active {
|
|
45
45
|
opacity: 1;
|
|
46
|
-
transition: opacity
|
|
46
|
+
transition: opacity 300ms;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.nut-notify {
|
|
50
|
+
position: fixed;
|
|
51
|
+
left: 8px;
|
|
52
|
+
right: 8px;
|
|
53
|
+
z-index: var(--nutui-notify-z-index, 1000);
|
|
50
54
|
display: flex;
|
|
51
|
-
justify-content: center;
|
|
52
55
|
align-items: center;
|
|
53
56
|
box-sizing: border-box;
|
|
54
|
-
padding: var(--nutui-notify-padding, 0px 10px);
|
|
55
|
-
color: var(--nutui-notify-text-color, #ffffff);
|
|
56
|
-
font-size: var(--nutui-notify-font-size, var(--nutui-font-size-base, 14px));
|
|
57
|
-
white-space: pre-wrap;
|
|
58
|
-
word-wrap: break-word;
|
|
59
57
|
height: var(--nutui-notify-height, 40px);
|
|
58
|
+
padding: var(--nutui-notify-padding, 0px 12px);
|
|
59
|
+
border-radius: var(--nutui-notify-border-radius, 8px);
|
|
60
|
+
box-shadow: var(--nutui-notify-box-shadow, 0px 4px 12px 0px rgba(0, 0, 0, 0.06));
|
|
61
|
+
background-color: var(--nutui-notify-background-color, #ffffff);
|
|
62
|
+
}
|
|
63
|
+
.nut-notify-content {
|
|
64
|
+
flex: 1;
|
|
65
|
+
text-align: center;
|
|
66
|
+
min-width: 0;
|
|
67
|
+
font-size: var(--nutui-notify-font-size, var(--nutui-font-size-base, 14px));
|
|
68
|
+
color: var(--nutui-notify-text-color, var(--nutui-color-title, #1a1a1a));
|
|
69
|
+
white-space: nowrap;
|
|
70
|
+
overflow: hidden;
|
|
60
71
|
}
|
|
61
|
-
.nut-notify-
|
|
62
|
-
|
|
63
|
-
left: 0;
|
|
64
|
-
right: 0;
|
|
65
|
-
overflow-y: auto;
|
|
66
|
-
transition: transform 0.3s;
|
|
67
|
-
z-index: 9999;
|
|
68
|
-
}
|
|
69
|
-
.nut-notify-popup-top {
|
|
70
|
-
top: 0;
|
|
72
|
+
.nut-notify-ellipsis {
|
|
73
|
+
text-overflow: ellipsis;
|
|
71
74
|
}
|
|
72
|
-
.nut-notify-
|
|
73
|
-
|
|
75
|
+
.nut-notify-layout-left {
|
|
76
|
+
text-align: left;
|
|
74
77
|
}
|
|
75
|
-
.nut-notify-
|
|
76
|
-
|
|
78
|
+
.nut-notify-left-icon, .nut-notify-right-icon {
|
|
79
|
+
display: inline-flex;
|
|
77
80
|
}
|
|
78
|
-
.nut-notify-
|
|
79
|
-
|
|
81
|
+
.nut-notify-left-icon {
|
|
82
|
+
margin-right: 6px;
|
|
80
83
|
}
|
|
81
|
-
.nut-notify-
|
|
82
|
-
|
|
84
|
+
.nut-notify-left-icon .nut-icon {
|
|
85
|
+
height: 16px;
|
|
86
|
+
width: 16px;
|
|
83
87
|
}
|
|
84
|
-
.nut-notify-
|
|
85
|
-
|
|
88
|
+
.nut-notify-right-icon {
|
|
89
|
+
margin-left: 6px;
|
|
86
90
|
}
|
|
87
|
-
.nut-notify-
|
|
88
|
-
|
|
91
|
+
.nut-notify-right-icon .nut-icon {
|
|
92
|
+
height: 12px;
|
|
93
|
+
width: 12px;
|
|
89
94
|
}
|
|
@@ -310,4 +310,5 @@ import "./timedetail/timedetail.scss";
|
|
|
310
310
|
import "./timeselect/timeselect.scss";
|
|
311
311
|
import "./trendarrow/trendarrow.scss";
|
|
312
312
|
import "./watermark/watermark.scss";
|
|
313
|
+
export * from "../types";
|
|
313
314
|
export { Button, Cell, CellGroup, ConfigProvider, Image, Overlay, Divider, Grid, GridItem, Layout, Col, Row, SafeArea, Space, Sticky, BackTop, Elevator, FixedNav, HoverButton, HoverButtonItem, NavBar, SideBar, SideBarItem, Tabbar, TabbarItem, TabPane, Tabs, Address, Calendar, CalendarItem, CalendarCard, Cascader, Checkbox, CheckboxGroup, DatePicker, DatePickerView, Form, FormItem, Input, InputNumber, Menu, MenuItem, NumberKeyboard, Picker, PickerView, Radio, RadioGroup, Range, Rate, SearchBar, ShortPassword, Signature, Switch, TextArea, Uploader, ActionSheet, Badge, Dialog, Drag, Empty, InfiniteLoading, Loading, NoticeBar, Notify, Popover, Popup, PullToRefresh, ResultPage, Skeleton, Swipe, Toast, Animate, AnimatingNumbers, Audio, Avatar, AvatarGroup, CircleProgress, Collapse, CollapseItem, CountDown, Ellipsis, ImagePreview, Indicator, Lottie, Pagination, Price, Progress, Segmented, Step, Steps, Swiper, SwiperItem, Table, Tag, Tour, Video, VirtualList, AvatarCropper, Barrage, Card, TimeDetail, TimeSelect, TrendArrow, WaterMark };
|
|
@@ -384,7 +384,6 @@
|
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
.nut-pickerview {
|
|
387
|
-
--nutui-picker-item-height: 36px;
|
|
388
387
|
position: relative;
|
|
389
388
|
display: flex;
|
|
390
389
|
width: 100%;
|
|
@@ -430,6 +429,9 @@
|
|
|
430
429
|
z-index: 1;
|
|
431
430
|
transform-style: preserve-3d;
|
|
432
431
|
}
|
|
432
|
+
.nut-pickerview-roller-placeholder {
|
|
433
|
+
height: var(--nutui-picker-item-height, 36px);
|
|
434
|
+
}
|
|
433
435
|
.nut-pickerview-roller-item {
|
|
434
436
|
position: absolute;
|
|
435
437
|
top: 0;
|
|
@@ -8,9 +8,12 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
11
12
|
var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
|
+
var _define_property = require("@swc/helpers/_/_define_property");
|
|
12
14
|
var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
|
|
13
15
|
var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
16
|
+
var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
|
|
14
17
|
var _usetouch = require("../../hooks/use-touch");
|
|
15
18
|
var _supportspassive = require("../../utils/supports-passive");
|
|
16
19
|
var _utils = require("../../utils");
|
|
@@ -19,12 +22,13 @@ var InternalPickerRoller = function InternalPickerRoller(props, ref) {
|
|
|
19
22
|
var _props_keyIndex = props.keyIndex, keyIndex = _props_keyIndex === void 0 ? 0 : _props_keyIndex, _props_options = props.options, options = _props_options === void 0 ? [] : _props_options, _props_threeDimensional = props.threeDimensional, threeDimensional = _props_threeDimensional === void 0 ? true : _props_threeDimensional, _props_duration = props.duration, duration = _props_duration === void 0 ? 1000 : _props_duration, onSelect = props.onSelect, _props_renderLabel = props.renderLabel, renderLabel = _props_renderLabel === void 0 ? function renderLabel(item) {
|
|
20
23
|
return item.label;
|
|
21
24
|
} : _props_renderLabel;
|
|
25
|
+
var classPrefix = 'nut-pickerview-roller';
|
|
22
26
|
var DEFAULT_DURATION = 200;
|
|
23
27
|
var INERTIA_TIME = 300;
|
|
24
28
|
var INERTIA_DISTANCE = 15;
|
|
25
29
|
var ROTATION = 20;
|
|
26
30
|
var touch = (0, _usetouch.useTouch)();
|
|
27
|
-
var _useState = (0, _sliced_to_array._)((0, _react.useState)(
|
|
31
|
+
var _useState = (0, _sliced_to_array._)((0, _react.useState)(0), 2), currentIndex = _useState[0], setCurrentIndex = _useState[1];
|
|
28
32
|
var lineSpacing = (0, _react.useRef)(36);
|
|
29
33
|
var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), touchTime = _useState1[0], setTouchTime = _useState1[1];
|
|
30
34
|
var _useState2 = (0, _sliced_to_array._)((0, _react.useState)('0deg'), 2), touchDeg = _useState2[0], setTouchDeg = _useState2[1];
|
|
@@ -59,7 +63,7 @@ var InternalPickerRoller = function InternalPickerRoller(props, ref) {
|
|
|
59
63
|
var deg1 = Math.min(Math.max(currentDeg, 0), (options.length + 1) * ROTATION);
|
|
60
64
|
if (deg1 >= 0 && deg1 < (options.length + 1) * ROTATION) {
|
|
61
65
|
applyTransform('', "".concat(deg1, "deg"), undefined, updatedMove);
|
|
62
|
-
setCurrentIndex(Math.abs(Math.round(updatedMove / lineSpacing.current)) + 1);
|
|
66
|
+
deg1 > 0 && setCurrentIndex(Math.abs(Math.round(updatedMove / lineSpacing.current)) + 1);
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
};
|
|
@@ -100,7 +104,7 @@ var InternalPickerRoller = function InternalPickerRoller(props, ref) {
|
|
|
100
104
|
var index = options.findIndex(function(item) {
|
|
101
105
|
return item.value === selectedValue;
|
|
102
106
|
});
|
|
103
|
-
setCurrentIndex(index === -1 ?
|
|
107
|
+
setCurrentIndex(index === -1 ? 0 : index + 1);
|
|
104
108
|
var move = index * lineSpacing.current;
|
|
105
109
|
shouldSelect && selectValue(-move);
|
|
106
110
|
handleMove(-move);
|
|
@@ -160,21 +164,22 @@ var InternalPickerRoller = function InternalPickerRoller(props, ref) {
|
|
|
160
164
|
className: "nut-pickerview-list",
|
|
161
165
|
ref: pickerRollerRef
|
|
162
166
|
}, /*#__PURE__*/ _react.default.createElement("div", {
|
|
163
|
-
className:
|
|
167
|
+
className: classPrefix,
|
|
164
168
|
ref: rollerRef,
|
|
165
169
|
style: threeDimensional ? touchRollerStyle() : touchTiledStyle(),
|
|
166
170
|
onTransitionEnd: stopMomentumScroll
|
|
167
171
|
}, threeDimensional && options.map(function(item, index) {
|
|
168
172
|
var _item_value;
|
|
173
|
+
var _obj;
|
|
169
174
|
return /*#__PURE__*/ _react.default.createElement("div", {
|
|
170
|
-
className: "
|
|
175
|
+
className: (0, _classnames.default)("".concat(classPrefix, "-item"), (_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-item-hidden"), isItemHidden(index + 1)), (0, _define_property._)(_obj, "".concat(classPrefix, "-item-active"), index + 1 === currentIndex), _obj)),
|
|
171
176
|
style: rollerStyle(index),
|
|
172
177
|
key: (_item_value = item.value) !== null && _item_value !== void 0 ? _item_value : index
|
|
173
178
|
}, renderLabel(item));
|
|
174
179
|
}), !threeDimensional && options.map(function(item, index) {
|
|
175
180
|
var _item_value;
|
|
176
181
|
return /*#__PURE__*/ _react.default.createElement("div", {
|
|
177
|
-
className: "
|
|
182
|
+
className: (0, _classnames.default)("".concat(classPrefix, "-item-tiled"), (0, _define_property._)({}, "".concat(classPrefix, "-item-active"), index + 1 === currentIndex)),
|
|
178
183
|
key: (_item_value = item.value) !== null && _item_value !== void 0 ? _item_value : index
|
|
179
184
|
}, renderLabel(item));
|
|
180
185
|
})));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
.nut-pickerview {
|
|
2
|
-
--nutui-picker-item-height: 36px;
|
|
3
2
|
position: relative;
|
|
4
3
|
display: flex;
|
|
5
4
|
width: 100%;
|
|
@@ -50,6 +49,9 @@
|
|
|
50
49
|
height: $picker-item-height;
|
|
51
50
|
z-index: 1;
|
|
52
51
|
transform-style: preserve-3d;
|
|
52
|
+
&-placeholder {
|
|
53
|
+
height: $picker-item-height;
|
|
54
|
+
}
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
&-roller-item {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
/* #ifndef harmony */
|
|
4
4
|
/* #endif */
|
|
5
5
|
.nut-pickerview {
|
|
6
|
-
--nutui-picker-item-height: 36px;
|
|
7
6
|
position: relative;
|
|
8
7
|
display: flex;
|
|
9
8
|
width: 100%;
|
|
@@ -49,6 +48,9 @@
|
|
|
49
48
|
z-index: 1;
|
|
50
49
|
transform-style: preserve-3d;
|
|
51
50
|
}
|
|
51
|
+
.nut-pickerview-roller-placeholder {
|
|
52
|
+
height: var(--nutui-picker-item-height, 36px);
|
|
53
|
+
}
|
|
52
54
|
.nut-pickerview-roller-item {
|
|
53
55
|
position: absolute;
|
|
54
56
|
top: 0;
|