@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.
Files changed (126) 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/configprovider/types.d.ts +1 -1
  6. package/dist/cjs/packages/datepicker/style/style.css +3 -1
  7. package/dist/cjs/packages/datepickerview/style/style.css +3 -1
  8. package/dist/cjs/packages/empty/style/index.js +1 -0
  9. package/dist/cjs/packages/empty/style/style.css +389 -0
  10. package/dist/cjs/packages/fixednav/fixednav.js +3 -2
  11. package/dist/cjs/packages/fixednav/style/fixednav.scss +43 -39
  12. package/dist/cjs/packages/fixednav/style/style.css +56 -51
  13. package/dist/cjs/packages/imagepreview/imagepreview.js +49 -84
  14. package/dist/cjs/packages/imagepreview/style/imagepreview.scss +2 -1
  15. package/dist/cjs/packages/imagepreview/style/style.css +2 -1
  16. package/dist/cjs/packages/indicator/indicator.js +1 -1
  17. package/dist/cjs/packages/inputnumber/inputnumber.js +2 -2
  18. package/dist/cjs/packages/lottie/index.d.ts +1 -1
  19. package/dist/cjs/packages/lottie/index.js +2 -2
  20. package/dist/cjs/packages/notify/Notification.d.ts +3 -9
  21. package/dist/cjs/packages/notify/Notification.js +28 -8
  22. package/dist/cjs/packages/notify/notify.d.ts +0 -4
  23. package/dist/cjs/packages/notify/notify.js +6 -34
  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/nutui.react.d.ts +1 -0
  27. package/dist/cjs/packages/nutui.react.js +1 -0
  28. package/dist/cjs/packages/picker/style/style.css +3 -1
  29. package/dist/cjs/packages/pickerview/pickerroller.js +11 -6
  30. package/dist/cjs/packages/pickerview/style/pickerview.scss +3 -1
  31. package/dist/cjs/packages/pickerview/style/style.css +3 -1
  32. package/dist/cjs/packages/resultpage/style/index.js +1 -0
  33. package/dist/cjs/packages/resultpage/style/style.css +389 -0
  34. package/dist/cjs/packages/skeleton/skeleton.js +64 -49
  35. package/dist/cjs/packages/skeleton/style/index.js +0 -1
  36. package/dist/cjs/packages/skeleton/style/skeleton.scss +40 -46
  37. package/dist/cjs/packages/skeleton/style/style.css +32 -175
  38. package/dist/cjs/packages/switch/style/style.css +5 -0
  39. package/dist/cjs/packages/switch/style/switch.scss +5 -0
  40. package/dist/cjs/packages/switch/switch.js +22 -11
  41. package/dist/cjs/packages/tabbar/style/style.css +58 -54
  42. package/dist/cjs/packages/tabbar/style/tabbar.scss +28 -19
  43. package/dist/cjs/packages/tabbar/tabbar.js +28 -10
  44. package/dist/cjs/packages/tabbaritem/style/style.css +34 -36
  45. package/dist/cjs/packages/tabbaritem/style/tabbaritem.scss +32 -29
  46. package/dist/cjs/packages/tabbaritem/tabbaritem.js +34 -13
  47. package/dist/cjs/packages/toast/Notification.js +1 -1
  48. package/dist/cjs/types/spec/badge/base.d.ts +1 -0
  49. package/dist/cjs/types/spec/indicator/base.d.ts +1 -1
  50. package/dist/cjs/types/spec/notify/base.d.ts +7 -2
  51. package/dist/cjs/types/spec/searchbar/taro.d.ts +10 -7
  52. package/dist/cjs/types/spec/skeleton/base.d.ts +7 -5
  53. package/dist/cjs/types/spec/switch/base.d.ts +3 -2
  54. package/dist/cjs/types/spec/switch/h5.d.ts +1 -1
  55. package/dist/cjs/types/spec/switch/taro.d.ts +1 -4
  56. package/dist/cjs/types/spec/tabbar/base.d.ts +7 -4
  57. package/dist/es/packages/badge/badge.js +4 -3
  58. package/dist/es/packages/badge/style/badge.scss +7 -8
  59. package/dist/es/packages/badge/style/style.css +13 -15
  60. package/dist/es/packages/configprovider/types.d.ts +1 -1
  61. package/dist/es/packages/datepicker/style/style.css +3 -1
  62. package/dist/es/packages/datepickerview/style/style.css +3 -1
  63. package/dist/es/packages/empty/style/index.js +1 -0
  64. package/dist/es/packages/empty/style/style.css +389 -0
  65. package/dist/es/packages/fixednav/fixednav.js +3 -2
  66. package/dist/es/packages/fixednav/style/fixednav.scss +43 -39
  67. package/dist/es/packages/fixednav/style/style.css +56 -51
  68. package/dist/es/packages/imagepreview/imagepreview.js +49 -84
  69. package/dist/es/packages/imagepreview/style/imagepreview.scss +2 -1
  70. package/dist/es/packages/imagepreview/style/style.css +2 -1
  71. package/dist/es/packages/indicator/indicator.js +1 -1
  72. package/dist/es/packages/inputnumber/inputnumber.js +2 -2
  73. package/dist/es/packages/lottie/index.d.ts +1 -1
  74. package/dist/es/packages/lottie/index.js +1 -1
  75. package/dist/es/packages/notify/Notification.d.ts +3 -9
  76. package/dist/es/packages/notify/Notification.js +28 -8
  77. package/dist/es/packages/notify/notify.d.ts +0 -4
  78. package/dist/es/packages/notify/notify.js +6 -34
  79. package/dist/es/packages/notify/style/notify.scss +39 -36
  80. package/dist/es/packages/notify/style/style.css +36 -31
  81. package/dist/es/packages/picker/style/style.css +3 -1
  82. package/dist/es/packages/pickerview/pickerroller.js +10 -6
  83. package/dist/es/packages/pickerview/style/pickerview.scss +3 -1
  84. package/dist/es/packages/pickerview/style/style.css +3 -1
  85. package/dist/es/packages/resultpage/style/index.js +1 -0
  86. package/dist/es/packages/resultpage/style/style.css +389 -0
  87. package/dist/es/packages/skeleton/skeleton.js +63 -49
  88. package/dist/es/packages/skeleton/style/index.js +0 -1
  89. package/dist/es/packages/skeleton/style/skeleton.scss +40 -46
  90. package/dist/es/packages/skeleton/style/style.css +32 -175
  91. package/dist/es/packages/switch/style/style.css +5 -0
  92. package/dist/es/packages/switch/style/switch.scss +5 -0
  93. package/dist/es/packages/switch/switch.js +21 -11
  94. package/dist/es/packages/tabbar/style/style.css +58 -54
  95. package/dist/es/packages/tabbar/style/tabbar.scss +28 -19
  96. package/dist/es/packages/tabbar/tabbar.js +27 -10
  97. package/dist/es/packages/tabbaritem/style/style.css +34 -36
  98. package/dist/es/packages/tabbaritem/style/tabbaritem.scss +32 -29
  99. package/dist/es/packages/tabbaritem/tabbaritem.js +34 -13
  100. package/dist/es/packages/toast/Notification.js +1 -1
  101. package/dist/es/types/spec/badge/base.d.ts +4 -0
  102. package/dist/es/types/spec/indicator/base.d.ts +1 -1
  103. package/dist/es/types/spec/notify/base.d.ts +22 -5
  104. package/dist/es/types/spec/searchbar/taro.d.ts +10 -7
  105. package/dist/es/types/spec/skeleton/base.d.ts +19 -14
  106. package/dist/es/types/spec/switch/base.d.ts +6 -2
  107. package/dist/es/types/spec/switch/h5.d.ts +1 -1
  108. package/dist/es/types/spec/switch/taro.d.ts +1 -4
  109. package/dist/es/types/spec/tabbar/base.d.ts +7 -4
  110. package/dist/nutui.react.umd.js +394 -373
  111. package/dist/style.css +1 -1
  112. package/dist/style.scss +49 -49
  113. package/dist/styles/theme-dark.scss +2 -0
  114. package/dist/styles/theme-default.scss +2 -0
  115. package/dist/styles/themes/dark.css +1 -1
  116. package/dist/styles/themes/default.css +1 -1
  117. package/dist/styles/themes/jmapp.css +1 -1
  118. package/dist/styles/themes/jrkf.css +1 -1
  119. package/dist/styles/variables-jmapp.scss +24 -1
  120. package/dist/styles/variables-jrkf.scss +24 -1
  121. package/dist/styles/variables.scss +37 -38
  122. package/package.json +1 -1
  123. /package/dist/cjs/packages/lottie/{web.d.ts → lottie.d.ts} +0 -0
  124. /package/dist/cjs/packages/lottie/{web.js → lottie.js} +0 -0
  125. /package/dist/es/packages/lottie/{web.d.ts → lottie.d.ts} +0 -0
  126. /package/dist/es/packages/lottie/{web.js → lottie.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;
@@ -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 _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
18
19
  var _iconsreact = require("@nutui/icons-react");
@@ -35,7 +36,7 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
35
36
  indicatorColor: '#fff',
36
37
  closeIcon: false,
37
38
  closeIconPosition: 'top-right',
38
- onChange: function onChange(value) {},
39
+ onChange: function onChange() {},
39
40
  onClose: function onClose() {}
40
41
  });
