@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
@@ -1,6 +1,7 @@
1
1
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
2
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
3
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
4
+ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
4
5
  import React, { useEffect, useRef, useState } from "react";
5
6
  import Taro from "@tarojs/taro";
6
7
  import { Video as TaroVideo, View } from "@tarojs/components";
@@ -25,7 +26,7 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
25
26
  closeIcon: false,
26
27
  closeIconPosition: 'top-right',
27
28
  showMenuByLongpress: false,
28
- onChange: function(value) {},
29
+ onChange: function() {},
29
30
  onClose: function() {}
30
31
  });
31
32
  export var ImagePreview = function(props) {
@@ -36,81 +37,59 @@ export var ImagePreview = function(props) {
36
37
  value: value,
37
38
  defaultValue: defaultValue,
38
39
  finalValue: defaultValue,
39
- onChange: function(val) {
40
- onChange === null || onChange === void 0 ? void 0 : onChange(val);
41
- }
40
+ onChange: onChange
42
41
  }), 2), innerNo = _usePropsValue[0], setInnerNo = _usePropsValue[1];
43
42
  var _useState = _sliced_to_array(useState(visible), 2), showPop = _useState[0], setShowPop = _useState[1];
44
43
  var _useState1 = _sliced_to_array(useState(0), 2), active = _useState1[0], setActive = _useState1[1];
45
- var _useState2 = _sliced_to_array(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];
44
+ var _useState2 = _sliced_to_array(useState(images.length + videos.length), 2), maxNo = _useState2[0], setMaxNo = _useState2[1];
46
45
  var _useState3 = _sliced_to_array(useState({
47
46
  scale: 1,
48
- moveable: false
47
+ moveable: false,
48
+ oriDistance: 0,
49
+ originScale: 1
49
50
  }), 2), store = _useState3[0], setStore = _useState3[1];
