@nutui/nutui-react-taro 3.0.5 → 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 +40 -1
- package/dist/cjs/packages/badge/badge.js +4 -3
- package/dist/cjs/packages/badge/style/badge.scss +4 -0
- package/dist/cjs/packages/badge/style/style.css +9 -6
- package/dist/cjs/packages/badge/style/style.harmony.css +3 -0
- package/dist/cjs/packages/configprovider/types.d.ts +1 -1
- package/dist/cjs/packages/datepicker/style/style.css +3 -0
- package/dist/cjs/packages/datepickerview/style/style.css +3 -0
- package/dist/cjs/packages/fixednav/style/style.css +9 -6
- package/dist/cjs/packages/indicator/indicator.js +1 -1
- package/dist/cjs/packages/lottie/index.js +5 -5
- package/dist/cjs/packages/lottie/{mp.js → lottiemp.js} +1 -1
- package/dist/cjs/packages/notify/notify.js +44 -13
- package/dist/cjs/packages/notify/style/notify.scss +39 -36
- package/dist/cjs/packages/notify/style/style.css +36 -31
- package/dist/cjs/packages/notify/style/style.harmony.css +36 -31
- package/dist/cjs/packages/picker/style/style.css +3 -0
- package/dist/cjs/packages/pickerview/pickerroller.js +7 -2
- package/dist/cjs/packages/pickerview/style/pickerview.scss +3 -0
- package/dist/cjs/packages/pickerview/style/style.css +3 -0
- package/dist/cjs/packages/pickerview/style/style.harmony.css +3 -0
- package/dist/cjs/packages/searchbar/searchbar.js +8 -2
- package/dist/cjs/packages/skeleton/skeleton.js +63 -52
- 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/skeleton/style/style.harmony.css +32 -42
- package/dist/cjs/packages/switch/style/style.css +5 -0
- package/dist/cjs/packages/switch/style/style.harmony.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 +54 -45
- package/dist/cjs/packages/tabbar/style/style.harmony.css +24 -18
- 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 +30 -27
- package/dist/cjs/packages/tabbaritem/style/style.harmony.css +21 -21
- package/dist/cjs/packages/tabbaritem/style/tabbaritem.scss +32 -29
- package/dist/cjs/packages/tabbaritem/tabbaritem.js +38 -14
- 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 +4 -0
- package/dist/es/packages/badge/style/style.css +9 -6
- package/dist/es/packages/badge/style/style.harmony.css +3 -0
- package/dist/es/packages/configprovider/types.d.ts +1 -1
- package/dist/es/packages/datepicker/style/style.css +3 -0
- package/dist/es/packages/datepickerview/style/style.css +3 -0
- package/dist/es/packages/fixednav/style/style.css +9 -6
- package/dist/es/packages/indicator/indicator.js +1 -1
- package/dist/es/packages/lottie/index.js +3 -3
- package/dist/es/packages/lottie/{mp.js → lottiemp.js} +1 -1
- package/dist/es/packages/notify/notify.js +45 -14
- package/dist/es/packages/notify/style/notify.scss +39 -36
- package/dist/es/packages/notify/style/style.css +36 -31
- package/dist/es/packages/notify/style/style.harmony.css +36 -31
- package/dist/es/packages/picker/style/style.css +3 -0
- package/dist/es/packages/pickerview/pickerroller.js +7 -2
- package/dist/es/packages/pickerview/style/pickerview.scss +3 -0
- package/dist/es/packages/pickerview/style/style.css +3 -0
- package/dist/es/packages/pickerview/style/style.harmony.css +3 -0
- package/dist/es/packages/searchbar/searchbar.js +7 -2
- package/dist/es/packages/skeleton/skeleton.js +62 -52
- 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/skeleton/style/style.harmony.css +32 -42
- package/dist/es/packages/switch/style/style.css +5 -0
- package/dist/es/packages/switch/style/style.harmony.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 +54 -45
- package/dist/es/packages/tabbar/style/style.harmony.css +24 -18
- 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 +30 -27
- package/dist/es/packages/tabbaritem/style/style.harmony.css +21 -21
- package/dist/es/packages/tabbaritem/style/tabbaritem.scss +32 -29
- package/dist/es/packages/tabbaritem/tabbaritem.js +38 -14
- 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 +422 -297
- package/dist/style.css +1 -1
- package/dist/style.scss +47 -47
- package/dist/styles/variables-jmapp.scss +23 -1
- package/dist/styles/variables-jrkf.scss +23 -1
- package/dist/styles/variables.scss +35 -37
- package/package.json +1 -1
- /package/dist/cjs/packages/lottie/{mp.d.ts → lottiemp.d.ts} +0 -0
- /package/dist/cjs/packages/lottie/{web.d.ts → lottieweb.d.ts} +0 -0
- /package/dist/cjs/packages/lottie/{web.js → lottieweb.js} +0 -0
- /package/dist/es/packages/lottie/{mp.d.ts → lottiemp.d.ts} +0 -0
- /package/dist/es/packages/lottie/{web.d.ts → lottieweb.d.ts} +0 -0
- /package/dist/es/packages/lottie/{web.js → lottieweb.js} +0 -0
|
@@ -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
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/*入场动画过程*/
|
|
13
13
|
.fade-enter-active {
|
|
14
14
|
opacity: 1;
|
|
15
|
-
transition: opacity
|
|
15
|
+
transition: opacity 300ms ease-in;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/*入场动画结束*/
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
/*离场动画过程*/
|
|
29
29
|
.fade-exit-active {
|
|
30
30
|
opacity: 0;
|
|
31
|
-
transition: opacity
|
|
31
|
+
transition: opacity 300ms ease-out;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/*离场动画结束*/
|
|
@@ -44,47 +44,52 @@
|
|
|
44
44
|
/*页面第一次加载时的动画过程*/
|
|
45
45
|
.fade-appear-active {
|
|
46
46
|
opacity: 1;
|
|
47
|
-
transition: opacity
|
|
47
|
+
transition: opacity 300ms;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
.nut-notify {
|
|
51
|
+
position: fixed;
|
|
52
|
+
left: 8px;
|
|
53
|
+
right: 8px;
|
|
54
|
+
z-index: 1000;
|
|
51
55
|
display: flex;
|
|
52
|
-
justify-content: center;
|
|
53
56
|
align-items: center;
|
|
54
57
|
box-sizing: border-box;
|
|
55
|
-
padding: 0px 10px;
|
|
56
|
-
color: #ffffff;
|
|
57
|
-
font-size: 14px;
|
|
58
|
-
white-space: pre-wrap;
|
|
59
|
-
word-wrap: break-word;
|
|
60
58
|
height: 40px;
|
|
59
|
+
padding: 0px 12px;
|
|
60
|
+
border-radius: 8px;
|
|
61
|
+
box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.06);
|
|
62
|
+
background-color: #ffffff;
|
|
63
|
+
}
|
|
64
|
+
.nut-notify-content {
|
|
65
|
+
flex: 1;
|
|
66
|
+
text-align: center;
|
|
67
|
+
min-width: 0;
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
color: #1a1a1a;
|
|
70
|
+
white-space: nowrap;
|
|
71
|
+
overflow: hidden;
|
|
61
72
|
}
|
|
62
|
-
.nut-notify-
|
|
63
|
-
|
|
64
|
-
left: 0;
|
|
65
|
-
right: 0;
|
|
66
|
-
overflow-y: auto;
|
|
67
|
-
transition: transform 0.3s;
|
|
68
|
-
z-index: 9999;
|
|
69
|
-
}
|
|
70
|
-
.nut-notify-popup-top {
|
|
71
|
-
top: 0;
|
|
73
|
+
.nut-notify-ellipsis {
|
|
74
|
+
text-overflow: ellipsis;
|
|
72
75
|
}
|
|
73
|
-
.nut-notify-
|
|
74
|
-
|
|
76
|
+
.nut-notify-layout-left {
|
|
77
|
+
text-align: left;
|
|
75
78
|
}
|
|
76
|
-
.nut-notify-
|
|
77
|
-
|
|
79
|
+
.nut-notify-left-icon, .nut-notify-right-icon {
|
|
80
|
+
display: inline-flex;
|
|
78
81
|
}
|
|
79
|
-
.nut-notify-
|
|
80
|
-
|
|
82
|
+
.nut-notify-left-icon {
|
|
83
|
+
margin-right: 6px;
|
|
81
84
|
}
|
|
82
|
-
.nut-notify-
|
|
83
|
-
|
|
85
|
+
.nut-notify-left-icon .nut-icon {
|
|
86
|
+
height: 16px;
|
|
87
|
+
width: 16px;
|
|
84
88
|
}
|
|
85
|
-
.nut-notify-
|
|
86
|
-
|
|
89
|
+
.nut-notify-right-icon {
|
|
90
|
+
margin-left: 6px;
|
|
87
91
|
}
|
|
88
|
-
.nut-notify-
|
|
89
|
-
|
|
92
|
+
.nut-notify-right-icon .nut-icon {
|
|
93
|
+
height: 12px;
|
|
94
|
+
width: 12px;
|
|
90
95
|
}
|
|
@@ -42,6 +42,7 @@ var InternalPickerRoller = function InternalPickerRoller(props, ref) {
|
|
|
42
42
|
var isMoving = (0, _react.useRef)(false);
|
|
43
43
|
var rollerRef = (0, _react.useRef)(null);
|
|
44
44
|
var pickerRollerRef = (0, _react.useRef)(null);
|
|
45
|
+
var placeholderRef = (0, _react.useRef)(null);
|
|
45
46
|
var _useState3 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), startTime = _useState3[0], setStartTime = _useState3[1];
|
|
46
47
|
var _useState4 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), startY = _useState4[0], setStartY = _useState4[1];
|
|
47
48
|
var transformY = (0, _react.useRef)(0);
|
|
@@ -136,7 +137,7 @@ var InternalPickerRoller = function InternalPickerRoller(props, ref) {
|
|
|
136
137
|
]);
|
|
137
138
|
return [
|
|
138
139
|
4,
|
|
139
|
-
(0, _getrectbytaro.getRectByTaro)(
|
|
140
|
+
(0, _getrectbytaro.getRectByTaro)(placeholderRef.current)
|
|
140
141
|
];
|
|
141
142
|
case 1:
|
|
142
143
|
placeholder = _state.sent();
|
|
@@ -184,7 +185,7 @@ var InternalPickerRoller = function InternalPickerRoller(props, ref) {
|
|
|
184
185
|
}
|
|
185
186
|
}, [
|
|
186
187
|
pickerRollerRef.current,
|
|
187
|
-
|
|
188
|
+
placeholderRef.current
|
|
188
189
|
]);
|
|
189
190
|
(0, _react.useEffect)(function() {
|
|
190
191
|
isMoving.current = false;
|
|
@@ -226,6 +227,10 @@ var InternalPickerRoller = function InternalPickerRoller(props, ref) {
|
|
|
226
227
|
className: "nut-pickerview-list",
|
|
227
228
|
ref: pickerRollerRef
|
|
228
229
|
}, /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
230
|
+
className: "".concat(classPrefix, "-placeholder"),
|
|
231
|
+
ref: placeholderRef,
|
|
232
|
+
id: "".concat(classPrefix, "-placeholder-").concat(uuid)
|
|
233
|
+
}), /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
229
234
|
className: classPrefix,
|
|
230
235
|
id: "".concat(classPrefix, "-").concat(uuid),
|
|
231
236
|
ref: rollerRef,
|
|
@@ -8,10 +8,12 @@ Object.defineProperty(exports, "SearchBar", {
|
|
|
8
8
|
return SearchBar;
|
|
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");
|
|
12
13
|
var _object_spread = require("@swc/helpers/_/_object_spread");
|
|
13
14
|
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
|
|
14
15
|
var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
|
|
16
|
+
var _taro = /*#__PURE__*/ _interop_require_default._(require("@tarojs/taro"));
|
|
15
17
|
var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
16
18
|
var _components = require("@tarojs/components");
|
|
17
19
|
var _iconsreacttaro = require("@nutui/icons-react-taro");
|
|
@@ -69,7 +71,9 @@ var SearchBar = function SearchBar(props) {
|
|
|
69
71
|
outerValue
|
|
70
72
|
]);
|
|
71
73
|
(0, _react.useEffect)(function() {
|
|
72
|
-
|
|
74
|
+
if (_taro.default.getEnv() === 'WEB') {
|
|
75
|
+
autoFocus && forceFocus();
|
|
76
|
+
}
|
|
73
77
|
}, [
|
|
74
78
|
autoFocus
|
|
75
79
|
]);
|
|
@@ -77,10 +81,12 @@ var SearchBar = function SearchBar(props) {
|
|
|
77
81
|
return /*#__PURE__*/ _react.default.createElement(_components.Input, {
|
|
78
82
|
className: "".concat(classPrefix, "-input ").concat(clearable ? "".concat(classPrefix, "-input-clear") : ''),
|
|
79
83
|
ref: searchRef,
|
|
80
|
-
|
|
84
|
+
style: style,
|
|
85
|
+
value: (value || '').toString(),
|
|
81
86
|
placeholder: placeholder || locale.placeholder,
|
|
82
87
|
disabled: disabled || readOnly,
|
|
83
88
|
maxlength: maxLength,
|
|
89
|
+
autoFocus: autoFocus,
|
|
84
90
|
onInput: onInput,
|
|
85
91
|
onFocus: focus,
|
|
86
92
|
onBlur: blur,
|
|
@@ -9,83 +9,94 @@ Object.defineProperty(exports, "Skeleton", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
-
var
|
|
12
|
+
var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
13
|
var _object_spread = require("@swc/helpers/_/_object_spread");
|
|
14
14
|
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
|
|
15
15
|
var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
|
|
16
|
-
var
|
|
17
|
-
var
|
|
16
|
+
var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
|
|
17
|
+
var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
18
18
|
var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
|
|
19
|
-
var
|
|
19
|
+
var _components = require("@tarojs/components");
|
|
20
20
|
var _typings = require("../../utils/typings");
|
|
21
|
-
var _pxtransform = /*#__PURE__*/ _interop_require_default._(require("../../utils/px-transform"));
|
|
22
21
|
var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
|
|
23
22
|
rows: 1,
|
|
24
|
-
animated:
|
|
25
|
-
title: false,
|
|
26
|
-
avatar: false,
|
|
27
|
-
avatarSize: '50px',
|
|
23
|
+
animated: true,
|
|
28
24
|
visible: false,
|
|
29
|
-
|
|
25
|
+
size: 'normal',
|
|
26
|
+
shape: 'round',
|
|
27
|
+
duration: 0.6,
|
|
28
|
+
inline: false
|
|
30
29
|
});
|
|
31
30
|
var Skeleton = function Skeleton(props) {
|
|
32
|
-
var
|
|
31
|
+
var shapeStyle = function shapeStyle() {
|
|
32
|
+
if (shape === 'circle') return {
|
|
33
|
+
borderRadius: '50%'
|
|
34
|
+
};
|
|
35
|
+
if (shape === 'square') return {
|
|
36
|
+
borderRadius: '0'
|
|
37
|
+
};
|
|
38
|
+
return {};
|
|
39
|
+
};
|
|
40
|
+
var durationStyle = function durationStyle() {
|
|
41
|
+
if (typeof duration !== 'undefined') return {
|
|
42
|
+
animationDuration: "".concat(duration, "s")
|
|
43
|
+
};
|
|
44
|
+
return {};
|
|
45
|
+
};
|
|
46
|
+
var _ref = (0, _object_spread._)({}, defaultProps, props), className = _ref.className, width = _ref.width, height = _ref.height, shape = _ref.shape, animated = _ref.animated, rows = _ref.rows, visible = _ref.visible, size = _ref.size, duration = _ref.duration, children = _ref.children, rest = (0, _object_without_properties._)(_ref, [
|
|
33
47
|
"className",
|
|
48
|
+
"width",
|
|
49
|
+
"height",
|
|
50
|
+
"shape",
|
|
34
51
|
"animated",
|
|
35
52
|
"rows",
|
|
36
|
-
"title",
|
|
37
|
-
"avatar",
|
|
38
|
-
"avatarSize",
|
|
39
53
|
"visible",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
54
|
+
"size",
|
|
55
|
+
"duration",
|
|
56
|
+
"children"
|
|
42
57
|
]);
|
|
43
58
|
var classPrefix = 'nut-skeleton';
|
|
44
59
|
var classes = (0, _classnames.default)(classPrefix, className);
|
|
45
|
-
var
|
|
46
|
-
var avatarClass = (0, _classnames.default)((_obj = {}, (0, _define_property._)(_obj, "nut-avatar", true), (0, _define_property._)(_obj, "nut-skeleton-content-avatar", true), (0, _define_property._)(_obj, "avatar-".concat(avatarShape), avatarShape), _obj));
|
|
47
|
-
var repeatLines = function repeatLines(num) {
|
|
60
|
+
var repeatCount = function repeatCount(num) {
|
|
48
61
|
return Array.from({
|
|
49
62
|
length: num
|
|
50
63
|
}, function(v, i) {
|
|
51
64
|
return i;
|
|
52
65
|
});
|
|
53
66
|
};
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
width: (0, _pxtransform.default)(50),
|
|
63
|
-
height: (0, _pxtransform.default)(50)
|
|
64
|
-
};
|
|
67
|
+
var _useState = (0, _sliced_to_array._)((0, _react.useState)(false), 2), animate = _useState[0], setAnimate = _useState[1];
|
|
68
|
+
var playAnimation = function playAnimation() {
|
|
69
|
+
setAnimate(false);
|
|
70
|
+
setTimeout(function() {
|
|
71
|
+
setAnimate(true);
|
|
72
|
+
}, 10);
|
|
65
73
|
};
|
|
66
|
-
|
|
74
|
+
(0, _react.useEffect)(function() {
|
|
75
|
+
if (!animated) return;
|
|
76
|
+
playAnimation();
|
|
77
|
+
// 每隔 3 秒播放一次动画
|
|
78
|
+
var intervalId = setInterval(playAnimation, 1000 + duration * 1000) // xs 动画 + 1s 间隔
|
|
79
|
+
;
|
|
80
|
+
// 清理定时器
|
|
81
|
+
return function() {
|
|
82
|
+
return clearInterval(intervalId);
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, visible ? children : /*#__PURE__*/ _react.default.createElement(_components.View, (0, _object_spread._)({
|
|
67
86
|
className: classes
|
|
68
|
-
}, rest),
|
|
69
|
-
|
|
70
|
-
}), /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
71
|
-
className: "".concat(classPrefix, "-content")
|
|
72
|
-
}, avatar && /*#__PURE__*/ _react.default.createElement(_index.default, {
|
|
73
|
-
className: avatarClass,
|
|
74
|
-
background: "rgb(239, 239, 239)",
|
|
75
|
-
shape: avatarShape,
|
|
76
|
-
style: getStyle(),
|
|
77
|
-
icon: "null"
|
|
78
|
-
}), rows === 1 ? /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
79
|
-
className: "".concat(classPrefix, "-content-block")
|
|
80
|
-
}) : /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
81
|
-
className: "".concat(classPrefix, "-content-line")
|
|
82
|
-
}, title && /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
83
|
-
className: "".concat(classPrefix, "-content-title")
|
|
84
|
-
}), repeatLines(rows).map(function(item, index) {
|
|
87
|
+
}, rest), repeatCount(rows).map(function(item, index) {
|
|
88
|
+
var contentClass = "".concat(classPrefix, "-content ").concat(classPrefix, "-content-").concat(size, " ").concat(classPrefix, "-content-").concat(size, "-").concat(index);
|
|
85
89
|
return /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
86
|
-
className: "".concat(
|
|
87
|
-
key: index
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
className: "".concat(contentClass),
|
|
91
|
+
key: index,
|
|
92
|
+
style: (0, _object_spread._)({
|
|
93
|
+
width: width,
|
|
94
|
+
height: height
|
|
95
|
+
}, shapeStyle())
|
|
96
|
+
}, animated && /*#__PURE__*/ _react.default.createElement(_components.View, {
|
|
97
|
+
className: "".concat(classPrefix, "-animated ").concat(animate ? "".concat(classPrefix, "-animation") : ''),
|
|
98
|
+
style: durationStyle()
|
|
99
|
+
}));
|
|
100
|
+
})));
|
|
90
101
|
};
|
|
91
102
|
Skeleton.displayName = 'NutSkeleton';
|
|
@@ -1,44 +1,29 @@
|
|
|
1
1
|
.nut-skeleton {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
overflow: hidden;
|
|
5
|
-
vertical-align: middle;
|
|
6
|
-
width: 100%;
|
|
2
|
+
line-height: 0px;
|
|
3
|
+
font-size: 0px;
|
|
7
4
|
|
|
8
5
|
&-content {
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
position: relative;
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
width: $skeleton-line-width;
|
|
9
|
+
background: $skeleton-background;
|
|
10
|
+
border-radius: $skeleton-line-border-radius;
|
|
11
|
+
overflow: hidden;
|
|
11
12
|
|
|
12
|
-
&-
|
|
13
|
-
|
|
14
|
-
background: $skeleton-background !important;
|
|
13
|
+
&-normal {
|
|
14
|
+
height: $skeleton-line-normal-height;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
&-
|
|
18
|
-
|
|
19
|
-
height: $skeleton-line-height;
|
|
20
|
-
background: $skeleton-background;
|
|
21
|
-
margin-top: 10px;
|
|
22
|
-
border-radius: $skeleton-line-border-radius;
|
|
17
|
+
&-large {
|
|
18
|
+
height: $skeleton-line-large-height;
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
&-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
.nut-skeleton-content-block:last-child {
|
|
30
|
-
width: 70%;
|
|
31
|
-
}
|
|
21
|
+
&-small {
|
|
22
|
+
height: $skeleton-line-small-height;
|
|
23
|
+
margin-top: 8px;
|
|
32
24
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
width: 30%;
|
|
36
|
-
height: $skeleton-line-height;
|
|
37
|
-
background: $skeleton-background;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&-block-last-child {
|
|
41
|
-
width: 55%;
|
|
25
|
+
&-small-0 {
|
|
26
|
+
margin-top: 0;
|
|
42
27
|
}
|
|
43
28
|
}
|
|
44
29
|
|
|
@@ -49,41 +34,50 @@
|
|
|
49
34
|
width: 100%;
|
|
50
35
|
height: 100%;
|
|
51
36
|
z-index: 1;
|
|
52
|
-
|
|
37
|
+
background: linear-gradient(
|
|
38
|
+
90deg,
|
|
39
|
+
rgba(0, 0, 0, 0) 0%,
|
|
40
|
+
rgba(0, 0, 0, 0.02) 50%,
|
|
41
|
+
rgba(0, 0, 0, 0) 100%
|
|
42
|
+
);
|
|
43
|
+
animation-name: nut-skeleton;
|
|
44
|
+
animation-delay: 0s;
|
|
45
|
+
animation-duration: 0.6s;
|
|
46
|
+
animation-direction: normal;
|
|
47
|
+
animation-fill-mode: both;
|
|
48
|
+
animation-play-state: running;
|
|
49
|
+
animation-iteration-count: 1;
|
|
50
|
+
animation-timing-function: linear;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
@keyframes nut-skeleton {
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
from {
|
|
55
|
+
transform: translateX(-100%);
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
to {
|
|
61
|
-
|
|
59
|
+
transform: translateX(100%);
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
[dir='rtl'] .nut-skeleton,
|
|
67
65
|
.nut-rtl .nut-skeleton {
|
|
68
|
-
&-content {
|
|
69
|
-
.nut-avatar {
|
|
70
|
-
margin-right: 0;
|
|
71
|
-
margin-left: 20px;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
66
|
&-animation {
|
|
75
67
|
left: auto;
|
|
76
68
|
right: 0;
|
|
77
|
-
animation: nut-skeleton-rtl 2s
|
|
69
|
+
animation: nut-skeleton-rtl 2s linear 0s infinite;
|
|
78
70
|
}
|
|
79
71
|
|
|
80
72
|
@keyframes nut-skeleton-rtl {
|
|
81
|
-
|
|
82
|
-
background-position
|
|
73
|
+
from {
|
|
74
|
+
//background-position: -200% 0;
|
|
75
|
+
transform: translateX(100%);
|
|
83
76
|
}
|
|
84
77
|
|
|
85
78
|
to {
|
|
86
|
-
background-position
|
|
79
|
+
//background-position: 200% 0;
|
|
80
|
+
transform: translateX(-100%);
|
|
87
81
|
}
|
|
88
82
|
}
|
|
89
83
|
}
|