41
42
  var ImagePreview = function ImagePreview(props) {
@@ -46,81 +47,59 @@ var ImagePreview = function ImagePreview(props) {
46
47
  value: value,
47
48
  defaultValue: defaultValue,
48
49
  finalValue: defaultValue,
49
- onChange: function onChange1(val) {
50
- onChange === null || onChange === void 0 ? void 0 : onChange(val);
51
- }
50
+ onChange: onChange
52
51
  }), 2), innerNo = _usePropsValue[0], setInnerNo = _usePropsValue[1];
53
52
  var _useState = (0, _sliced_to_array._)((0, _react.useState)(visible), 2), showPop = _useState[0], setShowPop = _useState[1];
54
53
  var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), active = _useState1[0], setActive = _useState1[1];
55
- 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];
54
+ var _useState2 = (0, _sliced_to_array._)((0, _react.useState)(images.length + videos.length), 2), maxNo = _useState2[0], setMaxNo = _useState2[1];
56
55
  var _useState3 = (0, _sliced_to_array._)((0, _react.useState)({
57
56
  scale: 1,
58
- moveable: false
57
+ moveable: false,
58
+ oriDistance: 0,
59
+ originScale: 1
59
60
  }), 2), store = _useState3[0], setStore = _useState3[1];
60
- var _useState4 // 用来辅助监听双击
61
- = (0, _sliced_to_array._)((0, _react.useState)(0), 2), lastTouchEndTime = _useState4[0], setLastTouchEndTime = _useState4[1];
61
+ var lastTouchEndTime = (0, _react.useRef)(0) // 用来辅助监听双击
62
+ ;
62
63
  var onTouchStart = function onTouchStart(event) {
63
64
  var touches = event.touches;
64
65
  var events = touches[0];
65
66
  var events2 = touches[1];
66
- // 如果已经放大,双击应变回原尺寸;如果是原尺寸,双击应放大
67
- var curTouchTime = new Date().getTime();
68
- if (curTouchTime - lastTouchEndTime < 300) {
67
+ // 如果是原尺寸,双击放大;否则回到原尺寸。
68
+ var curTouchTime = Date.now();
69
+ if (curTouchTime - lastTouchEndTime.current < 100) {
69
70
  var store1 = store;
70
- if (store1.scale > 1) {
71
- store1.scale = 1;
72
- } else if (store1.scale === 1) {
73
- store1.scale = 2;
74
- }
71
+ store1.scale = store1.scale === 1 ? 2 : 1;
75
72
  scaleNow();
76
73
  }
77
74
  var store11 = store;
78
75
  store11.moveable = true;
79
76
  if (events2) {
80
77
  // 如果开始两指操作,记录初始时刻两指间的距离
81
- store11.oriDistance = getDistance({
82
- x: events.pageX,
83
- y: events.pageY
84
- }, {
85
- x: events2.pageX,
86
- y: events2.pageY
87
- });
78
+ store11.oriDistance = getDistance(events, events2);
88
79
  }
89
80
  // 取到开始两指操作时的放大(缩小比例),store.scale 存储的是当前的放缩比(相对于标准大小 scale 为 1 的情况的放大缩小比)
90
- store11.originScale = store11.scale || 1;
81
+ store11.originScale = store11.scale;
91
82
  };
92
83
  var onTouchMove = function onTouchMove(event) {
84
+ if (!store.moveable) return;
93
85
  var touches = event.touches;
94
86
  var events = touches[0];
95
87
  var events2 = touches[1];
96
- if (!store.moveable) {
97
- return;
98
- }
99
88
  var store1 = store;
100
89
  // 双指移动
101
90
  if (events2) {
102
- // 获得当前两点间的距离
103
- var curDistance = getDistance({
104
- x: events.pageX,
105
- y: events.pageY
106
- }, {
107
- x: events2.pageX,
108
- y: events2.pageY
109
- });
91
+ var curDistance = getDistance(events, events2);
110
92
  /** 此处计算倍数,距离放大(缩小) k 倍则 scale 也 扩大(缩小) k 倍。距离放大(缩小)倍数 = 结束时两点距离 除以 开始时两点距离
111
93
  * 注意此处的 scale 变化是基于 store.scale 的。
112
94
  * store.scale 是一个暂存值,比如第一次放大 2 倍,则 store.scale 为 2。
113
95
  * 再次两指触碰的时候,store.originScale 就为 store.scale 的值,基于此时的 store.scale 继续放大缩小。 * */ var curScale = curDistance / store1.oriDistance;
114
- store1.scale = store1.originScale * curScale;
115
96
  // 最大放大 3 倍,缩小后松手要弹回原比例
116
- if (store1.scale > 3) {
117
- store1.scale = 3;
118
- }
97
+ store1.scale = Math.min(store1.originScale * curScale, 3);
119
98
  scaleNow();
120
99
  }
121
100
  };
122
101
  var onTouchEnd = function onTouchEnd() {
123
- setLastTouchEndTime(new Date().getTime());
102
+ lastTouchEndTime.current = Date.now();
124
103
  var store1 = store;
125
104
  store1.moveable = false;
126
105
  if (store1.scale < 1.1 && store1.scale > 1 || store1.scale < 1) {
@@ -135,6 +114,11 @@ var ImagePreview = function ImagePreview(props) {
135
114
  document.addEventListener('touchmove', onTouchMove);
136
115
  document.addEventListener('touchend', onTouchEnd);
137
116
  document.addEventListener('touchcancel', onTouchEnd);
117
+ return function() {
118
+ document.removeEventListener('touchcancel', onTouchEnd);
119
+ document.removeEventListener('touchmove', onTouchMove);
120
+ document.removeEventListener('touchend', onTouchEnd);
121
+ };
138
122
  };
139
123
  (0, _react.useEffect)(function() {
140
124
  setShowPop(visible);
@@ -152,22 +136,19 @@ var ImagePreview = function ImagePreview(props) {
152
136
  innerNo
153
137
  ]);
154
138
  (0, _react.useEffect)(function() {
155
- setMaxNo((images === null || images === void 0 ? void 0 : images.length) || 0 + ((videos === null || videos === void 0 ? void 0 : videos.length) || 0));
139
+ setMaxNo(images.length + videos.length);
156
140
  }, [
157
141
  images,
158
142
  videos
159
143
  ]);
160
144
  var scaleNow = function scaleNow() {
161
145
  if (ref.current) {
162
- ;
163
146
  ref.current.style.transform = "scale(".concat(store.scale, ")");
164
147
  }
165
148
  };
166
- // 计算两个点的距离
149
+ // 用于查找给定数字的斜边。起止两点间距离。
167
150
  var getDistance = function getDistance(first, second) {
168
- // 计算两个点起始时刻的距离和终止时刻的距离,终止时刻距离变大了则放大,变小了则缩小
169
- // 放大 k 倍则 scale 也 扩大 k 倍
170
- return Math.hypot(Math.abs(second.x - first.x), Math.abs(second.y - first.y));
151
+ return Math.hypot(Math.abs(second.pageX - first.pageX), Math.abs(second.pageY - first.pageY));
171
152
  };
172
153
  var slideChangeEnd = function slideChangeEnd(page) {
173
154
  setActive(page + 1);
@@ -178,7 +159,7 @@ var ImagePreview = function ImagePreview(props) {
178
159
  setShowPop(false);
179
160
  setActive(innerNo);
180
161
  scaleNow();
181
- onClose && onClose();
162
+ onClose === null || onClose === void 0 ? void 0 : onClose();
182
163
  setStore((0, _object_spread_props._)((0, _object_spread._)({}, store), {
183
164
  scale: 1
184
165
  }));
@@ -186,24 +167,19 @@ var ImagePreview = function ImagePreview(props) {
186
167
  var closeOnImg = function closeOnImg(e) {
187
168
  e.stopPropagation();
188
169
  // 点击内容区域的图片是否可以关闭弹层(视频区域由于nut-video做了限制,无法关闭弹层)
189
- if (closeOnContentClick) {
190
- onCloseInner(e);
191
- }
170
+ if (closeOnContentClick) onCloseInner(e);
192
171
  };
193
172
  var duration = typeof autoPlay === 'string' ? parseInt(autoPlay) : autoPlay;
194
173
  return /*#__PURE__*/ _react.default.createElement(_popup.default, {
195
174
  visible: showPop,
196
175
  className: "".concat(classPrefix, "-pop"),
197
- style: {
198
- width: '100%'
199
- },
200
176
  onClick: onCloseInner
201
177
  }, /*#__PURE__*/ _react.default.createElement("div", {
202
178
  className: (0, _classnames.default)(classPrefix, className),
203
179
  style: style,
204
180
  ref: ref,
205
181
  onTouchStart: onTouchStart
206
- }, showPop ? /*#__PURE__*/ _react.default.createElement(_swiper.default, {
182
+ }, showPop && /*#__PURE__*/ _react.default.createElement(_swiper.default, {
207
183
  autoPlay: !!duration,
208
184
  duration: duration,
209
185
  className: "".concat(classPrefix, "-swiper"),
@@ -215,49 +191,38 @@ var ImagePreview = function ImagePreview(props) {
215
191
  onChange: function onChange(page) {
216
192
  return slideChangeEnd(page);
217
193
  },
218
- defaultValue: innerNo && (innerNo > maxNo ? maxNo - 1 : innerNo - 1),
194
+ defaultValue: innerNo > maxNo ? maxNo - 1 : innerNo - 1,
219
195
  indicator: indicator
220
- }, (videos !== null && videos !== void 0 ? videos : []).map(function(item) {
196
+ }, (0, _to_consumable_array._)(videos.map(function(item) {
221
197
  return {
222
198
  type: 'video',
223
199
  data: item
224
200
  };
225
- }).concat((images !== null && images !== void 0 ? images : []).map(function(item) {
201
+ })).concat((0, _to_consumable_array._)(images.map(function(item) {
226
202
  return {
227
203
  type: 'image',
228
204
  data: item
229
205
  };
230
- })).sort(function(a, b) {
231
- var _a_data, _b_data;
206
+ }))).sort(function(a, b) {
232
207
  var _a_data_index, _b_data_index;
233
- 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);
208
+ return ((_a_data_index = a.data.index) !== null && _a_data_index !== void 0 ? _a_data_index : 0) - ((_b_data_index = b.data.index) !== null && _b_data_index !== void 0 ? _b_data_index : 0);
234
209
  }).map(function(item, index) {
235
- if (item.type === 'video') {
236
- var _item_data = item.data, source = _item_data.source, options = _item_data.options;
237
- return /*#__PURE__*/ _react.default.createElement(_swiperitem.default, {
238
- key: index
239
- }, /*#__PURE__*/ _react.default.createElement(_video.default, {
240
- source: source,
241
- options: options,
242
- onClick: closeOnImg
243
- }));
244
- }
245
- if (item.type === 'image') {
246
- var src = item.data.src;
247
- return /*#__PURE__*/ _react.default.createElement(_swiperitem.default, {
248
- key: index
249
- }, /*#__PURE__*/ _react.default.createElement(_image.default, {
250
- src: src,
251
- draggable: false,
252
- onClick: closeOnImg
253
- }));
254
- }
255
- return null;
256
- })) : null), pagination ? /*#__PURE__*/ _react.default.createElement("div", {
210
+ return /*#__PURE__*/ _react.default.createElement(_swiperitem.default, {
211
+ key: index
212
+ }, item.type === 'video' ? /*#__PURE__*/ _react.default.createElement(_video.default, {
213
+ source: item.data.source,
214
+ options: item.data.options,
215
+ onClick: closeOnImg
216
+ }) : /*#__PURE__*/ _react.default.createElement(_image.default, {
217
+ src: item.data.src,
218
+ draggable: false,
219
+ onClick: closeOnImg
220
+ }));
221
+ }))), pagination && /*#__PURE__*/ _react.default.createElement("div", {
257
222
  className: "".concat(classPrefix, "-index")
258
- }, active, "/", (images ? images.length : 0) + (videos ? videos.length : 0)) : null, closeIcon !== false ? /*#__PURE__*/ _react.default.createElement("div", {
223
+ }, active, "/", maxNo), closeIcon !== false && /*#__PURE__*/ _react.default.createElement("div", {
259
224
  className: "".concat(classPrefix, "-close ").concat(closeIconPosition),
260
225
  onClick: onCloseInner
261
- }, closeIcon === true ? /*#__PURE__*/ _react.default.createElement(_iconsreact.Close, null) : closeIcon) : null);
226
+ }, closeIcon === true ? /*#__PURE__*/ _react.default.createElement(_iconsreact.Close, null) : closeIcon));
262
227
  };
263
228
  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 {
@@ -697,11 +697,12 @@
697
697
  text-align: center;
698
698
  }
699
699
  .nut-imagepreview-pop {
700
+ width: 100%;
700
701
  height: 100%;
702
+ max-width: 100% !important;
701
703
  background: transparent !important;
702
704
  display: flex;
703
705
  align-items: center;
704
- width: 100%;
705
706
  }
706
707
  .nut-imagepreview-swiper .nut-imagepreview-swiper-item,
707
708
  .nut-imagepreview-swiper .nut-swiper-item {
@@ -24,7 +24,7 @@ var defaultProps = {
24
24
  var classPrefix = "nut-indicator";
25
25
  var Indicator = function Indicator(props) {
26
26
  var maybeFixedWidth = function maybeFixedWidth() {
27
- if (total === 2 || type === 'slide') {
27
+ if (type === 'dualScreen' || type === 'slide') {
28
28
  return "".concat(classPrefix, "-fixed-width");
29
29
  }
30
30
  return '';
@@ -247,7 +247,7 @@ var InputNumber = function InputNumber(props) {
247
247
  className: "".concat(classPrefix, "-minus"),
248
248
  onClick: handleReduce
249
249
  }, /*#__PURE__*/ _react.default.createElement(_iconsreact.Minus, {
250
- className: (0, _classnames.default)("".concat(classPrefix, "-icon ").concat(classPrefix, "-icon-minus"), (0, _define_property._)({}, "".concat(classPrefix, "-icon-disabled"), shadowValue === min || disabled))
250
+ className: (0, _classnames.default)("".concat(classPrefix, "-icon ").concat(classPrefix, "-icon-minus"), (0, _define_property._)({}, "".concat(classPrefix, "-icon-disabled"), Number(shadowValue) <= Number(min) || disabled))
251
251
  })), /*#__PURE__*/ _react.default.createElement("input", {
252
252
  className: (0, _classnames.default)("".concat(classPrefix, "-input"), (0, _define_property._)({}, "".concat(classPrefix, "-input-disabled"), disabled)),
253
253
  ref: inputRef,
@@ -262,7 +262,7 @@ var InputNumber = function InputNumber(props) {
262
262
  className: "".concat(classPrefix, "-add"),
263
263
  onClick: handlePlus
264
264
  }, /*#__PURE__*/ _react.default.createElement(_iconsreact.Plus, {
265
- className: (0, _classnames.default)("".concat(classPrefix, "-icon ").concat(classPrefix, "-icon-plus"), (0, _define_property._)({}, "".concat(classPrefix, "-icon-disabled"), shadowValue === max || disabled))
265
+ className: (0, _classnames.default)("".concat(classPrefix, "-icon ").concat(classPrefix, "-icon-plus"), (0, _define_property._)({}, "".concat(classPrefix, "-icon-disabled"), Number(shadowValue) >= Number(max) || disabled))
266
266
  })));
267
267
  };
268
268
  InputNumber.displayName = 'NutInputNumber';
@@ -1,3 +1,3 @@
1
- import { Lottie } from './web';
1
+ import { Lottie } from './lottie';
2
2
  export type { WebLottieProps as LottieProps } from "../../types";
3
3
  export default Lottie;
@@ -8,5 +8,5 @@ Object.defineProperty(exports, "default", {
8
8
  return _default;
9
9
  }
10
10
  });
11
- var _web = require("./web");
12
- var _default = _web.Lottie;
11
+ var _lottie = require("./lottie");
12
+ var _default = _lottie.Lottie;
@@ -1,13 +1,7 @@
1
1
  import * as React from 'react';
2
- import { BasicComponent } from "../../utils/typings";
3
- export interface NotificationProps extends BasicComponent {
4
- id: string;
5
- message: string | React.ReactNode;
6
- duration: number;
7
- type: string;
8
- position: string;
9
- onClose: () => void;
10
- onClick: () => void;
2
+ import { WebNotifyProps } from "../../types";
3
+ export interface NotificationProps extends WebNotifyProps {
4
+ message: React.ReactNode;
11
5
  }
12
6
  interface State {
13
7
  show: boolean;
@@ -20,6 +20,7 @@ var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
20
20
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
21
21
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
22
22
  var _reacttransitiongroup = require("react-transition-group");
23
+ var _iconsreact = require("@nutui/icons-react");
23
24
  var _render = require("../../utils/render");
24
25
  var classPrefix = 'nut-notify';
25
26
  var _React_PureComponent;
@@ -45,6 +46,7 @@ var Notification = /*#__PURE__*/ function(_superClass) {
45
46
  {
46
47
  key: "close",
47
48
  value: function close() {
49
+ var _this_props;
48
50
  this.setState({
49
51
  show: false
50
52
  });
@@ -53,7 +55,7 @@ var Notification = /*#__PURE__*/ function(_superClass) {
53
55
  var element = document.getElementById(this.props.id);
54
56
  element && element.parentNode && element.parentNode.removeChild(element);
55
57
  }
56
- this.props.onClose();
58
+ (_this_props = this.props) === null || _this_props === void 0 ? void 0 : _this_props.onClose();
57
59
  }
58
60
  },
59
61
  {
@@ -98,22 +100,40 @@ var Notification = /*#__PURE__*/ function(_superClass) {
98
100
  {
99
101
  key: "render",
100
102
  value: function render() {
101
- var _this_props = this.props, style = _this_props.style, message = _this_props.message, type = _this_props.type, className = _this_props.className, position = _this_props.position;
103
+ var _this_props = this.props, id = _this_props.id, style = _this_props.style, message = _this_props.message, leftIcon = _this_props.leftIcon, rightIcon = _this_props.rightIcon, closeable = _this_props.closeable, className = _this_props.className, position = _this_props.position, distance = _this_props.distance, navHeight = _this_props.navHeight;
102
104
  var show = this.state.show;
105
+ var classes = (0, _classnames.default)(classPrefix, className);
106
+ var getDistance = function getDistance() {
107
+ if (position === 'top') {
108
+ return {
109
+ top: "".concat(distance + navHeight, "px")
110
+ };
111
+ }
112
+ return {
113
+ bottom: "".concat(distance, "px")
114
+ };
115
+ };
103
116
  var _obj;
104
- var classes = (0, _classnames.default)((_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-popup-top"), position === 'top'), (0, _define_property._)(_obj, "".concat(classPrefix, "-popup-bottom"), position === 'bottom'), (0, _define_property._)(_obj, "".concat(classPrefix), true), (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(type), true), _obj));
105
117
  return /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(_reacttransitiongroup.CSSTransition, {
106
118
  in: show,
107
119
  timeout: 300,
108
120
  classNames: "fade",
109
121
  unmountOnExit: true,
110
122
  appear: true,
111
- position: position
123
+ position: position,
124
+ id: id
112
125
  }, /*#__PURE__*/ _react.createElement("div", {
113
- className: "".concat(classes, " ").concat(className),
114
- style: style,
126
+ className: classes,
127
+ style: (0, _object_spread._)({}, style, getDistance()),
115
128
  onClick: this.clickCover
116
- }, message)));
129
+ }, leftIcon ? /*#__PURE__*/ _react.createElement("div", {
130
+ className: "".concat(classPrefix, "-left-icon")
131
+ }, leftIcon) : null, /*#__PURE__*/ _react.createElement("div", {
132
+ className: (0, _classnames.default)((_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-content"), true), (0, _define_property._)(_obj, "".concat(classPrefix, "-ellipsis"), closeable || rightIcon), (0, _define_property._)(_obj, "".concat(classPrefix, "-layout-left"), leftIcon || rightIcon), _obj))
133
+ }, message), rightIcon || closeable ? /*#__PURE__*/ _react.createElement("div", {
134
+ className: "".concat(classPrefix, "-right-icon"),
135
+ onClick: this.close
136
+ }, rightIcon || (closeable ? /*#__PURE__*/ _react.createElement(_iconsreact.Close, null) : null)) : null)));
117
137
  }
118
138
  }
119
139
  ]);
@@ -137,7 +157,7 @@ Notification.newInstance = function(properties, callback) {
137
157
  });
138
158
  };
139
159
  var element = document.createElement('div');
140
- var id = properties.id ? properties.id : "".concat(new Date().getTime());
160
+ var id = properties.id ? properties.id : "".concat(Date.now());
141
161
  element.id = id;
142
162
  properties.id = id;
143
163
  document.body.appendChild(element);