50
- var _useState4 // 用来辅助监听双击
51
- = _sliced_to_array(useState(0), 2), lastTouchEndTime = _useState4[0], setLastTouchEndTime = _useState4[1];
51
+ var lastTouchEndTime = useRef(0) // 用来辅助监听双击
52
+ ;
52
53
  var onTouchStart = function(event) {
53
54
  var touches = event.touches;
54
55
  var events = touches[0];
55
56
  var events2 = touches[1];
56
57
  // 如果已经放大,双击应变回原尺寸;如果是原尺寸,双击应放大
57
- var curTouchTime = new Date().getTime();
58
- if (curTouchTime - lastTouchEndTime < 300) {
58
+ var curTouchTime = Date.now();
59
+ if (curTouchTime - lastTouchEndTime.current < 100) {
59
60
  var store1 = store;
60
- if (store1.scale > 1) {
61
- store1.scale = 1;
62
- } else if (store1.scale === 1) {
63
- store1.scale = 2;
64
- }
61
+ store1.scale = store1.scale === 1 ? 2 : 1;
65
62
  scaleNow();
66
63
  }
67
64
  var store11 = store;
68
65
  store11.moveable = true;
69
66
  if (events2) {
70
67
  // 如果开始两指操作,记录初始时刻两指间的距离
71
- store11.oriDistance = getDistance({
72
- x: events.pageX,
73
- y: events.pageY
74
- }, {
75
- x: events2.pageX,
76
- y: events2.pageY
77
- });
68
+ store11.oriDistance = getDistance(events, events2);
78
69
  }
79
70
  // 取到开始两指操作时的放大(缩小比例),store.scale 存储的是当前的放缩比(相对于标准大小 scale 为 1 的情况的放大缩小比)
80
- store11.originScale = store11.scale || 1;
71
+ store11.originScale = store11.scale;
81
72
  };
82
73
  var onTouchMove = function(event) {
74
+ if (!store.moveable) return;
83
75
  var touches = event.touches;
84
76
  var events = touches[0];
85
77
  var events2 = touches[1];
86
- if (!store.moveable) {
87
- return;
88
- }
89
78
  var store1 = store;
90
79
  // 双指移动
91
80
  if (events2) {
92
- // 获得当前两点间的距离
93
- var curDistance = getDistance({
94
- x: events.pageX,
95
- y: events.pageY
96
- }, {
97
- x: events2.pageX,
98
- y: events2.pageY
99
- });
81
+ var curDistance = getDistance(events, events2);
100
82
  /** 此处计算倍数,距离放大(缩小) k 倍则 scale 也 扩大(缩小) k 倍。距离放大(缩小)倍数 = 结束时两点距离 除以 开始时两点距离
101
83
  * 注意此处的 scale 变化是基于 store.scale 的。
102
84
  * store.scale 是一个暂存值,比如第一次放大 2 倍,则 store.scale 为 2。
103
85
  * 再次两指触碰的时候,store.originScale 就为 store.scale 的值,基于此时的 store.scale 继续放大缩小。 * */ var curScale = curDistance / store1.oriDistance;
104
- store1.scale = store1.originScale * curScale;
105
86
  // 最大放大 3 倍,缩小后松手要弹回原比例
106
- if (store1.scale > 3) {
107
- store1.scale = 3;
108
- }
87
+ store1.scale = Math.min(store1.originScale * curScale, 3);
109
88
  scaleNow();
110
89
  }
111
90
  };
112
91
  var onTouchEnd = function() {
113
- setLastTouchEndTime(new Date().getTime());
92
+ lastTouchEndTime.current = Date.now();
114
93
  var store1 = store;
115
94
  store1.moveable = false;
116
95
  if (store1.scale < 1.1 && store1.scale > 1 || store1.scale < 1) {
@@ -125,6 +104,11 @@ export var ImagePreview = function(props) {
125
104
  document.addEventListener('touchmove', onTouchMove);
126
105
  document.addEventListener('touchend', onTouchEnd);
127
106
  document.addEventListener('touchcancel', onTouchEnd);
107
+ return function() {
108
+ document.removeEventListener('touchcancel', onTouchEnd);
109
+ document.removeEventListener('touchmove', onTouchMove);
110
+ document.removeEventListener('touchend', onTouchEnd);
111
+ };
128
112
  };
129
113
  useEffect(function() {
130
114
  setShowPop(visible);
@@ -142,22 +126,18 @@ export var ImagePreview = function(props) {
142
126
  innerNo
143
127
  ]);
144
128
  useEffect(function() {
145
- setMaxNo((images === null || images === void 0 ? void 0 : images.length) || 0 + ((videos === null || videos === void 0 ? void 0 : videos.length) || 0));
129
+ setMaxNo(images.length + videos.length);
146
130
  }, [
147
131
  images,
148
132
  videos
149
133
  ]);
150
134
  var scaleNow = function() {
151
135
  if (ref.current) {
152
- ;
153
136
  ref.current.style.transform = "scale(".concat(store.scale, ")");
154
137
  }
155
138
  };
156
- // 计算两个点的距离
157
139
  var getDistance = function(first, second) {
158
- // 计算两个点起始时刻的距离和终止时刻的距离,终止时刻距离变大了则放大,变小了则缩小
159
- // 放大 k 倍则 scale 也 扩大 k 倍
160
- return Math.hypot(Math.abs(second.x - first.x), Math.abs(second.y - first.y));
140
+ return Math.hypot(Math.abs(second.pageX - first.pageX), Math.abs(second.pageY - first.pageY));
161
141
  };
162
142
  var slideChangeEnd = function(page) {
163
143
  setActive(page + 1);
@@ -168,30 +148,28 @@ export var ImagePreview = function(props) {
168
148
  setShowPop(false);
169
149
  setActive(innerNo);
170
150
  scaleNow();
171
- onClose && onClose();
151
+ onClose === null || onClose === void 0 ? void 0 : onClose();
172
152
  setStore(_object_spread_props(_object_spread({}, store), {
173
153
  scale: 1
174
154
  }));
175
155
  };
176
156
  var closeOnImg = function(e) {
177
- // 点击内容区域的图片是否可以关闭弹层(视频区域由于nut-video做了限制,无法关闭弹层)
178
157
  e.stopPropagation();
179
- if (closeOnContentClick) {
180
- onCloseInner(e);
181
- }
158
+ // 点击内容区域的图片是否可以关闭弹层(视频区域由于nut-video做了限制,无法关闭弹层)
159
+ if (closeOnContentClick) onCloseInner(e);
182
160
  };
183
161
  return /*#__PURE__*/ React.createElement(Popup, {
184
162
  visible: showPop,
185
163
  className: "".concat(classPrefix, "-pop"),
186
- style: {
187
- width: '100%'
188
- },
189
164
  onClick: onCloseInner
190
165
  }, /*#__PURE__*/ React.createElement(View, {
191
166
  className: classNames(classPrefix, className),
192
167
  style: style,
193
168
  ref: ref,
194
- onTouchStart: onTouchStart
169
+ onTouchStart: onTouchStart,
170
+ onTouchMove: onTouchMove,
171
+ onTouchEnd: onTouchEnd,
172
+ onTouchCancel: onTouchEnd
195
173
  }, /*#__PURE__*/ React.createElement(Swiper, {
196
174
  autoPlay: autoPlay,
197
175
  className: "".concat(classPrefix, "-swiper"),
@@ -209,57 +187,46 @@ export var ImagePreview = function(props) {
209
187
  },
210
188
  defaultValue: innerNo && (innerNo > maxNo ? maxNo - 1 : innerNo - 1),
211
189
  indicator: indicator
212
- }, (videos !== null && videos !== void 0 ? videos : []).map(function(item) {
190
+ }, _to_consumable_array(videos.map(function(item) {
213
191
  return {
214
192
  type: 'video',
215
193
  data: item
216
194
  };
217
- }).concat((images !== null && images !== void 0 ? images : []).map(function(item) {
195
+ })).concat(_to_consumable_array(images.map(function(item) {
218
196
  return {
219
197
  type: 'image',
220
198
  data: item
221
199
  };
222
- })).sort(function(a, b) {
200
+ }))).sort(function(a, b) {
223
201
  var _a_data, _b_data;
224
202
  var _a_data_index, _b_data_index;
225
203
  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);
226
204
  }).map(function(item, index) {
227
- if (item.type === 'video') {
228
- var _item_data = item.data, source = _item_data.source, options = _item_data.options;
229
- return /*#__PURE__*/ React.createElement(SwiperItem, {
230
- key: index,
231
- className: "nut-imagepreview-swiper-item"
232
- }, /*#__PURE__*/ React.createElement(TaroVideo, {
233
- src: source.src,
234
- onClick: closeOnImg,
235
- controls: options.controls,
236
- autoplay: false,
237
- loop: false,
238
- muted: options.muted
239
- }));
240
- }
241
- if (item.type === 'image') {
242
- var src = item.data.src;
243
- return /*#__PURE__*/ React.createElement(SwiperItem, {
244
- key: index,
245
- className: "nut-imagepreview-swiper-item"
246
- }, /*#__PURE__*/ React.createElement(Image, _object_spread({
247
- src: src,
248
- mode: "widthFix",
249
- onClick: closeOnImg,
250
- style: {
251
- width: '100%'
252
- }
253
- }, Taro.getEnv() !== 'WEB' && {
254
- showMenuByLongpress: showMenuByLongpress
255
- })));
256
- }
257
- return null;
258
- }))), pagination ? /*#__PURE__*/ React.createElement(View, {
205
+ return /*#__PURE__*/ React.createElement(SwiperItem, {
206
+ key: index,
207
+ className: "nut-imagepreview-swiper-item"
208
+ }, item.type === 'video' ? /*#__PURE__*/ React.createElement(TaroVideo, {
209
+ src: item.data.source.src,
210
+ onClick: closeOnImg,
211
+ controls: item.data.options.controls,
212
+ autoplay: false,
213
+ loop: false,
214
+ muted: item.data.options.muted
215
+ }) : /*#__PURE__*/ React.createElement(Image, _object_spread({
216
+ src: item.data.src,
217
+ mode: "widthFix",
218
+ onClick: closeOnImg,
219
+ style: {
220
+ width: '100%'
221
+ }
222
+ }, Taro.getEnv() !== 'WEB' && {
223
+ showMenuByLongpress: showMenuByLongpress
224
+ })));
225
+ }))), pagination && /*#__PURE__*/ React.createElement(View, {
259
226
  className: "".concat(classPrefix, "-index")
260
- }, active, "/", (images ? images.length : 0) + (videos ? videos.length : 0)) : null, closeIcon !== false ? /*#__PURE__*/ React.createElement(View, {
227
+ }, active, "/", maxNo), closeIcon !== false && /*#__PURE__*/ React.createElement(View, {
261
228
  className: "".concat(classPrefix, "-close ").concat(closeIconPosition),
262
229
  onClick: onCloseInner
263
- }, closeIcon === true ? /*#__PURE__*/ React.createElement(Close, null) : closeIcon) : null);
230
+ }, closeIcon === true ? /*#__PURE__*/ React.createElement(Close, null) : closeIcon));
264
231
  };
