@nutui/nutui-react-taro 3.0.15 → 3.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -15
- package/dist/cjs/packages/calendaritem/calendaritem.d.ts +1 -1
- package/dist/cjs/packages/calendaritem/calendaritem.js +3 -3
- package/dist/cjs/packages/imagepreview/imagepreview.js +25 -4
- package/dist/cjs/packages/noticebar/noticebar.js +65 -41
- package/dist/cjs/packages/swiper/index.d.ts +1 -1
- package/dist/cjs/packages/swiper/swiper.js +6 -0
- package/dist/cjs/types/spec/calendar/base.d.ts +3 -1
- package/dist/cjs/types/spec/imagepreview/h5.d.ts +4 -1
- package/dist/cjs/types/spec/imagepreview/taro.d.ts +4 -1
- package/dist/cjs/utils/date.d.ts +2 -2
- package/dist/cjs/utils/date.js +2 -2
- package/dist/es/packages/calendaritem/calendaritem.d.ts +1 -1
- package/dist/es/packages/calendaritem/calendaritem.js +3 -3
- package/dist/es/packages/imagepreview/imagepreview.js +25 -4
- package/dist/es/packages/noticebar/noticebar.js +66 -42
- package/dist/es/packages/swiper/index.d.ts +1 -1
- package/dist/es/packages/swiper/swiper.js +7 -1
- package/dist/es/types/spec/calendar/base.d.ts +3 -1
- package/dist/es/types/spec/imagepreview/h5.d.ts +4 -1
- package/dist/es/types/spec/imagepreview/taro.d.ts +4 -1
- package/dist/es/utils/date.d.ts +2 -2
- package/dist/es/utils/date.js +2 -2
- package/dist/nutui.react.umd.js +99 -50
- package/dist/style-jmapp.css +1 -1
- package/dist/style-jmapp.scss +30 -30
- package/dist/style-jrkf.css +1 -1
- package/dist/style-jrkf.scss +29 -29
- package/dist/style.css +1 -1
- package/dist/style.scss +29 -29
- package/package.json +1 -1
|
@@ -3,8 +3,9 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
|
3
3
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
4
4
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
5
5
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
6
|
+
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
6
7
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
7
|
-
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
8
|
+
import React, { useEffect, useMemo, useRef, useState, useCallback } from "react";
|
|
8
9
|
import { View } from "@tarojs/components";
|
|
9
10
|
import { Close, Notice } from "@nutui/icons-react-taro";
|
|
10
11
|
import classNames from "classnames";
|
|
@@ -47,9 +48,10 @@ export var NoticeBar = function(props) {
|
|
|
47
48
|
var _useState8 = _sliced_to_array(useState(null), 2), isCanScroll = _useState8[0], SetIsCanScroll = _useState8[1];
|
|
48
49
|
var isVertical = direction === 'vertical';
|
|
49
50
|
var _useState9 = _sliced_to_array(useState(null), 2), rect = _useState9[0], setRect = _useState9[1];
|
|
50
|
-
var
|
|
51
|
+
var activeRef = useRef(0);
|
|
51
52
|
var _useState10 = _sliced_to_array(useState(false), 2), ready = _useState10[0], setReady = _useState10[1];
|
|
52
53
|
var container = useRef(null);
|
|
54
|
+
var _useState11 = _sliced_to_array(useState(false), 2), isContainerReady = _useState11[0], setIsContainerReady = _useState11[1];
|
|
53
55
|
var innerRef = useRef(null);
|
|
54
56
|
var swiperRef = useRef({
|
|
55
57
|
moving: false,
|
|
@@ -59,8 +61,8 @@ export var NoticeBar = function(props) {
|
|
|
59
61
|
offset: 0,
|
|
60
62
|
size: 0
|
|
61
63
|
});
|
|
62
|
-
var
|
|
63
|
-
var
|
|
64
|
+
var _useState12 = _sliced_to_array(useState([]), 2), childOffset = _useState12[0], setChildOffset = _useState12[1];
|
|
65
|
+
var _useState13 = _sliced_to_array(useState(0), 2), offset = _useState13[0], setOffset = _useState13[1];
|
|
64
66
|
var _useMemo = useMemo(function() {
|
|
65
67
|
var childCount = 0;
|
|
66
68
|
var childs = React.Children.map(children, function(child) {
|
|
@@ -100,7 +102,9 @@ export var NoticeBar = function(props) {
|
|
|
100
102
|
// 销毁事件
|
|
101
103
|
clearInterval(timer);
|
|
102
104
|
};
|
|
103
|
-
}, [
|
|
105
|
+
}, [
|
|
106
|
+
childs
|
|
107
|
+
]);
|
|
104
108
|
useEffect(function() {
|
|
105
109
|
initScrollWrap(content);
|
|
106
110
|
}, [
|
|
@@ -219,7 +223,7 @@ export var NoticeBar = function(props) {
|
|
|
219
223
|
};
|
|
220
224
|
// 垂直自定义滚动方式
|
|
221
225
|
var init = function() {
|
|
222
|
-
var
|
|
226
|
+
var activeIndex = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
223
227
|
if (!(container === null || container === void 0 ? void 0 : container.current)) return;
|
|
224
228
|
setTimeout(/*#__PURE__*/ _async_to_generator(function() {
|
|
225
229
|
var rects, _active, _height, targetOffset;
|
|
@@ -232,17 +236,18 @@ export var NoticeBar = function(props) {
|
|
|
232
236
|
];
|
|
233
237
|
case 1:
|
|
234
238
|
rects = _state.sent();
|
|
235
|
-
_active = Math.max(Math.min(childCount - 1,
|
|
239
|
+
_active = Math.max(Math.min(childCount - 1, activeIndex), 0);
|
|
236
240
|
_height = rects === null || rects === void 0 ? void 0 : rects.height;
|
|
237
241
|
trackSize = childCount * Number(_height);
|
|
238
242
|
targetOffset = getOffset(_active);
|
|
239
|
-
|
|
240
|
-
if (ready) {
|
|
241
|
-
swiperRef.current.moving = false;
|
|
242
|
-
}
|
|
243
|
-
active = _active;
|
|
243
|
+
activeRef.current = _active;
|
|
244
244
|
setRect(rects);
|
|
245
245
|
setOffset(targetOffset);
|
|
246
|
+
setChildOffset(new Array(childCount).fill(0));
|
|
247
|
+
// 关闭动画并立即设置样式
|
|
248
|
+
swiperRef.current.moving = true;
|
|
249
|
+
setStyle(targetOffset, rects);
|
|
250
|
+
swiperRef.current.moving = false;
|
|
246
251
|
setReady(true);
|
|
247
252
|
return [
|
|
248
253
|
2
|
|
@@ -253,7 +258,6 @@ export var NoticeBar = function(props) {
|
|
|
253
258
|
};
|
|
254
259
|
useEffect(function() {
|
|
255
260
|
if (ready) {
|
|
256
|
-
stopAutoPlay();
|
|
257
261
|
autoplay();
|
|
258
262
|
}
|
|
259
263
|
return function() {
|
|
@@ -263,18 +267,19 @@ export var NoticeBar = function(props) {
|
|
|
263
267
|
ready
|
|
264
268
|
]);
|
|
265
269
|
useEffect(function() {
|
|
266
|
-
if (isVertical && children) {
|
|
267
|
-
init();
|
|
270
|
+
if (isVertical && children && isContainerReady) {
|
|
268
271
|
stopAutoPlay();
|
|
269
|
-
|
|
272
|
+
setReady(false);
|
|
273
|
+
init();
|
|
270
274
|
}
|
|
271
275
|
}, [
|
|
272
276
|
children,
|
|
273
|
-
|
|
277
|
+
isContainerReady
|
|
274
278
|
]);
|
|
275
279
|
// 清除定时器
|
|
276
280
|
var stopAutoPlay = function() {
|
|
277
281
|
clearTimeout(swiperRef.current.autoplayTimer);
|
|
282
|
+
swiperRef.current.moving = false;
|
|
278
283
|
swiperRef.current.autoplayTimer = null;
|
|
279
284
|
};
|
|
280
285
|
// 定时轮播
|
|
@@ -293,23 +298,26 @@ export var NoticeBar = function(props) {
|
|
|
293
298
|
var targetActive = getActive(pace);
|
|
294
299
|
// 父级容器偏移量
|
|
295
300
|
var targetOffset = getOffset(targetActive, offset);
|
|
296
|
-
//
|
|
297
|
-
|
|
298
|
-
var
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
301
|
+
// 循环滚动,调整开头结尾图片位置
|
|
302
|
+
setChildOffset(function(prevChildOffset) {
|
|
303
|
+
var newChildOffset = _to_consumable_array(prevChildOffset);
|
|
304
|
+
if (Array.isArray(children) && children[0] && targetOffset !== minOffset) {
|
|
305
|
+
var rightBound = targetOffset < minOffset;
|
|
306
|
+
newChildOffset[0] = rightBound ? trackSize : 0;
|
|
307
|
+
}
|
|
308
|
+
if (Array.isArray(children) && children[childCount - 1] && targetOffset !== 0) {
|
|
309
|
+
var leftBound = targetOffset > 0;
|
|
310
|
+
newChildOffset[childCount - 1] = leftBound ? -trackSize : 0;
|
|
311
|
+
}
|
|
312
|
+
return newChildOffset;
|
|
313
|
+
});
|
|
314
|
+
activeRef.current = targetActive;
|
|
307
315
|
setOffset(targetOffset);
|
|
308
|
-
|
|
316
|
+
setStyle(targetOffset);
|
|
309
317
|
};
|
|
310
318
|
// 下一页
|
|
311
319
|
var next = function() {
|
|
312
|
-
|
|
320
|
+
resetPosition();
|
|
313
321
|
requestFrame(function() {
|
|
314
322
|
requestFrame(function() {
|
|
315
323
|
swiperRef.current.moving = false;
|
|
@@ -322,16 +330,16 @@ export var NoticeBar = function(props) {
|
|
|
322
330
|
var handleItemClick = function(event, value) {
|
|
323
331
|
onItemClick && onItemClick(event, value);
|
|
324
332
|
};
|
|
325
|
-
var
|
|
326
|
-
var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset;
|
|
333
|
+
var setStyle = function() {
|
|
334
|
+
var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset, currentRect = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : rect;
|
|
327
335
|
var target = innerRef.current;
|
|
328
336
|
if (!target) {
|
|
329
337
|
return;
|
|
330
338
|
}
|
|
331
339
|
var _offset = 0;
|
|
332
|
-
|
|
333
|
-
var val =
|
|
334
|
-
_offset = moveOffset + Number(
|
|
340
|
+
var containerHeight = (currentRect === null || currentRect === void 0 ? void 0 : currentRect.height) || height;
|
|
341
|
+
var val = containerHeight - Number(height);
|
|
342
|
+
_offset = moveOffset + Number(activeRef.current === childCount - 1 && val / 2);
|
|
335
343
|
target.style.transitionDuration = "".concat(swiperRef.current.moving ? 0 : duration, "ms");
|
|
336
344
|
target.style.height = "".concat(Number(height) * (childCount + 1), "px");
|
|
337
345
|
target.style.transform = "translate3D(0,".concat(_offset, "px,0)");
|
|
@@ -351,11 +359,12 @@ export var NoticeBar = function(props) {
|
|
|
351
359
|
};
|
|
352
360
|
// 确定当前active 元素
|
|
353
361
|
var getActive = function(pace) {
|
|
362
|
+
var currentActive = activeRef.current;
|
|
354
363
|
if (pace) {
|
|
355
|
-
var _active =
|
|
364
|
+
var _active = currentActive + pace;
|
|
356
365
|
return range(_active, -1, childCount);
|
|
357
366
|
}
|
|
358
|
-
return
|
|
367
|
+
return currentActive;
|
|
359
368
|
};
|
|
360
369
|
// 计算位移
|
|
361
370
|
var getOffset = function(active) {
|
|
@@ -373,14 +382,15 @@ export var NoticeBar = function(props) {
|
|
|
373
382
|
return Math.min(Math.max(num, min), max);
|
|
374
383
|
};
|
|
375
384
|
// 重置首尾位置信息
|
|
376
|
-
var
|
|
385
|
+
var resetPosition = function() {
|
|
386
|
+
var currentActive = activeRef.current;
|
|
377
387
|
swiperRef.current.moving = true;
|
|
378
|
-
if (
|
|
388
|
+
if (currentActive <= -1) {
|
|
379
389
|
move({
|
|
380
390
|
pace: childCount
|
|
381
391
|
});
|
|
382
392
|
}
|
|
383
|
-
if (
|
|
393
|
+
if (currentActive >= childCount) {
|
|
384
394
|
move({
|
|
385
395
|
pace: -childCount
|
|
386
396
|
});
|
|
@@ -394,6 +404,20 @@ export var NoticeBar = function(props) {
|
|
|
394
404
|
stopAutoPlay();
|
|
395
405
|
};
|
|
396
406
|
}, []);
|
|
407
|
+
var hasVerticalContent = useMemo(function() {
|
|
408
|
+
if (!isVertical) return false;
|
|
409
|
+
if (children) return (childs === null || childs === void 0 ? void 0 : childs.length) > 0;
|
|
410
|
+
return (list === null || list === void 0 ? void 0 : list.length) > 0;
|
|
411
|
+
}, [
|
|
412
|
+
isVertical,
|
|
413
|
+
childs,
|
|
414
|
+
list,
|
|
415
|
+
children
|
|
416
|
+
]);
|
|
417
|
+
var containerRefCallback = useCallback(function(ref) {
|
|
418
|
+
container.current = ref;
|
|
419
|
+
setIsContainerReady(true);
|
|
420
|
+
}, []);
|
|
397
421
|
return (
|
|
398
422
|
/*#__PURE__*/ React.createElement(View, {
|
|
399
423
|
className: cls,
|
|
@@ -419,10 +443,10 @@ export var NoticeBar = function(props) {
|
|
|
419
443
|
onClick: onClickIcon
|
|
420
444
|
}, rightIcon || /*#__PURE__*/ React.createElement(Close, {
|
|
421
445
|
size: 12
|
|
422
|
-
})) : null) : null, showNoticeBar &&
|
|
446
|
+
})) : null) : null, showNoticeBar && hasVerticalContent && isVertical ? /*#__PURE__*/ React.createElement(View, {
|
|
423
447
|
className: "nut-noticebar-vertical",
|
|
424
448
|
style: barStyle,
|
|
425
|
-
ref:
|
|
449
|
+
ref: containerRefCallback,
|
|
426
450
|
onClick: handleClick
|
|
427
451
|
}, leftIcon ? /*#__PURE__*/ React.createElement(View, {
|
|
428
452
|
className: "nut-noticebar-box-left-icon"
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import SwiperItem from "../swiperitem/index";
|
|
3
3
|
import { TaroSwiperProps } from "../../types";
|
|
4
4
|
export type { TaroSwiperProps as SwiperProps } from "../../types";
|
|
5
|
-
type CompoundedComponent = React.ForwardRefExoticComponent<Partial<TaroSwiperProps> &
|
|
5
|
+
type CompoundedComponent = React.ForwardRefExoticComponent<Partial<TaroSwiperProps> & React.RefAttributes<any>> & {
|
|
6
6
|
Item: typeof SwiperItem;
|
|
7
7
|
};
|
|
8
8
|
declare const InnerSwiper: CompoundedComponent;
|
|
@@ -3,7 +3,7 @@ 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 _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
5
5
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
6
|
-
import React, { Children, useImperativeHandle, useMemo, useState } from "react";
|
|
6
|
+
import React, { Children, useImperativeHandle, useMemo, useState, useEffect } from "react";
|
|
7
7
|
import { Swiper as TaroSwiper, SwiperItem as TSwiperItem, View } from "@tarojs/components";
|
|
8
8
|
import classNames from "classnames";
|
|
9
9
|
import Indicator from "../indicator/index";
|
|
@@ -48,6 +48,12 @@ export var Swiper = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
48
48
|
}, [
|
|
49
49
|
children
|
|
50
50
|
]);
|
|
51
|
+
useEffect(function() {
|
|
52
|
+
setInnerValue(current || defaultValue);
|
|
53
|
+
}, [
|
|
54
|
+
defaultValue,
|
|
55
|
+
current
|
|
56
|
+
]);
|
|
51
57
|
var renderIndicator = function() {
|
|
52
58
|
if (/*#__PURE__*/ React.isValidElement(indicator)) return indicator;
|
|
53
59
|
if (indicator || indicatorDots) {
|
|
@@ -4,6 +4,8 @@ import { BaseProps } from '../../base/props';
|
|
|
4
4
|
export interface CalendarDay {
|
|
5
5
|
day: SimpleValue;
|
|
6
6
|
type: string;
|
|
7
|
+
month?: SimpleValue;
|
|
8
|
+
year?: SimpleValue;
|
|
7
9
|
}
|
|
8
10
|
export interface CalendarMonthInfo {
|
|
9
11
|
curData: string[] | string;
|
|
@@ -121,7 +123,7 @@ export interface BaseCalendar {
|
|
|
121
123
|
/**
|
|
122
124
|
* 点击/选择后触发
|
|
123
125
|
*/
|
|
124
|
-
onDayClick: (data: string) => void
|
|
126
|
+
onDayClick: (data: string[]) => void
|
|
125
127
|
/**
|
|
126
128
|
* 年月子标题到达顶部时触发
|
|
127
129
|
*/
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { BaseImagePreview } from './base';
|
|
2
|
-
|
|
2
|
+
import { WebSwiperProps } from "../../../types";
|
|
3
|
+
type props = BaseImagePreview & Omit<WebSwiperProps, 'autoPlay' | 'indicator'>;
|
|
4
|
+
export interface WebImagePreviewProps extends Omit<props, 'autoplay'> {
|
|
3
5
|
}
|
|
6
|
+
export {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BaseImagePreview } from './base';
|
|
2
|
-
|
|
2
|
+
import { TaroSwiperProps } from "../../../types";
|
|
3
|
+
type props = Omit<BaseImagePreview, 'autoPlay'> & Omit<TaroSwiperProps, 'autoPlay' | 'autoplay' | 'indicator'>;
|
|
4
|
+
export interface TaroImagePreviewProps extends props {
|
|
3
5
|
autoPlay: boolean;
|
|
4
6
|
showMenuByLongpress: boolean;
|
|
5
7
|
}
|
|
8
|
+
export {};
|
package/dist/es/utils/date.d.ts
CHANGED
|
@@ -60,6 +60,6 @@ export declare const getDaysStatus: (type: string, year: number, month: number)
|
|
|
60
60
|
export declare const getPreMonthDates: (type: string, year: number, month: number, firstDayOfWeek: number) => {
|
|
61
61
|
day: number;
|
|
62
62
|
type: string;
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
year: number;
|
|
64
|
+
month: number;
|
|
65
65
|
}[];
|
package/dist/es/utils/date.js
CHANGED
|
@@ -229,8 +229,8 @@ export var getPreMonthDates = function(type, year, month, firstDayOfWeek) {
|
|
|
229
229
|
return {
|
|
230
230
|
day: k + 1,
|
|
231
231
|
type: type,
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
year: preYear,
|
|
233
|
+
month: preMonth
|
|
234
234
|
};
|
|
235
235
|
});
|
|
236
236
|
return months.slice(preDates - days);
|
package/dist/nutui.react.umd.js
CHANGED
|
@@ -4565,8 +4565,8 @@
|
|
|
4565
4565
|
return {
|
|
4566
4566
|
day: k + 1,
|
|
4567
4567
|
type: type2,
|
|
4568
|
-
preYear,
|
|
4569
|
-
preMonth
|
|
4568
|
+
year: preYear,
|
|
4569
|
+
month: preMonth
|
|
4570
4570
|
};
|
|
4571
4571
|
});
|
|
4572
4572
|
return months.slice(preDates - days);
|
|
@@ -7290,13 +7290,13 @@
|
|
|
7290
7290
|
renderDay: void 0,
|
|
7291
7291
|
renderDayTop: void 0,
|
|
7292
7292
|
renderDayBottom: void 0,
|
|
7293
|
-
onConfirm: function(
|
|
7293
|
+
onConfirm: function() {
|
|
7294
7294
|
},
|
|
7295
7295
|
onUpdate: function() {
|
|
7296
7296
|
},
|
|
7297
|
-
onDayClick: function(
|
|
7297
|
+
onDayClick: function() {
|
|
7298
7298
|
},
|
|
7299
|
-
onPageChange: function(
|
|
7299
|
+
onPageChange: function() {
|
|
7300
7300
|
}
|
|
7301
7301
|
});
|
|
7302
7302
|
var CalendarItem = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
@@ -15727,9 +15727,10 @@
|
|
|
15727
15727
|
var _useState8 = _sliced_to_array(React.useState(null), 2), isCanScroll = _useState8[0], SetIsCanScroll = _useState8[1];
|
|
15728
15728
|
var isVertical = direction === "vertical";
|
|
15729
15729
|
var _useState9 = _sliced_to_array(React.useState(null), 2), rect = _useState9[0], setRect = _useState9[1];
|
|
15730
|
-
var
|
|
15730
|
+
var activeRef = React.useRef(0);
|
|
15731
15731
|
var _useState10 = _sliced_to_array(React.useState(false), 2), ready = _useState10[0], setReady = _useState10[1];
|
|
15732
15732
|
var container = React.useRef(null);
|
|
15733
|
+
var _useState11 = _sliced_to_array(React.useState(false), 2), isContainerReady = _useState11[0], setIsContainerReady = _useState11[1];
|
|
15733
15734
|
var innerRef = React.useRef(null);
|
|
15734
15735
|
var swiperRef = React.useRef({
|
|
15735
15736
|
moving: false,
|
|
@@ -15739,8 +15740,8 @@
|
|
|
15739
15740
|
offset: 0,
|
|
15740
15741
|
size: 0
|
|
15741
15742
|
});
|
|
15742
|
-
var
|
|
15743
|
-
var
|
|
15743
|
+
var _useState12 = _sliced_to_array(React.useState([]), 2), childOffset = _useState12[0], setChildOffset = _useState12[1];
|
|
15744
|
+
var _useState13 = _sliced_to_array(React.useState(0), 2), offset = _useState13[0], setOffset = _useState13[1];
|
|
15744
15745
|
var _useMemo = React.useMemo(function() {
|
|
15745
15746
|
var childCount2 = 0;
|
|
15746
15747
|
var childs2 = React.Children.map(children, function(child) {
|
|
@@ -15777,7 +15778,9 @@
|
|
|
15777
15778
|
return function() {
|
|
15778
15779
|
clearInterval(timer);
|
|
15779
15780
|
};
|
|
15780
|
-
}, [
|
|
15781
|
+
}, [
|
|
15782
|
+
childs
|
|
15783
|
+
]);
|
|
15781
15784
|
React.useEffect(function() {
|
|
15782
15785
|
initScrollWrap();
|
|
15783
15786
|
}, [
|
|
@@ -15894,7 +15897,7 @@
|
|
|
15894
15897
|
marginTop: animate ? "-".concat(height2, "px") : ""
|
|
15895
15898
|
};
|
|
15896
15899
|
var init = function() {
|
|
15897
|
-
var
|
|
15900
|
+
var activeIndex = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
15898
15901
|
if (!(container === null || container === void 0 ? void 0 : container.current)) return;
|
|
15899
15902
|
setTimeout(/* @__PURE__ */ _async_to_generator(function() {
|
|
15900
15903
|
var rects, _active, _height, targetOffset;
|
|
@@ -15907,17 +15910,17 @@
|
|
|
15907
15910
|
];
|
|
15908
15911
|
case 1:
|
|
15909
15912
|
rects = _state.sent();
|
|
15910
|
-
_active = Math.max(Math.min(childCount - 1,
|
|
15913
|
+
_active = Math.max(Math.min(childCount - 1, activeIndex), 0);
|
|
15911
15914
|
_height = rects === null || rects === void 0 ? void 0 : rects.height;
|
|
15912
15915
|
trackSize = childCount * Number(_height);
|
|
15913
15916
|
targetOffset = getOffset(_active);
|
|
15914
|
-
|
|
15915
|
-
if (ready) {
|
|
15916
|
-
swiperRef.current.moving = false;
|
|
15917
|
-
}
|
|
15918
|
-
active3 = _active;
|
|
15917
|
+
activeRef.current = _active;
|
|
15919
15918
|
setRect(rects);
|
|
15920
15919
|
setOffset(targetOffset);
|
|
15920
|
+
setChildOffset(new Array(childCount).fill(0));
|
|
15921
|
+
swiperRef.current.moving = true;
|
|
15922
|
+
setStyle(targetOffset, rects);
|
|
15923
|
+
swiperRef.current.moving = false;
|
|
15921
15924
|
setReady(true);
|
|
15922
15925
|
return [
|
|
15923
15926
|
2
|
|
@@ -15928,7 +15931,6 @@
|
|
|
15928
15931
|
};
|
|
15929
15932
|
React.useEffect(function() {
|
|
15930
15933
|
if (ready) {
|
|
15931
|
-
stopAutoPlay();
|
|
15932
15934
|
autoplay();
|
|
15933
15935
|
}
|
|
15934
15936
|
return function() {
|
|
@@ -15938,17 +15940,18 @@
|
|
|
15938
15940
|
ready
|
|
15939
15941
|
]);
|
|
15940
15942
|
React.useEffect(function() {
|
|
15941
|
-
if (isVertical && children) {
|
|
15942
|
-
init();
|
|
15943
|
+
if (isVertical && children && isContainerReady) {
|
|
15943
15944
|
stopAutoPlay();
|
|
15944
|
-
|
|
15945
|
+
setReady(false);
|
|
15946
|
+
init();
|
|
15945
15947
|
}
|
|
15946
15948
|
}, [
|
|
15947
15949
|
children,
|
|
15948
|
-
|
|
15950
|
+
isContainerReady
|
|
15949
15951
|
]);
|
|
15950
15952
|
var stopAutoPlay = function() {
|
|
15951
15953
|
clearTimeout(swiperRef.current.autoplayTimer);
|
|
15954
|
+
swiperRef.current.moving = false;
|
|
15952
15955
|
swiperRef.current.autoplayTimer = null;
|
|
15953
15956
|
};
|
|
15954
15957
|
var autoplay = function() {
|
|
@@ -15964,21 +15967,24 @@
|
|
|
15964
15967
|
if (childCount <= 1) return;
|
|
15965
15968
|
var targetActive = getActive(pace);
|
|
15966
15969
|
var targetOffset = getOffset(targetActive, offset2);
|
|
15967
|
-
|
|
15968
|
-
var
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
|
|
15970
|
+
setChildOffset(function(prevChildOffset) {
|
|
15971
|
+
var newChildOffset = _to_consumable_array(prevChildOffset);
|
|
15972
|
+
if (Array.isArray(children) && children[0] && targetOffset !== minOffset) {
|
|
15973
|
+
var rightBound = targetOffset < minOffset;
|
|
15974
|
+
newChildOffset[0] = rightBound ? trackSize : 0;
|
|
15975
|
+
}
|
|
15976
|
+
if (Array.isArray(children) && children[childCount - 1] && targetOffset !== 0) {
|
|
15977
|
+
var leftBound = targetOffset > 0;
|
|
15978
|
+
newChildOffset[childCount - 1] = leftBound ? -trackSize : 0;
|
|
15979
|
+
}
|
|
15980
|
+
return newChildOffset;
|
|
15981
|
+
});
|
|
15982
|
+
activeRef.current = targetActive;
|
|
15977
15983
|
setOffset(targetOffset);
|
|
15978
|
-
|
|
15984
|
+
setStyle(targetOffset);
|
|
15979
15985
|
};
|
|
15980
15986
|
var next = function() {
|
|
15981
|
-
|
|
15987
|
+
resetPosition();
|
|
15982
15988
|
requestFrame(function() {
|
|
15983
15989
|
requestFrame(function() {
|
|
15984
15990
|
swiperRef.current.moving = false;
|
|
@@ -15991,15 +15997,16 @@
|
|
|
15991
15997
|
var handleItemClick = function(event, value2) {
|
|
15992
15998
|
onItemClick && onItemClick(event, value2);
|
|
15993
15999
|
};
|
|
15994
|
-
var
|
|
15995
|
-
var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset;
|
|
16000
|
+
var setStyle = function() {
|
|
16001
|
+
var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset, currentRect = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : rect;
|
|
15996
16002
|
var target = innerRef.current;
|
|
15997
16003
|
if (!target) {
|
|
15998
16004
|
return;
|
|
15999
16005
|
}
|
|
16000
16006
|
var _offset = 0;
|
|
16001
|
-
var
|
|
16002
|
-
|
|
16007
|
+
var containerHeight = (currentRect === null || currentRect === void 0 ? void 0 : currentRect.height) || height2;
|
|
16008
|
+
var val2 = containerHeight - Number(height2);
|
|
16009
|
+
_offset = moveOffset + Number(activeRef.current === childCount - 1 && val2 / 2);
|
|
16003
16010
|
target.style.transitionDuration = "".concat(swiperRef.current.moving ? 0 : duration, "ms");
|
|
16004
16011
|
target.style.height = "".concat(Number(height2) * (childCount + 1), "px");
|
|
16005
16012
|
target.style.transform = "translate3D(0,".concat(_offset, "px,0)");
|
|
@@ -16017,15 +16024,16 @@
|
|
|
16017
16024
|
return style2;
|
|
16018
16025
|
};
|
|
16019
16026
|
var getActive = function(pace) {
|
|
16027
|
+
var currentActive = activeRef.current;
|
|
16020
16028
|
if (pace) {
|
|
16021
|
-
var _active =
|
|
16029
|
+
var _active = currentActive + pace;
|
|
16022
16030
|
return range2(_active, -1, childCount);
|
|
16023
16031
|
}
|
|
16024
|
-
return
|
|
16032
|
+
return currentActive;
|
|
16025
16033
|
};
|
|
16026
|
-
var getOffset = function(
|
|
16034
|
+
var getOffset = function(active2) {
|
|
16027
16035
|
var offset2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
16028
|
-
var currentPosition =
|
|
16036
|
+
var currentPosition = active2 * Number(height2);
|
|
16029
16037
|
var targetOffset = offset2 - currentPosition;
|
|
16030
16038
|
return targetOffset;
|
|
16031
16039
|
};
|
|
@@ -16035,14 +16043,15 @@
|
|
|
16035
16043
|
var range2 = function(num, min, max) {
|
|
16036
16044
|
return Math.min(Math.max(num, min), max);
|
|
16037
16045
|
};
|
|
16038
|
-
var
|
|
16046
|
+
var resetPosition = function() {
|
|
16047
|
+
var currentActive = activeRef.current;
|
|
16039
16048
|
swiperRef.current.moving = true;
|
|
16040
|
-
if (
|
|
16049
|
+
if (currentActive <= -1) {
|
|
16041
16050
|
move({
|
|
16042
16051
|
pace: childCount
|
|
16043
16052
|
});
|
|
16044
16053
|
}
|
|
16045
|
-
if (
|
|
16054
|
+
if (currentActive >= childCount) {
|
|
16046
16055
|
move({
|
|
16047
16056
|
pace: -childCount
|
|
16048
16057
|
});
|
|
@@ -16056,6 +16065,20 @@
|
|
|
16056
16065
|
stopAutoPlay();
|
|
16057
16066
|
};
|
|
16058
16067
|
}, []);
|
|
16068
|
+
var hasVerticalContent = React.useMemo(function() {
|
|
16069
|
+
if (!isVertical) return false;
|
|
16070
|
+
if (children) return (childs === null || childs === void 0 ? void 0 : childs.length) > 0;
|
|
16071
|
+
return (list === null || list === void 0 ? void 0 : list.length) > 0;
|
|
16072
|
+
}, [
|
|
16073
|
+
isVertical,
|
|
16074
|
+
childs,
|
|
16075
|
+
list,
|
|
16076
|
+
children
|
|
16077
|
+
]);
|
|
16078
|
+
var containerRefCallback = React.useCallback(function(ref) {
|
|
16079
|
+
container.current = ref;
|
|
16080
|
+
setIsContainerReady(true);
|
|
16081
|
+
}, []);
|
|
16059
16082
|
return /* @__PURE__ */ React.createElement(components.View, {
|
|
16060
16083
|
className: cls,
|
|
16061
16084
|
style
|
|
@@ -16080,10 +16103,10 @@
|
|
|
16080
16103
|
onClick: onClickIcon
|
|
16081
16104
|
}, rightIcon || /* @__PURE__ */ React.createElement(IconSVG$p, {
|
|
16082
16105
|
size: 12
|
|
16083
|
-
})) : null) : null, showNoticeBar &&
|
|
16106
|
+
})) : null) : null, showNoticeBar && hasVerticalContent && isVertical ? /* @__PURE__ */ React.createElement(components.View, {
|
|
16084
16107
|
className: "nut-noticebar-vertical",
|
|
16085
16108
|
style: barStyle,
|
|
16086
|
-
ref:
|
|
16109
|
+
ref: containerRefCallback,
|
|
16087
16110
|
onClick: handleClick
|
|
16088
16111
|
}, leftIcon ? /* @__PURE__ */ React.createElement(components.View, {
|
|
16089
16112
|
className: "nut-noticebar-box-left-icon"
|
|
@@ -18778,6 +18801,12 @@
|
|
|
18778
18801
|
}, [
|
|
18779
18802
|
children
|
|
18780
18803
|
]);
|
|
18804
|
+
React.useEffect(function() {
|
|
18805
|
+
setInnerValue(current || defaultValue);
|
|
18806
|
+
}, [
|
|
18807
|
+
defaultValue,
|
|
18808
|
+
current
|
|
18809
|
+
]);
|
|
18781
18810
|
var renderIndicator = function() {
|
|
18782
18811
|
if (/* @__PURE__ */ React.isValidElement(indicator)) return indicator;
|
|
18783
18812
|
if (indicator || indicatorDots) {
|
|
@@ -18886,7 +18915,27 @@
|
|
|
18886
18915
|
}
|
|
18887
18916
|
});
|
|
18888
18917
|
var ImagePreview = function(props) {
|
|
18889
|
-
var
|
|
18918
|
+
var _mergeProps = mergeProps(defaultProps$h, props), value2 = _mergeProps.value, className = _mergeProps.className, style = _mergeProps.style, images = _mergeProps.images, videos = _mergeProps.videos, visible = _mergeProps.visible, defaultValue = _mergeProps.defaultValue, indicatorColor = _mergeProps.indicatorColor, pagination = _mergeProps.pagination, indicator = _mergeProps.indicator, autoPlay = _mergeProps.autoPlay, loop = _mergeProps.loop, closeOnContentClick = _mergeProps.closeOnContentClick, closeIcon = _mergeProps.closeIcon, closeIconPosition = _mergeProps.closeIconPosition, showMenuByLongpress = _mergeProps.showMenuByLongpress, onClose = _mergeProps.onClose, onChange = _mergeProps.onChange;
|
|
18919
|
+
_object_without_properties(_mergeProps, [
|
|
18920
|
+
"value",
|
|
18921
|
+
"className",
|
|
18922
|
+
"style",
|
|
18923
|
+
"images",
|
|
18924
|
+
"videos",
|
|
18925
|
+
"visible",
|
|
18926
|
+
"defaultValue",
|
|
18927
|
+
"indicatorColor",
|
|
18928
|
+
"pagination",
|
|
18929
|
+
"indicator",
|
|
18930
|
+
"autoPlay",
|
|
18931
|
+
"loop",
|
|
18932
|
+
"closeOnContentClick",
|
|
18933
|
+
"closeIcon",
|
|
18934
|
+
"closeIconPosition",
|
|
18935
|
+
"showMenuByLongpress",
|
|
18936
|
+
"onClose",
|
|
18937
|
+
"onChange"
|
|
18938
|
+
]);
|
|
18890
18939
|
var classPrefix2 = "nut-imagepreview";
|
|
18891
18940
|
var ref = React.useRef(null);
|
|
18892
18941
|
var _usePropsValue = _sliced_to_array(usePropsValue({
|
|
@@ -19017,9 +19066,10 @@
|
|
|
19017
19066
|
onTouchEnd,
|
|
19018
19067
|
onTouchCancel: onTouchEnd
|
|
19019
19068
|
}, /* @__PURE__ */ React.createElement(InnerSwiper, {
|
|
19020
|
-
autoPlay,
|
|
19069
|
+
autoplay: autoPlay,
|
|
19070
|
+
loop,
|
|
19071
|
+
direction: "horizontal",
|
|
19021
19072
|
className: "".concat(classPrefix2, "-swiper"),
|
|
19022
|
-
loop: true,
|
|
19023
19073
|
height: "100%",
|
|
19024
19074
|
style: {
|
|
19025
19075
|
display: showPop ? "block" : "none",
|
|
@@ -19027,7 +19077,6 @@
|
|
|
19027
19077
|
width: "100%",
|
|
19028
19078
|
height: "100%"
|
|
19029
19079
|
},
|
|
19030
|
-
direction: "horizontal",
|
|
19031
19080
|
onChange: function(e) {
|
|
19032
19081
|
return slideChangeEnd(e.detail.current);
|
|
19033
19082
|
},
|