@nutui/nutui-react-taro 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.
Files changed (140) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/cjs/packages/badge/badge.js +4 -3
  3. package/dist/cjs/packages/badge/style/badge.scss +7 -8
  4. package/dist/cjs/packages/badge/style/style.css +13 -15
  5. package/dist/cjs/packages/badge/style/style.harmony.css +7 -9
  6. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  7. package/dist/cjs/packages/datepicker/style/style.css +3 -1
  8. package/dist/cjs/packages/datepickerview/style/style.css +3 -1
  9. package/dist/cjs/packages/empty/style/index.js +1 -0
  10. package/dist/cjs/packages/empty/style/style.css +389 -0
  11. package/dist/cjs/packages/fixednav/fixednav.js +3 -3
  12. package/dist/cjs/packages/fixednav/style/fixednav.scss +43 -39
  13. package/dist/cjs/packages/fixednav/style/style.css +56 -51
  14. package/dist/cjs/packages/fixednav/style/style.harmony.css +43 -36
  15. package/dist/cjs/packages/imagepreview/imagepreview.js +58 -91
  16. package/dist/cjs/packages/imagepreview/style/imagepreview.scss +2 -1
  17. package/dist/cjs/packages/imagepreview/style/style.css +2 -1
  18. package/dist/cjs/packages/imagepreview/style/style.harmony.css +2 -1
  19. package/dist/cjs/packages/indicator/indicator.js +1 -1
  20. package/dist/cjs/packages/inputnumber/inputnumber.js +2 -2
  21. package/dist/cjs/packages/lottie/index.js +5 -5
  22. package/dist/cjs/packages/lottie/{mp.js → lottiemp.js} +1 -1
  23. package/dist/cjs/packages/notify/notify.js +44 -13
  24. package/dist/cjs/packages/notify/style/notify.scss +39 -36
  25. package/dist/cjs/packages/notify/style/style.css +36 -31
  26. package/dist/cjs/packages/notify/style/style.harmony.css +36 -31
  27. package/dist/cjs/packages/nutui.react.d.ts +1 -0
  28. package/dist/cjs/packages/nutui.react.js +1 -0
  29. package/dist/cjs/packages/picker/style/style.css +3 -1
  30. package/dist/cjs/packages/pickerview/pickerroller.js +81 -11
  31. package/dist/cjs/packages/pickerview/style/pickerview.scss +3 -1
  32. package/dist/cjs/packages/pickerview/style/style.css +3 -1
  33. package/dist/cjs/packages/pickerview/style/style.harmony.css +3 -0
  34. package/dist/cjs/packages/resultpage/style/index.js +1 -0
  35. package/dist/cjs/packages/resultpage/style/style.css +389 -0
  36. package/dist/cjs/packages/searchbar/searchbar.js +8 -2
  37. package/dist/cjs/packages/skeleton/skeleton.js +63 -52
  38. package/dist/cjs/packages/skeleton/style/index.js +0 -1
  39. package/dist/cjs/packages/skeleton/style/skeleton.scss +40 -46
  40. package/dist/cjs/packages/skeleton/style/style.css +32 -175
  41. package/dist/cjs/packages/skeleton/style/style.harmony.css +32 -42
  42. package/dist/cjs/packages/switch/style/style.css +5 -0
  43. package/dist/cjs/packages/switch/style/style.harmony.css +5 -0
  44. package/dist/cjs/packages/switch/style/switch.scss +5 -0
  45. package/dist/cjs/packages/switch/switch.js +22 -11
  46. package/dist/cjs/packages/tabbar/style/style.css +58 -54
  47. package/dist/cjs/packages/tabbar/style/style.harmony.css +24 -18
  48. package/dist/cjs/packages/tabbar/style/tabbar.scss +28 -19
  49. package/dist/cjs/packages/tabbar/tabbar.js +28 -10
  50. package/dist/cjs/packages/tabbaritem/style/style.css +34 -36
  51. package/dist/cjs/packages/tabbaritem/style/style.harmony.css +21 -21
  52. package/dist/cjs/packages/tabbaritem/style/tabbaritem.scss +32 -29
  53. package/dist/cjs/packages/tabbaritem/tabbaritem.js +38 -14
  54. package/dist/cjs/types/spec/badge/base.d.ts +1 -0
  55. package/dist/cjs/types/spec/indicator/base.d.ts +1 -1
  56. package/dist/cjs/types/spec/notify/base.d.ts +7 -2
  57. package/dist/cjs/types/spec/searchbar/taro.d.ts +10 -7
  58. package/dist/cjs/types/spec/skeleton/base.d.ts +7 -5
  59. package/dist/cjs/types/spec/switch/base.d.ts +3 -2
  60. package/dist/cjs/types/spec/switch/h5.d.ts +1 -1
  61. package/dist/cjs/types/spec/switch/taro.d.ts +1 -4
  62. package/dist/cjs/types/spec/tabbar/base.d.ts +7 -4
  63. package/dist/es/packages/badge/badge.js +4 -3
  64. package/dist/es/packages/badge/style/badge.scss +7 -8
  65. package/dist/es/packages/badge/style/style.css +13 -15
  66. package/dist/es/packages/badge/style/style.harmony.css +7 -9
  67. package/dist/es/packages/configprovider/types.d.ts +1 -1
  68. package/dist/es/packages/datepicker/style/style.css +3 -1
  69. package/dist/es/packages/datepickerview/style/style.css +3 -1
  70. package/dist/es/packages/empty/style/index.js +1 -0
  71. package/dist/es/packages/empty/style/style.css +389 -0
  72. package/dist/es/packages/fixednav/fixednav.js +4 -4
  73. package/dist/es/packages/fixednav/style/fixednav.scss +43 -39
  74. package/dist/es/packages/fixednav/style/style.css +56 -51
  75. package/dist/es/packages/fixednav/style/style.harmony.css +43 -36
  76. package/dist/es/packages/imagepreview/imagepreview.js +58 -91
  77. package/dist/es/packages/imagepreview/style/imagepreview.scss +2 -1
  78. package/dist/es/packages/imagepreview/style/style.css +2 -1
  79. package/dist/es/packages/imagepreview/style/style.harmony.css +2 -1
  80. package/dist/es/packages/indicator/indicator.js +1 -1
  81. package/dist/es/packages/inputnumber/inputnumber.js +2 -2
  82. package/dist/es/packages/lottie/index.js +3 -3
  83. package/dist/es/packages/lottie/{mp.js → lottiemp.js} +1 -1
  84. package/dist/es/packages/notify/notify.js +45 -14
  85. package/dist/es/packages/notify/style/notify.scss +39 -36
  86. package/dist/es/packages/notify/style/style.css +36 -31
  87. package/dist/es/packages/notify/style/style.harmony.css +36 -31
  88. package/dist/es/packages/picker/style/style.css +3 -1
  89. package/dist/es/packages/pickerview/pickerroller.js +80 -11
  90. package/dist/es/packages/pickerview/style/pickerview.scss +3 -1
  91. package/dist/es/packages/pickerview/style/style.css +3 -1
  92. package/dist/es/packages/pickerview/style/style.harmony.css +3 -0
  93. package/dist/es/packages/resultpage/style/index.js +1 -0
  94. package/dist/es/packages/resultpage/style/style.css +389 -0
  95. package/dist/es/packages/searchbar/searchbar.js +7 -2
  96. package/dist/es/packages/skeleton/skeleton.js +62 -52
  97. package/dist/es/packages/skeleton/style/index.js +0 -1
  98. package/dist/es/packages/skeleton/style/skeleton.scss +40 -46
  99. package/dist/es/packages/skeleton/style/style.css +32 -175
  100. package/dist/es/packages/skeleton/style/style.harmony.css +32 -42
  101. package/dist/es/packages/switch/style/style.css +5 -0
  102. package/dist/es/packages/switch/style/style.harmony.css +5 -0
  103. package/dist/es/packages/switch/style/switch.scss +5 -0
  104. package/dist/es/packages/switch/switch.js +21 -11
  105. package/dist/es/packages/tabbar/style/style.css +58 -54
  106. package/dist/es/packages/tabbar/style/style.harmony.css +24 -18
  107. package/dist/es/packages/tabbar/style/tabbar.scss +28 -19
  108. package/dist/es/packages/tabbar/tabbar.js +27 -10
  109. package/dist/es/packages/tabbaritem/style/style.css +34 -36
  110. package/dist/es/packages/tabbaritem/style/style.harmony.css +21 -21
  111. package/dist/es/packages/tabbaritem/style/tabbaritem.scss +32 -29
  112. package/dist/es/packages/tabbaritem/tabbaritem.js +38 -14
  113. package/dist/es/types/spec/badge/base.d.ts +4 -0
  114. package/dist/es/types/spec/indicator/base.d.ts +1 -1
  115. package/dist/es/types/spec/notify/base.d.ts +22 -5
  116. package/dist/es/types/spec/searchbar/taro.d.ts +10 -7
  117. package/dist/es/types/spec/skeleton/base.d.ts +19 -14
  118. package/dist/es/types/spec/switch/base.d.ts +6 -2
  119. package/dist/es/types/spec/switch/h5.d.ts +1 -1
  120. package/dist/es/types/spec/switch/taro.d.ts +1 -4
  121. package/dist/es/types/spec/tabbar/base.d.ts +7 -4
  122. package/dist/nutui.react.umd.js +549 -395
  123. package/dist/style.css +1 -1
  124. package/dist/style.scss +51 -51
  125. package/dist/styles/theme-dark.scss +2 -0
  126. package/dist/styles/theme-default.scss +2 -0
  127. package/dist/styles/themes/dark.css +1 -1
  128. package/dist/styles/themes/default.css +1 -1
  129. package/dist/styles/themes/jmapp.css +1 -1
  130. package/dist/styles/themes/jrkf.css +1 -1
  131. package/dist/styles/variables-jmapp.scss +24 -1
  132. package/dist/styles/variables-jrkf.scss +24 -1
  133. package/dist/styles/variables.scss +37 -38
  134. package/package.json +1 -1
  135. /package/dist/cjs/packages/lottie/{mp.d.ts → lottiemp.d.ts} +0 -0
  136. /package/dist/cjs/packages/lottie/{web.d.ts → lottieweb.d.ts} +0 -0
  137. /package/dist/cjs/packages/lottie/{web.js → lottieweb.js} +0 -0
  138. /package/dist/es/packages/lottie/{mp.d.ts → lottiemp.d.ts} +0 -0
  139. /package/dist/es/packages/lottie/{web.d.ts → lottieweb.d.ts} +0 -0
  140. /package/dist/es/packages/lottie/{web.js → lottieweb.js} +0 -0