265
232
  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 {
@@ -53,11 +53,12 @@
53
53
  text-align: center;
54
54
  }
55
55
  .nut-imagepreview-pop {
56
+ width: 100%;
56
57
  height: 100%;
58
+ max-width: 100% !important;
57
59
  background: transparent !important;
58
60
  display: flex;
59
61
  align-items: center;
60
- width: 100%;
61
62
  }
62
63
  .nut-imagepreview-swiper .nut-imagepreview-swiper-item,
63
64
  .nut-imagepreview-swiper .nut-swiper-item {
@@ -15,7 +15,7 @@ var defaultProps = {
15
15
  var classPrefix = "nut-indicator";
16
16
  export var Indicator = function(props) {
17
17
  var maybeFixedWidth = function maybeFixedWidth() {
18
- if (total === 2 || type === 'slide') {
18
+ if (type === 'dualScreen' || type === 'slide') {
19
19
  return "".concat(classPrefix, "-fixed-width");
20
20
  }
21
21
  return '';
@@ -239,7 +239,7 @@ export var InputNumber = function(props) {
239
239
  onClick: handleReduce
240
240
  }, /*#__PURE__*/ React.createElement(Minus, {
241
241
  size: 10,
242
- className: classNames("".concat(classPrefix, "-icon ").concat(classPrefix, "-icon-minus"), _define_property({}, "".concat(classPrefix, "-icon-disabled"), shadowValue === min || disabled))
242
+ className: classNames("".concat(classPrefix, "-icon ").concat(classPrefix, "-icon-minus"), _define_property({}, "".concat(classPrefix, "-icon-disabled"), Number(shadowValue) <= Number(min) || disabled))
243
243
  })), /*#__PURE__*/ React.createElement("input", {
244
244
  className: classNames("".concat(classPrefix, "-input"), _define_property({}, "".concat(classPrefix, "-input-disabled"), disabled)),
245
245
  type: type,
@@ -256,7 +256,7 @@ export var InputNumber = function(props) {
256
256
  onClick: handlePlus
257
257
  }, /*#__PURE__*/ React.createElement(Plus, {
258
258
  size: 10,
259
- className: classNames("".concat(classPrefix, "-icon ").concat(classPrefix, "-icon-plus"), _define_property({}, "".concat(classPrefix, "-icon-disabled"), shadowValue === max || disabled))
259
+ className: classNames("".concat(classPrefix, "-icon ").concat(classPrefix, "-icon-plus"), _define_property({}, "".concat(classPrefix, "-icon-disabled"), Number(shadowValue) >= Number(max) || disabled))
260
260
  })));
261
261
  };
262
262
  InputNumber.displayName = 'NutInputNumber';
@@ -1,10 +1,10 @@
1
- import { Lottie as LottieWeb } from "./web";
2
- import { Lottie as LottieMp } from "./mp";
1
+ import { Lottie as LottieWeb } from "./lottieweb";
2
+ import { Lottie as LottieMp } from "./lottiemp";
3
3
  var implementation;
4
4
  if (process.env.TARO_ENV === 'h5') {
5
5
  // @ts-ignore
6
6
  implementation = LottieWeb;
7
- } else if (process.env.TARO_ENV === 'weapp') {
7
+ } else if (process.env.TARO_ENV === 'weapp' || process.env.TARO_ENV === 'jd') {
8
8
  // @ts-ignore
9
9
  implementation = LottieMp;
10
10
  } else {
@@ -1,6 +1,6 @@
1
1
  import React, { useImperativeHandle, useRef } from "react";
2
2
  import { createSelectorQuery, getEnv, useReady, useUnload } from "@tarojs/taro";
3
- import lottie from "lottie-miniprogram";
3
+ import lottie from "@nutui/lottie-miniprogram";
4
4
  import { getWindowInfo } from "../../utils/get-system-info";
5
5
  import useUuid from "../../hooks/use-uuid";
6
6
  export var Lottie = /*#__PURE__*/ React.forwardRef(function(props, ref) {
@@ -2,31 +2,37 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
2
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
3
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
4
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
5
- import React, { useState, useEffect, useRef } from "react";
5
+ import React, { useState, useEffect, useMemo } from "react";
6
6
  import classNames from "classnames";
7
7
  import { CSSTransition } from "react-transition-group";
8
8
  import { View } from "@tarojs/components";
9
+ import { Close } from "@nutui/icons-react-taro";
10
+ import { web } from "../../utils/platform-taro";
11
+ import pxTransform from "../../utils/px-transform";
9
12
  import { ComponentDefaults } from "../../utils/typings";
10
13
  import { customEvents, useCustomEvent, useCustomEventsPath } from "../../hooks/use-custom-event";
11
14
  import { mergeProps } from "../../utils/merge-props";
12
15
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
13
16
  id: '',
14
- duration: 3000,
15
- type: 'danger',
17
+ distance: 8,
18
+ navHeight: 57,
16
19
  position: 'top',
17
20
  visible: false,
21
+ closeable: false,
22
+ leftIcon: null,
23
+ rightIcon: null,
24
+ duration: 3000,
18
25
  onClose: function() {},
19
26
  onClick: function() {}
20
27
  });
21
28
  var classPrefix = 'nut-notify';
22
29
  export var Notify = function(props) {
23
- var _mergeProps = mergeProps(defaultProps, props), id = _mergeProps.id, children = _mergeProps.children, style = _mergeProps.style, type = _mergeProps.type, className = _mergeProps.className, position = _mergeProps.position, visible = _mergeProps.visible, duration = _mergeProps.duration, onClose = _mergeProps.onClose, onClick = _mergeProps.onClick;
30
+ var _mergeProps = mergeProps(defaultProps, props), id = _mergeProps.id, style = _mergeProps.style, children = _mergeProps.children, distance = _mergeProps.distance, navHeight = _mergeProps.navHeight, closeable = _mergeProps.closeable, leftIcon = _mergeProps.leftIcon, rightIcon = _mergeProps.rightIcon, position = _mergeProps.position, visible = _mergeProps.visible, duration = _mergeProps.duration, className = _mergeProps.className, onClose = _mergeProps.onClose, onClick = _mergeProps.onClick;
24
31
  useCustomEvent(id, function(status) {
25
32
  status ? show() : hide();
26
33
  });
27
34
  var timer;
28
35
  var _useState = _sliced_to_array(useState(false), 2), showNotify = _useState[0], setShowNotify = _useState[1];
29
- var cssRef = useRef(null);
30
36
  useEffect(function() {
31
37
  if (visible) {
32
38
  show();
@@ -36,9 +42,6 @@ export var Notify = function(props) {
36
42
  }, [
37
43
  visible
38
44
  ]);
39
- var clickHandle = function() {
40
- onClick();
41
- };
42
45
  var show = function() {
43
46
  setShowNotify(true);
44
47
  clearTimer();
@@ -58,10 +61,29 @@ export var Notify = function(props) {
58
61
  setShowNotify(false);
59
62
  onClose();
60
63
  };
64
+ var getDistance = useMemo(function() {
65
+ if (position === 'top') {
66
+ return {
67
+ top: pxTransform(web() ? Number(distance) + navHeight : Number(distance))
68
+ };
69
+ }
70
+ return {
71
+ bottom: pxTransform(Number(distance))
72
+ };
73
+ }, [
74
+ distance,
75
+ position
76
+ ]);
61
77
  var _obj;
62
- var classes = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix, "-popup-top"), position === 'top'), _define_property(_obj, "".concat(classPrefix, "-popup-bottom"), position === 'bottom'), _define_property(_obj, "".concat(classPrefix), true), _define_property(_obj, "".concat(classPrefix, "-").concat(type), true), _obj));
78
+ var classes = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix), true), _define_property(_obj, "".concat(className), true), _obj));
79
+ var handleClick = function() {
80
+ onClick === null || onClick === void 0 ? void 0 : onClick();
81
+ };
82
+ var handleClickIcon = function() {
83
+ hide();
84
+ };
85
+ var _obj1;
63
86
  return /*#__PURE__*/ React.createElement(CSSTransition, {
64
- nodeRef: cssRef,
65
87
  in: showNotify,
66
88
  timeout: 300,
67
89
  classNames: "fade",
@@ -70,10 +92,19 @@ export var Notify = function(props) {
70
92
  position: position,
71
93
  id: id
72
94
  }, /*#__PURE__*/ React.createElement(View, {
73
- className: "".concat(classes, " ").concat(className),
74
- style: style,
75
- onClick: clickHandle
76
- }, children));
95
+ className: classes,
96
+ style: _object_spread({}, style, getDistance),
97
+ onClick: handleClick
98
+ }, leftIcon ? /*#__PURE__*/ React.createElement(View, {
99
+ className: "".concat(classPrefix, "-left-icon")
100
+ }, leftIcon) : null, /*#__PURE__*/ React.createElement(View, {
101
+ className: classNames((_obj1 = {}, _define_property(_obj1, "".concat(classPrefix, "-content"), true), _define_property(_obj1, "".concat(classPrefix, "-ellipsis"), closeable || rightIcon), _define_property(_obj1, "".concat(classPrefix, "-layout-left"), leftIcon || rightIcon), _obj1))
102
+ }, children), rightIcon || closeable ? /*#__PURE__*/ React.createElement(View, {
103
+ className: "".concat(classPrefix, "-right-icon"),
104
+ onClick: handleClickIcon
105
+ }, rightIcon || (closeable ? /*#__PURE__*/ React.createElement(Close, {
106
+ size: 12
107
+ }) : null)) : null));
77
108
  };
