pixuireactcomponents 1.5.10 → 1.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.5.10",
3
+ "version": "1.5.11",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -68,29 +68,25 @@ export function Carousel(props) {
68
68
  : 0.3 : _p;
69
69
  // console.log('children', children.length);
70
70
  var safeNext = function () {
71
- // console.log('safeNext1', canClickSwitch.current, isMoving.current);
72
- if (!canClickSwitch.current || isMoving.current)
71
+ if (!canClickSwitch.current)
73
72
  return;
74
- // console.log('safeNext2');
75
73
  canClickSwitch.current = false;
76
74
  if (safeNextHandle.current)
77
75
  clearTimeout(safeNextHandle.current);
78
76
  safeNextHandle.current = setTimeout(function () {
79
77
  canClickSwitch.current = true;
80
- }, 1000);
78
+ }, 1100);
81
79
  handleNext();
82
80
  };
83
81
  var safePrev = function () {
84
- // console.log('safePrev1', canClickSwitch.current, isMoving.current);
85
- if (!canClickSwitch.current || isMoving.current)
82
+ if (!canClickSwitch.current)
86
83
  return;
87
- // console.log('safePrev2');
88
84
  canClickSwitch.current = false;
89
85
  if (safePrevHandle.current)
90
86
  clearTimeout(safePrevHandle.current);
91
87
  safePrevHandle.current = setTimeout(function () {
92
88
  canClickSwitch.current = true;
93
- }, 1000);
89
+ }, 1100);
94
90
  handlePrev();
95
91
  };
96
92
  useImperativeHandle(props.cRef, function () { return ({
@@ -98,7 +94,7 @@ export function Carousel(props) {
98
94
  handlePrev: safePrev,
99
95
  setShowIndex: setShowIndex,
100
96
  }); });
101
- var duration = switchDuration < 1000 ? 1000 : switchDuration;
97
+ var duration = switchDuration < 1100 ? 1100 : switchDuration;
102
98
  var _q = useState(defaultIndex), showIndex = _q[0], setShowIndex = _q[1];
103
99
  //轮播元素正在滚动
104
100
  var isMoving = useRef(false);
@@ -106,8 +102,6 @@ export function Carousel(props) {
106
102
  var isMouseDown = useRef(false);
107
103
  var mouseDownX = useRef(0);
108
104
  var mouseDownY = useRef(0);
109
- var lastAniFinishTime = useRef(0);
110
- var isSideAniPlaying = useRef(false);
111
105
  //pixui在 onTransitionEnd 之后马上触发 transform 会丢onTransitionEnd
112
106
  var canClickSwitch = useRef(true);
113
107
  var handleNextRef = useRef(function () { });
@@ -173,7 +167,7 @@ export function Carousel(props) {
173
167
  };
174
168
  }, []);
175
169
  var handlePrev = function () {
176
- if (isMoving.current || isMouseDown.current)
170
+ if (isMoving.current)
177
171
  return;
178
172
  isMoving.current = true;
179
173
  if (showIndex === 0) {
@@ -186,40 +180,20 @@ export function Carousel(props) {
186
180
  var handleNext = function () {
187
181
  if (!loop && showIndex == carouselItems.length - 2)
188
182
  return;
189
- if (isMoving.current || isMouseDown.current)
183
+ if (isMoving.current)
190
184
  return;
191
185
  isMoving.current = true;
192
186
  setShowIndex(showIndex + 1);
193
187
  };
194
188
  var handleTransitionEnd = function () {
195
- var now = Date.now();
196
- // console.log(
197
- // 'handleTransitionEnd ? isSideAniPlaying',
198
- // isSideAniPlaying.current,
199
- // 'time',
200
- // now - lastAniFinishTime.current,
201
- // 'showTransition',
202
- // showTransition
203
- // );
204
- if (!isSideAniPlaying.current && Math.abs(now - lastAniFinishTime.current) < 800) {
205
- //pixui bug 重复触发handleTransitionEnd
206
- return;
207
- }
208
- lastAniFinishTime.current = now;
209
189
  //判断前后补位元素准备跳转
210
190
  //在动画结束以后关掉,否则用鼠标拖动的时候不能补充剩下的offset
211
191
  if (isLastCarouseItem() || isFirstCarouseLastItem()) {
212
192
  setShowTransition(false);
213
- isSideAniPlaying.current = true;
214
- // console.log('handleTransitionEnd 1');
215
- }
216
- else {
217
- // console.log('handleTransitionEnd 3');
218
- isMoving.current = false;
219
- isSideAniPlaying.current = false;
220
193
  }
194
+ isMoving.current = false;
221
195
  //触发onSlideChange
222
- if (!isLastCarouseItem() && !isFirstCarouseLastItem() && onSlideChange && !isSideAniPlaying.current)
196
+ if (!isLastCarouseItem() && !isFirstCarouseLastItem() && onSlideChange && showTransition)
223
197
  onSlideChange(showIndex - 1);
224
198
  // 处理首尾特殊case
225
199
  if (isLastCarouseItem()) {
@@ -318,7 +292,7 @@ export function Carousel(props) {
318
292
  display: 'flex',
319
293
  width: isVertical ? compWidth : compWidth * carouselItems.length + 'px',
320
294
  height: isVertical ? compHeight * carouselItems.length : compHeight + 'px',
321
- transition: "transform ".concat(showTransition ? '0.5s' : '0s', " ease 0s"),
295
+ transition: "transform ".concat(showTransition ? '0.4s' : '0s', " ease 0s"),
322
296
  transform: isVertical
323
297
  ? "translate(0px, ".concat(offset + gestureoffset[1], "px)")
324
298
  : "translate(".concat(offset + gestureoffset[0], "px, 0px)"),