@@ -60,6 +60,8 @@
60
60
  .nut-badge {
61
61
  position: relative;
62
62
  display: inline-flex;
63
+ vertical-align: middle;
64
+ box-sizing: content-box;
63
65
  width: auto;
64
66
  }
65
67
  .nut-badge-icon {
@@ -92,13 +94,12 @@
92
94
  }
93
95
  .nut-badge-sup {
94
96
  display: inline-flex;
95
- justify-content: center;
96
- height: var(--nutui-badge-height, 14px);
97
+ text-align: center;
97
98
  min-width: var(--nutui-badge-min-width, 6px);
98
99
  padding: var(--nutui-badge-padding, 1px 4px);
99
100
  box-sizing: border-box;
100
101
  color: var(--nutui-badge-color, #ffffff);
101
- font-size: var(--nutui-badge-font-size, var(--nutui-font-size-xxs, 10px));
102
+ font-size: var(--nutui-badge-font-size, var(--nutui-font-size-xxxs, 9px));
102
103
  line-height: 12px;
103
104
  white-space: nowrap;
104
105
  font-weight: normal;
@@ -106,14 +107,11 @@
106
107
  background: var(--nutui-badge-background-color, var(--nutui-color-primary, #ff0f23));
107
108
  z-index: 1;
108
109
  }
110
+ .nut-badge-disabled {
111
+ background: var(--nutui-badge-background-disabled-color, var(--nutui-color-text-disabled, #c2c4cc));
112
+ }
109
113
  .nut-badge-number {
110
114
  font-family: "JD";
111
- /* #ifdef harmony */
112
- line-height: 12px;
113
- /* #endif */
114
- /* #ifndef harmony */
115
- line-height: 13px;
116
- /* #endif */
117
115
  }
118
116
  .nut-badge-one {
119
117
  height: var(--nutui-badge-height, 14px);
@@ -137,14 +135,14 @@
137
135
  height: var(--nutui-badge-dot-width, 6px);
138
136
  }
139
137
  .nut-badge-dot-small {
140
- min-width: var(--nutui-badge-dot-width, 4px);
141
- width: var(--nutui-badge-dot-width, 4px);
142
- height: var(--nutui-badge-dot-width, 4px);
138
+ min-width: var(--nutui-badge-dot-small-width, 4px);
139
+ width: var(--nutui-badge-dot-small-width, 4px);
140
+ height: var(--nutui-badge-dot-small-width, 4px);
143
141
  }
144
142
  .nut-badge-dot-large {
145
- min-width: var(--nutui-badge-dot-width, 8px);
146
- width: var(--nutui-badge-dot-width, 8px);
147
- height: var(--nutui-badge-dot-width, 8px);
143
+ min-width: var(--nutui-badge-dot-large-width, 8px);
144
+ width: var(--nutui-badge-dot-large-width, 8px);
145
+ height: var(--nutui-badge-dot-large-width, 8px);
148
146
  }
149
147
  .nut-badge-outline {
150
148
  background: #ffffff;
@@ -159,7 +157,6 @@
159
157
  z-index: var(--nutui-fixednav-index, 900);
160
158
  display: inline-block;
161
159
  height: 50px;
162
- right: 0;
163
160
  }
164
161
  .nut-fixednav.active .nut-fixednav-btn .nut-icon {
165
162
  transform: rotate(180deg);
@@ -167,18 +164,16 @@
167
164
  .nut-fixednav.active .nut-fixednav-list {
168
165
  transform: translateX(0%) !important;
169
166
  }
170
- .nut-fixednav.active.left .nut-icon {
171
- transform: rotate(0deg) !important;
167
+ .nut-fixednav.active.nut-fixednav-left .nut-icon {
168
+ transform: rotate(0deg);
172
169
  }
173
170
  .nut-fixednav-btn {
174
171
  box-sizing: border-box;
175
172
  position: absolute;
176
- right: 0;
177
173
  z-index: var(--nutui-fixednav-index, 900);
178
174
  width: 70px;
179
175
  height: 100%;
180
176
  background: var(--nutui-fixednav-button-background, var(--nutui-color-primary, #ff0f23));
181
- border-radius: 45px 0px 0px 45px;
182
177
  box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.2);
183
178
  display: flex;
184
179
  align-items: center;
@@ -192,15 +187,10 @@
192
187
  flex-shrink: 0;
193
188
  }
194
189
  .nut-fixednav-btn .nut-icon {
195
- margin-right: 5px;
196
- transition: all 0.3s;
197
- transform: rotate(0deg);
198
190
  transition: all 0.3s;
199
191
  }
200
192
  .nut-fixednav-list {
201
193
  position: absolute;
202
- right: 0;
203
- transform: translateX(100%);
204
194
  transition: all 0.5s;
205
195
  z-index: var(--nutui-fixednav-index, 900);
206
196
  flex-shrink: 0;
@@ -208,10 +198,7 @@
208
198
  background: var(--nutui-fixednav-background-color, #ffffff);
209
199
  display: flex;
210
200
  justify-content: space-between;
211
- border-radius: 25px 0px 0px 25px;
212
201
  box-shadow: 2px 2px 8px 0px rgba(0, 0, 0, 0.2);
213
- padding-left: 20px;
214
- padding-right: 80px;
215
202
  }
216
203
  .nut-fixednav-list-item {
217
204
  position: relative;
@@ -225,45 +212,63 @@
225
212
  flex-shrink: 0;
226
213
  color: var(--nutui-fixednav-color, #1a1a1a);
227
214
  }
228
- .nut-fixednav-list-item img {
215
+ .nut-fixednav-list-item .nut-fixednav-list-text {
216
+ font-size: 10px;
217
+ }
218
+ .nut-fixednav-list-image {
229
219
  width: 20px;
230
220
  height: 20px;
231
221
  margin-bottom: 2px;
232
222
  }
233
- .nut-fixednav-list-item .nut-fixednav-list-text {
234
- font-size: 10px;
223
+ .nut-fixednav-right {
224
+ right: 0;
235
225
  }
236
- .nut-fixednav.left {
237
- right: auto;
226
+ .nut-fixednav-right .nut-fixednav-btn {
227
+ right: 0;
228
+ border-radius: 45px 0px 0px 45px;
229
+ }
230
+ .nut-fixednav-right .nut-fixednav-btn .nut-icon {
231
+ margin-right: 5px;
232
+ transform: rotate(0deg);
233
+ }
234
+ .nut-fixednav-right .nut-fixednav-list {
235
+ right: 0;
236
+ transform: translateX(100%);
237
+ border-radius: 25px 0px 0px 25px;
238
+ padding-left: 20px;
239
+ padding-right: 80px;
240
+ }
241
+ .nut-fixednav-left {
238
242
  left: 0;
239
243
  }
240
- .nut-fixednav.left .nut-fixednav-btn {
244
+ .nut-fixednav-left .nut-fixednav-btn {
241
245
  flex-direction: row-reverse;
242
- right: auto;
243
246
  left: 0;
244
247
  border-radius: 0 45px 45px 0;
245
248
  }
246
- .nut-fixednav.left .nut-fixednav-btn .nut-icon {
247
- transform: rotate(180deg);
248
- margin-right: 0px;
249
+ .nut-fixednav-left .nut-fixednav-btn .nut-icon {
249
250
  margin-left: 5px;
251
+ transform: rotate(180deg);
250
252
  }
251
- .nut-fixednav.left .nut-fixednav-list {
253
+ .nut-fixednav-left .nut-fixednav-list {
252
254
  transform: translateX(-100%);
253
- right: auto;
255
+ left: 0;
254
256
  border-radius: 0px 25px 25px 0px;
255
257
  padding-left: 80px;
256
258
  padding-right: 20px;
257
- margin: 0;
258
259
  }
259
260
 
260
- [dir=rtl] .nut-fixednav,
261
- .nut-rtl .nut-fixednav {
261
+ [dir=rtl] .nut-fixednav-right,
262
+ .nut-rtl .nut-fixednav-right {
262
263
  right: auto;
263
264
  left: 0;
264
265
  }
265
266
  [dir=rtl] .nut-fixednav.active .nut-icon,
266
267
  .nut-rtl .nut-fixednav.active .nut-icon {
268
+ transform: rotate(0deg);
269
+ }
270
+ [dir=rtl] .nut-fixednav.active.nut-fixednav-left .nut-icon,
271
+ .nut-rtl .nut-fixednav.active.nut-fixednav-left .nut-icon {
267
272
  transform: rotate(-180deg);
268
273
  }
269
274
  [dir=rtl] .nut-fixednav-btn,
@@ -293,25 +298,25 @@
293
298
  right: auto;
294
299
  left: 0;
295
300
  }
296
- [dir=rtl] .nut-fixednav.left,
297
- .nut-rtl .nut-fixednav.left {
301
+ [dir=rtl] .nut-fixednav-left,
302
+ .nut-rtl .nut-fixednav-left {
298
303
  left: auto;
299
304
  right: 0;
300
305
  }
301
- [dir=rtl] .nut-fixednav.left .nut-fixednav-btn,
302
- .nut-rtl .nut-fixednav.left .nut-fixednav-btn {
306
+ [dir=rtl] .nut-fixednav-left .nut-fixednav-btn,
307
+ .nut-rtl .nut-fixednav-left .nut-fixednav-btn {
303
308
  left: auto;
304
309
  right: 0;
305
310
  border-radius: 45px 0 0 45px;
306
311
  }
307
- [dir=rtl] .nut-fixednav.left .nut-fixednav-btn .nut-icon,
308
- .nut-rtl .nut-fixednav.left .nut-fixednav-btn .nut-icon {
312
+ [dir=rtl] .nut-fixednav-left .nut-fixednav-btn .nut-icon,
313
+ .nut-rtl .nut-fixednav-left .nut-fixednav-btn .nut-icon {
309
314
  transform: rotate(0deg);
310
315
  margin-right: 5px;
311
316
  margin-left: 0px;
312
317
  }
313
- [dir=rtl] .nut-fixednav.left .nut-fixednav-list,
314
- .nut-rtl .nut-fixednav.left .nut-fixednav-list {
318
+ [dir=rtl] .nut-fixednav-left .nut-fixednav-list,
319
+ .nut-rtl .nut-fixednav-left .nut-fixednav-list {
315
320
  transform: translateX(100%);
316
321
  right: auto;
317
322
  left: auto;
@@ -7,7 +7,6 @@
7
7
  z-index: 900;
8
8
  display: inline-block;
9
9
  height: 50px;
10
- right: 0;
11
10
  }
12
11
  .nut-fixednav.active .nut-fixednav-btn .nut-icon {
13
12
  transform: rotate(180deg);
@@ -15,18 +14,16 @@
15
14
  .nut-fixednav.active .nut-fixednav-list {
16
15
  transform: translateX(0%) !important;
17
16
  }
18
- .nut-fixednav.active.left .nut-icon {
19
- transform: rotate(0deg) !important;
17
+ .nut-fixednav.active.nut-fixednav-left .nut-icon {
18
+ transform: rotate(0deg);
20
19
  }
21
20
  .nut-fixednav-btn {
22
21
  box-sizing: border-box;
23
22
  position: absolute;
24
- right: 0;
25
23
  z-index: 900;
26
24
  width: 70px;
27
25
  height: 100%;
28
26
  background: #ff0f23;
29
- border-radius: 45px 0px 0px 45px;
30
27
  box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.2);
31
28
  display: flex;
32
29
  align-items: center;
@@ -40,15 +37,10 @@
40
37
  flex-shrink: 0;
41
38
  }
42
39
  .nut-fixednav-btn .nut-icon {
43
- margin-right: 5px;
44
- transition: all 0.3s;
45
- transform: rotate(0deg);
46
40
  transition: all 0.3s;
47
41
  }
48
42
  .nut-fixednav-list {
49
43
  position: absolute;
50
- right: 0;
51
- transform: translateX(100%);
52
44
  transition: all 0.5s;
53
45
  z-index: 900;
54
46
  flex-shrink: 0;
@@ -56,10 +48,7 @@
56
48
  background: #ffffff;
57
49
  display: flex;
58
50
  justify-content: space-between;
59
- border-radius: 25px 0px 0px 25px;
60
51
  box-shadow: 2px 2px 8px 0px rgba(0, 0, 0, 0.2);
61
- padding-left: 20px;
62
- padding-right: 80px;
63
52
  }
64
53
  .nut-fixednav-list-item {
65
54
  position: relative;
@@ -73,45 +62,63 @@
73
62
  flex-shrink: 0;
74
63
  color: #1a1a1a;
75
64
  }
76
- .nut-fixednav-list-item img {
65
+ .nut-fixednav-list-item .nut-fixednav-list-text {
66
+ font-size: 10px;
67
+ }
68
+ .nut-fixednav-list-image {
77
69
  width: 20px;
78
70
  height: 20px;
79
71
  margin-bottom: 2px;
80
72
  }
81
- .nut-fixednav-list-item .nut-fixednav-list-text {
82
- font-size: 10px;
73
+ .nut-fixednav-right {
74
+ right: 0;
83
75
  }
84
- .nut-fixednav.left {
85
- right: auto;
76
+ .nut-fixednav-right .nut-fixednav-btn {
77
+ right: 0;
78
+ border-radius: 45px 0px 0px 45px;
79
+ }
80
+ .nut-fixednav-right .nut-fixednav-btn .nut-icon {
81
+ margin-right: 5px;
82
+ transform: rotate(0deg);
83
+ }
84
+ .nut-fixednav-right .nut-fixednav-list {
85
+ right: 0;
86
+ transform: translateX(100%);
87
+ border-radius: 25px 0px 0px 25px;
88
+ padding-left: 20px;
89
+ padding-right: 80px;
90
+ }
91
+ .nut-fixednav-left {
86
92
  left: 0;
87
93
  }
88
- .nut-fixednav.left .nut-fixednav-btn {
94
+ .nut-fixednav-left .nut-fixednav-btn {
89
95
  flex-direction: row-reverse;
90
- right: auto;
91
96
  left: 0;
92
97
  border-radius: 0 45px 45px 0;
93
98
  }
94
- .nut-fixednav.left .nut-fixednav-btn .nut-icon {
95
- transform: rotate(180deg);
96
- margin-right: 0px;
99
+ .nut-fixednav-left .nut-fixednav-btn .nut-icon {
97
100
  margin-left: 5px;
101
+ transform: rotate(180deg);
98
102
  }
99
- .nut-fixednav.left .nut-fixednav-list {
103
+ .nut-fixednav-left .nut-fixednav-list {
100
104
  transform: translateX(-100%);
101
- right: auto;
105
+ left: 0;
102
106
  border-radius: 0px 25px 25px 0px;
103
107
  padding-left: 80px;
104
108
  padding-right: 20px;
105
- margin: 0;
106
109
  }
107
110
 
108
- [dir=rtl] .nut-fixednav,
109
- .nut-rtl .nut-fixednav {
111
+ [dir=rtl] .nut-fixednav-right,
112
+ .nut-rtl .nut-fixednav-right {
110
113
  right: auto;
111
114
  left: 0;
112
115
  }
113
116
  [dir=rtl] .nut-fixednav.active .nut-icon,
114
117
  .nut-rtl .nut-fixednav.active .nut-icon {
118
+ transform: rotate(0deg);
119
+ }
120
+ [dir=rtl] .nut-fixednav.active.nut-fixednav-left .nut-icon,
121
+ .nut-rtl .nut-fixednav.active.nut-fixednav-left .nut-icon {
115
122
  transform: rotate(-180deg);
116
123
  }
117
124
  [dir=rtl] .nut-fixednav-btn,
@@ -141,25 +148,25 @@
141
148
  right: auto;
142
149
  left: 0;
143
150
  }
144
- [dir=rtl] .nut-fixednav.left,
145
- .nut-rtl .nut-fixednav.left {
151
+ [dir=rtl] .nut-fixednav-left,
152
+ .nut-rtl .nut-fixednav-left {
146
153
  left: auto;
147
154
  right: 0;
148
155
  }
149
- [dir=rtl] .nut-fixednav.left .nut-fixednav-btn,
150
- .nut-rtl .nut-fixednav.left .nut-fixednav-btn {
156
+ [dir=rtl] .nut-fixednav-left .nut-fixednav-btn,
157
+ .nut-rtl .nut-fixednav-left .nut-fixednav-btn {
151
158
  left: auto;
152
159
  right: 0;
153
160
  border-radius: 45px 0 0 45px;
154
161
  }
155
- [dir=rtl] .nut-fixednav.left .nut-fixednav-btn .nut-icon,
156
- .nut-rtl .nut-fixednav.left .nut-fixednav-btn .nut-icon {
162
+ [dir=rtl] .nut-fixednav-left .nut-fixednav-btn .nut-icon,
163
+ .nut-rtl .nut-fixednav-left .nut-fixednav-btn .nut-icon {
157
164
  transform: rotate(0deg);
158
165
  margin-right: 5px;
159
166
  margin-left: 0px;
160
167
  }
161
- [dir=rtl] .nut-fixednav.left .nut-fixednav-list,
162
- .nut-rtl .nut-fixednav.left .nut-fixednav-list {
168
+ [dir=rtl] .nut-fixednav-left .nut-fixednav-list,
169
+ .nut-rtl .nut-fixednav-left .nut-fixednav-list {
163
170
  transform: translateX(100%);
164
171
  right: auto;
165
172
  left: auto;
@@ -13,6 +13,7 @@ var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcar
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 _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
16
+ var _to_consumable_array = require("@swc/helpers/_/_to_consumable_array");
16
17
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
17
18
  var _taro = /*#__PURE__*/ _interop_require_default._(require("@tarojs/taro"));
18
19
  var _components = require("@tarojs/components");
@@ -37,7 +38,7 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
37
38
  closeIcon: false,
38
39
  closeIconPosition: 'top-right',
39
40
  showMenuByLongpress: false,
40
- onChange: function onChange(value) {},
41
+ onChange: function onChange() {},
41
42
  onClose: function onClose() {}
42
43
  });
43
44
  var ImagePreview = function ImagePreview(props) {
@@ -48,81 +49,59 @@ var ImagePreview = function ImagePreview(props) {
48
49
  value: value,
49
50
  defaultValue: defaultValue,
50
51
  finalValue: defaultValue,
51
- onChange: function onChange1(val) {
52
- onChange === null || onChange === void 0 ? void 0 : onChange(val);
53
- }
52
+ onChange: onChange
54
53
  }), 2), innerNo = _usePropsValue[0], setInnerNo = _usePropsValue[1];
55
54
  var _useState = (0, _sliced_to_array._)((0, _react.useState)(visible), 2), showPop = _useState[0], setShowPop = _useState[1];
56
55
  var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), active = _useState1[0], setActive = _useState1[1];
57
- var _useState2 = (0, _sliced_to_array._)((0, _react.useState)((images === null || images === void 0 ? void 0 : images.length) || 0 + ((videos === null || videos === void 0 ? void 0 : videos.length) || 0)), 2), maxNo = _useState2[0], setMaxNo = _useState2[1];
56
+ var _useState2 = (0, _sliced_to_array._)((0, _react.useState)(images.length + videos.length), 2), maxNo = _useState2[0], setMaxNo = _useState2[1];
58
57
  var _useState3 = (0, _sliced_to_array._)((0, _react.useState)({
59
58
  scale: 1,
60
- moveable: false
59
+ moveable: false,
60
+ oriDistance: 0,
61
+ originScale: 1
61
62
  }), 2), store = _useState3[0], setStore = _useState3[1];
62
- var _useState4 // 用来辅助监听双击
63
- = (0, _sliced_to_array._)((0, _react.useState)(0), 2), lastTouchEndTime = _useState4[0], setLastTouchEndTime = _useState4[1];
63
+ var lastTouchEndTime = (0, _react.useRef)(0) // 用来辅助监听双击
64
+ ;
64
65
  var onTouchStart = function onTouchStart(event) {
65
66
  var touches = event.touches;
66
67
  var events = touches[0];
67
68
  var events2 = touches[1];
68
69
  // 如果已经放大,双击应变回原尺寸;如果是原尺寸,双击应放大
69
- var curTouchTime = new Date().getTime();
70
- if (curTouchTime - lastTouchEndTime < 300) {
70
+ var curTouchTime = Date.now();
71
+ if (curTouchTime - lastTouchEndTime.current < 100) {
71
72
  var store1 = store;
72
- if (store1.scale > 1) {
73
- store1.scale = 1;
74
- } else if (store1.scale === 1) {
75
- store1.scale = 2;
76
- }
73
+ store1.scale = store1.scale === 1 ? 2 : 1;
77
74
  scaleNow();
78
75
  }
79
76
  var store11 = store;
80
77
  store11.moveable = true;
81
78
  if (events2) {
82
79
  // 如果开始两指操作,记录初始时刻两指间的距离
83
- store11.oriDistance = getDistance({
84
- x: events.pageX,
85
- y: events.pageY
86
- }, {
87
- x: events2.pageX,
88
- y: events2.pageY
89
- });
80
+ store11.oriDistance = getDistance(events, events2);
90
81
  }
91
82
  // 取到开始两指操作时的放大(缩小比例),store.scale 存储的是当前的放缩比(相对于标准大小 scale 为 1 的情况的放大缩小比)
92
- store11.originScale = store11.scale || 1;
83
+ store11.originScale = store11.scale;
93
84
  };
94
85
  var onTouchMove = function onTouchMove(event) {
86
+ if (!store.moveable) return;
95
87
  var touches = event.touches;
96
88
  var events = touches[0];
97
89
  var events2 = touches[1];
98
- if (!store.moveable) {
99
- return;
100
- }
101
90
  var store1 = store;
102
91
  // 双指移动
103
92
  if (events2) {
104
- // 获得当前两点间的距离
105
- var curDistance = getDistance({
106
- x: events.pageX,
107
- y: events.pageY
108
- }, {
109
- x: events2.pageX,
110
- y: events2.pageY
111
- });
93
+ var curDistance = getDistance(events, events2);
112
94
  /** 此处计算倍数,距离放大(缩小) k 倍则 scale 也 扩大(缩小) k 倍。距离放大(缩小)倍数 = 结束时两点距离 除以 开始时两点距离
113
95
  * 注意此处的 scale 变化是基于 store.scale 的。
114
96
  * store.scale 是一个暂存值,比如第一次放大 2 倍,则 store.scale 为 2。
115
97
  * 再次两指触碰的时候,store.originScale 就为 store.scale 的值,基于此时的 store.scale 继续放大缩小。 * */ var curScale = curDistance / store1.oriDistance;
116
- store1.scale = store1.originScale * curScale;
117
98
  // 最大放大 3 倍,缩小后松手要弹回原比例
118
- if (store1.scale > 3) {
119
- store1.scale = 3;
120
- }
99
+ store1.scale = Math.min(store1.originScale * curScale, 3);
121
100
  scaleNow();
122
101
  }
123
102
  };
124
103
  var onTouchEnd = function onTouchEnd() {
125
- setLastTouchEndTime(new Date().getTime());
104
+ lastTouchEndTime.current = Date.now();
126
105
  var store1 = store;
127
106
  store1.moveable = false;
128
107
  if (store1.scale < 1.1 && store1.scale > 1 || store1.scale < 1) {
@@ -137,6 +116,11 @@ var ImagePreview = function ImagePreview(props) {
137
116
  document.addEventListener('touchmove', onTouchMove);
138
117
  document.addEventListener('touchend', onTouchEnd);
139
118
  document.addEventListener('touchcancel', onTouchEnd);
119
+ return function() {
120
+ document.removeEventListener('touchcancel', onTouchEnd);
121
+ document.removeEventListener('touchmove', onTouchMove);
122
+ document.removeEventListener('touchend', onTouchEnd);
123
+ };
140
124
  };
141
125
  (0, _react.useEffect)(function() {
142
126
  setShowPop(visible);
@@ -154,22 +138,18 @@ var ImagePreview = function ImagePreview(props) {
154
138
  innerNo
155
139
  ]);
156
140
  (0, _react.useEffect)(function() {
157
- setMaxNo((images === null || images === void 0 ? void 0 : images.length) || 0 + ((videos === null || videos === void 0 ? void 0 : videos.length) || 0));
141
+ setMaxNo(images.length + videos.length);
158
142
  }, [
159
143
  images,
160
144
  videos
161
145
  ]);
162
146
  var scaleNow = function scaleNow() {
163
147
  if (ref.current) {
164
- ;
165
148
  ref.current.style.transform = "scale(".concat(store.scale, ")");
166
149
  }
167
150
  };
168
- // 计算两个点的距离
169
151
  var getDistance = function getDistance(first, second) {
170
- // 计算两个点起始时刻的距离和终止时刻的距离,终止时刻距离变大了则放大,变小了则缩小
171
- // 放大 k 倍则 scale 也 扩大 k 倍
172
- return Math.hypot(Math.abs(second.x - first.x), Math.abs(second.y - first.y));
152
+ return Math.hypot(Math.abs(second.pageX - first.pageX), Math.abs(second.pageY - first.pageY));
173
153
  };
174
154
  var slideChangeEnd = function slideChangeEnd(page) {
175
155
  setActive(page + 1);
@@ -180,30 +160,28 @@ var ImagePreview = function ImagePreview(props) {
180
160
  setShowPop(false);
181
161
  setActive(innerNo);
182
162
  scaleNow();
183
- onClose && onClose();
163
+ onClose === null || onClose === void 0 ? void 0 : onClose();
184
164
  setStore((0, _object_spread_props._)((0, _object_spread._)({}, store), {
185
165
  scale: 1
186
166
  }));
187
167
  };
188
168
  var closeOnImg = function closeOnImg(e) {
189
- // 点击内容区域的图片是否可以关闭弹层(视频区域由于nut-video做了限制,无法关闭弹层)
190
169
  e.stopPropagation();
191
- if (closeOnContentClick) {
192
- onCloseInner(e);
193
- }
170
+ // 点击内容区域的图片是否可以关闭弹层(视频区域由于nut-video做了限制,无法关闭弹层)
171
+ if (closeOnContentClick) onCloseInner(e);
194
172
  };
195
173
  return /*#__PURE__*/ _react.default.createElement(_index.default, {
196
174
  visible: showPop,
197
175
  className: "".concat(classPrefix, "-pop"),
198
- style: {
199
- width: '100%'
200
- },
201
176
  onClick: onCloseInner
202
177
  }, /*#__PURE__*/ _react.default.createElement(_components.View, {
203
178
  className: (0, _classnames.default)(classPrefix, className),
204
179
  style: style,
205
180
  ref: ref,
206
- onTouchStart: onTouchStart
181
+ onTouchStart: onTouchStart,
182
+ onTouchMove: onTouchMove,
183
+ onTouchEnd: onTouchEnd,
184
+ onTouchCancel: onTouchEnd
207
185
  }, /*#__PURE__*/ _react.default.createElement(_index2.default, {
208
186
  autoPlay: autoPlay,
209
187
  className: "".concat(classPrefix, "-swiper"),
@@ -221,57 +199,46 @@ var ImagePreview = function ImagePreview(props) {
221
199
  },
222
200
  defaultValue: innerNo && (innerNo > maxNo ? maxNo - 1 : innerNo - 1),
223
201
  indicator: indicator
224
- }, (videos !== null && videos !== void 0 ? videos : []).map(function(item) {
202
+ }, (0, _to_consumable_array._)(videos.map(function(item) {
225
203
  return {
226
204
  type: 'video',
227
205
  data: item
228
206
  };
229
- }).concat((images !== null && images !== void 0 ? images : []).map(function(item) {
207
+ })).concat((0, _to_consumable_array._)(images.map(function(item) {
230
208
  return {
231
209
  type: 'image',
232
210
  data: item
233
211
  };
234
- })).sort(function(a, b) {
212
+ }))).sort(function(a, b) {
235
213
  var _a_data, _b_data;
236
214
  var _a_data_index, _b_data_index;
237
215
  return ((_a_data_index = (_a_data = a.data) === null || _a_data === void 0 ? void 0 : _a_data.index) !== null && _a_data_index !== void 0 ? _a_data_index : 0) - ((_b_data_index = (_b_data = b.data) === null || _b_data === void 0 ? void 0 : _b_data.index) !== null && _b_data_index !== void 0 ? _b_data_index : 0);
238
216
  }).map(function(item, index) {
239
- if (item.type === 'video') {
240
- var _item_data = item.data, source = _item_data.source, options = _item_data.options;
241
- return /*#__PURE__*/ _react.default.createElement(_index3.default, {
242
- key: index,
243
- className: "nut-imagepreview-swiper-item"
244
- }, /*#__PURE__*/ _react.default.createElement(_components.Video, {
245
- src: source.src,
246
- onClick: closeOnImg,
247
- controls: options.controls,
248
- autoplay: false,
249
- loop: false,
250
- muted: options.muted
251
- }));
252
- }
253
- if (item.type === 'image') {
254
- var src = item.data.src;
255
- return /*#__PURE__*/ _react.default.createElement(_index3.default, {
256
- key: index,
257
- className: "nut-imagepreview-swiper-item"
258
- }, /*#__PURE__*/ _react.default.createElement(_index1.default, (0, _object_spread._)({
259
- src: src,
260
- mode: "widthFix",
261
- onClick: closeOnImg,
262
- style: {
263
- width: '100%'
264
- }
265
- }, _taro.default.getEnv() !== 'WEB' && {
266
- showMenuByLongpress: showMenuByLongpress
267
- })));
268
- }
269
- return null;
270
- }))), pagination ? /*#__PURE__*/ _react.default.createElement(_components.View, {
217
+ return /*#__PURE__*/ _react.default.createElement(_index3.default, {
218
+ key: index,
219
+ className: "nut-imagepreview-swiper-item"
220
+ }, item.type === 'video' ? /*#__PURE__*/ _react.default.createElement(_components.Video, {
221
+ src: item.data.source.src,
222
+ onClick: closeOnImg,
223
+ controls: item.data.options.controls,
224
+ autoplay: false,
225
+ loop: false,
226
+ muted: item.data.options.muted
227
+ }) : /*#__PURE__*/ _react.default.createElement(_index1.default, (0, _object_spread._)({
228
+ src: item.data.src,
229
+ mode: "widthFix",
230
+ onClick: closeOnImg,
231
+ style: {
232
+ width: '100%'
233
+ }
234
+ }, _taro.default.getEnv() !== 'WEB' && {
235
+ showMenuByLongpress: showMenuByLongpress
236
+ })));
237
+ }))), pagination && /*#__PURE__*/ _react.default.createElement(_components.View, {
271
238
  className: "".concat(classPrefix, "-index")
272
- }, active, "/", (images ? images.length : 0) + (videos ? videos.length : 0)) : null, closeIcon !== false ? /*#__PURE__*/ _react.default.createElement(_components.View, {
239
+ }, active, "/", maxNo), closeIcon !== false && /*#__PURE__*/ _react.default.createElement(_components.View, {
273
240
  className: "".concat(classPrefix, "-close ").concat(closeIconPosition),
274
241
  onClick: onCloseInner
275
- }, closeIcon === true ? /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Close, null) : closeIcon) : null);
242
+ }, closeIcon === true ? /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Close, null) : closeIcon));
276
243
  };
277
244
  ImagePreview.displayName = 'NutImagePreview';
@@ -57,11 +57,12 @@
57
57
  }
58
58
 
59
59
  &-pop {
60
+ width: 100%;
60
61
  height: 100%;
62
+ max-width: 100% !important;
61
63
  background: transparent !important;
62
64
  display: flex;
63
65
  align-items: center;
64
- width: 100%;
65
66
  }
66
67
 
67
68
  &-swiper {