78
109
  export function open(selector) {
79
110
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -6,7 +6,7 @@
6
6
  /*入场动画过程*/
7
7
  .fade-enter-active {
8
8
  opacity: 1;
9
- transition: opacity 1s;
9
+ transition: opacity 300ms ease-in;
10
10
  }
11
11
 
12
12
  /*入场动画结束*/
@@ -22,7 +22,7 @@
22
22
  /*离场动画过程*/
23
23
  .fade-exit-active {
24
24
  opacity: 0;
25
- transition: opacity 1s;
25
+ transition: opacity 300ms ease-out;
26
26
  }
27
27
 
28
28
  /*离场动画结束*/
@@ -38,56 +38,59 @@
38
38
  /*页面第一次加载时的动画过程*/
39
39
  .fade-appear-active {
40
40
  opacity: 1;
41
- transition: opacity 1s;
41
+ transition: opacity 300ms;
42
42
  }
43
43
 
44
44
  .nut-notify {
45
+ position: fixed;
46
+ left: 8px;
47
+ right: 8px;
48
+ z-index: $notify-z-index;
45
49
  display: flex;
46
- justify-content: center;
47
50
  align-items: center;
48
51
  box-sizing: border-box;
49
- padding: $notify-padding;
50
- color: $notify-text-color;
51
- font-size: $notify-font-size;
52
- white-space: pre-wrap;
53
- word-wrap: break-word;
54
52
  height: $notify-height;
55
-
56
- &-popup-top,
57
- &-popup-bottom {
58
- position: fixed;
59
- left: 0;
60
- right: 0;
61
- overflow-y: auto;
62
- transition: transform 0.3s;
63
- z-index: 9999;
64
- }
65
-
66
- &-popup-top {
67
- top: 0;
68
- }
69
-
70
- &-popup-bottom {
71
- bottom: 0;
53
+ padding: $notify-padding;
54
+ border-radius: $notify-border-radius;
55
+ box-shadow: $notify-box-shadow;
56
+ background-color: $notify-background-color;
57
+
58
+ &-content {
59
+ flex: 1;
60
+ text-align: center;
61
+ min-width: 0;
62
+ font-size: $notify-font-size;
63
+ color: $notify-text-color;
64
+ white-space: nowrap;
65
+ overflow: hidden;
72
66
  }
73
67
 
74
- &-base {
75
- background: $notify-base-background-color;
68
+ &-ellipsis {
69
+ text-overflow: ellipsis;
76
70
  }
77
71
 
78
- &-primary {
79
- background: $notify-primary-background-color;
72
+ &-layout-left {
73
+ text-align: left;
80
74
  }
81
75
 
82
- &-success {
83
- background: $notify-success-background-color;
76
+ &-left-icon,
77
+ &-right-icon {
78
+ display: inline-flex;
84
79
  }
85
80
 
86
- &-danger {
87
- background: $notify-danger-background-color;
81
+ &-left-icon {
82
+ margin-right: 6px;
83
+ .nut-icon {
84
+ height: 16px;
85
+ width: 16px;
86
+ }
88
87
  }
89
88
 
90
- &-warning {
91
- background: $notify-warning-background-color;
89
+ &-right-icon {
90
+ margin-left: 6px;
91
+ .nut-icon {
92
+ height: 12px;
93
+ width: 12px;
94
+ }
92
95
  }
93
96
  }