@nutui/nutui-react 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 CHANGED
@@ -1,21 +1,29 @@
1
- # v3.0.15
2
- `2025-06-27`
1
+ # v3.0.16
2
+ `2025-07-04`
3
+
4
+
5
+ * :bug: fix(calendar): 类型修订 (#3292)
6
+ * :bug: fix(swiper): 修改初始值时不生效问题 (#3293)
7
+ * :bug: fix(noticebar): children cannot update responsively in vertical mode (#3251)
3
8
 
4
9
 
5
- * 📖 docs(checkbox): 修订数据类型 (#3273)
6
- * :sparkles: feat(dialog): close和cancel各司其职 (#3282)
7
- * :sparkles: feat(calendarcard): 增加自定义头 (#3285)
8
- * :sparkles: feat(calendarcard): 对函数做了优化处理 (#3284)
9
- * :bug: fix(configprovider): 修订路径别名 (#3287)
10
- * :bug: fix(form): 单测错误修复 (#3286)
11
- * :bug: fix(noticebar): first item is not visible when scrolling vertically (#3249)
12
- * :bug: fix(form): 修复右侧星星无法展示的问题 (#3283)
13
- * :bug: fix(form): label无法修改字号 (#3280)
14
- * :bug: fix: remove -zIndex CSS variable due to lower priority and default value confusion (#3262)
15
- * :bug: fix(button): 禁用样式修订 (#3279)
16
- * :bug: fix(datepicker): 修改不设置事件类型的返回值 (#3270)
17
- * :bug: fix(pickerview): 修改快速滚动偶现滑动错位问题 (#3278)
10
+ # v3.0.15
11
+
12
+ `2025-06-27`
18
13
 
14
+ - 📖 docs(checkbox): 修订数据类型 (#3273)
15
+ - :sparkles: feat(dialog): close和cancel各司其职 (#3282)
16
+ - :sparkles: feat(calendarcard): 增加自定义头 (#3285)
17
+ - :sparkles: feat(calendarcard): 对函数做了优化处理 (#3284)
18
+ - :bug: fix(configprovider): 修订路径别名 (#3287)
19
+ - :bug: fix(form): 单测错误修复 (#3286)
20
+ - :bug: fix(noticebar): first item is not visible when scrolling vertically (#3249)
21
+ - :bug: fix(form): 修复右侧星星无法展示的问题 (#3283)
22
+ - :bug: fix(form): label无法修改字号 (#3280)
23
+ - :bug: fix: remove -zIndex CSS variable due to lower priority and default value confusion (#3262)
24
+ - :bug: fix(button): 禁用样式修订 (#3279)
25
+ - :bug: fix(datepicker): 修改不设置事件类型的返回值 (#3270)
26
+ - :bug: fix(pickerview): 修改快速滚动偶现滑动错位问题 (#3278)
19
27
 
20
28
  # v3.0.14
21
29
 
@@ -29,7 +29,7 @@ export interface CalendarItemProps extends PopupProps {
29
29
  renderDayBottom: (date: CalendarDay) => string | JSX.Element;
30
30
  onConfirm: (data: string) => void;
31
31
  onUpdate: () => void;
32
- onDayClick: (data: string) => void;
32
+ onDayClick: (data: string[]) => void;
33
33
  onPageChange: (data: any) => void;
34
34
  }
35
35
  export declare const CalendarItem: React.ForwardRefExoticComponent<Partial<CalendarItemProps> & Omit<React.HTMLAttributes<HTMLDivElement>, ""> & React.RefAttributes<CalendarRef>>;
@@ -45,10 +45,10 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
45
45
  renderDay: undefined,
46
46
  renderDayTop: undefined,
47
47
  renderDayBottom: undefined,
48
- onConfirm: function onConfirm(data) {},
48
+ onConfirm: function onConfirm() {},
49
49
  onUpdate: function onUpdate() {},
50
- onDayClick: function onDayClick(data) {},
51
- onPageChange: function onPageChange(data) {}
50
+ onDayClick: function onDayClick() {},
51
+ onPageChange: function onPageChange() {}
52
52
  });
53
53
  var CalendarItem = /*#__PURE__*/ _react.default.forwardRef(function(props, ref) {
54
54
  var locale = (0, _configprovider.useConfig)().locale;
@@ -12,6 +12,7 @@ var _interop_require_default = require("@swc/helpers/_/_interop_require_default"
12
12
  var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
13
  var _object_spread = require("@swc/helpers/_/_object_spread");
14
14
  var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
15
+ var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
15
16
  var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
16
17
  var _to_consumable_array = require("@swc/helpers/_/_to_consumable_array");
17
18
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -24,6 +25,7 @@ var _swiper = /*#__PURE__*/ _interop_require_default._(require("../swiper"));
24
25
  var _swiperitem = /*#__PURE__*/ _interop_require_default._(require("../swiperitem"));
25
26
  var _typings = require("../../utils/typings");
26
27
  var _usepropsvalue = require("../../hooks/use-props-value");
28
+ var _utils = require("../../utils");
27
29
  var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
28
30
  images: [],
29
31
  videos: [],
@@ -40,7 +42,24 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
40
42
  onClose: function onClose() {}
41
43
  });
42
44
  var ImagePreview = function ImagePreview(props) {
43
- var _$_object_spread = (0, _object_spread._)({}, defaultProps, props), value = _$_object_spread.value, className = _$_object_spread.className, style = _$_object_spread.style, images = _$_object_spread.images, videos = _$_object_spread.videos, visible = _$_object_spread.visible, defaultValue = _$_object_spread.defaultValue, indicatorColor = _$_object_spread.indicatorColor, pagination = _$_object_spread.pagination, indicator = _$_object_spread.indicator, autoPlay = _$_object_spread.autoPlay, closeOnContentClick = _$_object_spread.closeOnContentClick, closeIcon = _$_object_spread.closeIcon, closeIconPosition = _$_object_spread.closeIconPosition, onClose = _$_object_spread.onClose, onChange = _$_object_spread.onChange;
45
+ var _mergeProps = (0, _utils.mergeProps)(defaultProps, props), value = _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, closeOnContentClick = _mergeProps.closeOnContentClick, closeIcon = _mergeProps.closeIcon, closeIconPosition = _mergeProps.closeIconPosition, onClose = _mergeProps.onClose, onChange = _mergeProps.onChange, rest = (0, _object_without_properties._)(_mergeProps, [
46
+ "value",
47
+ "className",
48
+ "style",
49
+ "images",
50
+ "videos",
51
+ "visible",
52
+ "defaultValue",
53
+ "indicatorColor",
54
+ "pagination",
55
+ "indicator",
56
+ "autoPlay",
57
+ "closeOnContentClick",
58
+ "closeIcon",
59
+ "closeIconPosition",
60
+ "onClose",
61
+ "onChange"
62
+ ]);
44
63
  var classPrefix = 'nut-imagepreview';
45
64
  var ref = (0, _react.useRef)(null);
46
65
  var _usePropsValue = (0, _sliced_to_array._)((0, _usepropsvalue.usePropsValue)({
@@ -179,21 +198,18 @@ var ImagePreview = function ImagePreview(props) {
179
198
  style: style,
180
199
  ref: ref,
181
200
  onTouchStart: onTouchStart
182
- }, showPop && /*#__PURE__*/ _react.default.createElement(_swiper.default, {
183
- autoPlay: !!duration,
184
- duration: duration,
201
+ }, showPop && /*#__PURE__*/ _react.default.createElement(_swiper.default, (0, _object_spread._)({
202
+ autoplay: !!duration,
185
203
  className: "".concat(classPrefix, "-swiper"),
186
- loop: true,
187
204
  style: {
188
205
  '--nutui-indicator-color': indicatorColor
189
206
  },
190
- direction: "horizontal",
191
207
  onChange: function onChange(page) {
192
208
  return slideChangeEnd(page);
193
209
  },
194
210
  defaultValue: innerNo > maxNo ? maxNo - 1 : innerNo - 1,
195
211
  indicator: indicator
196
- }, (0, _to_consumable_array._)(videos.map(function(item) {
212
+ }, rest), (0, _to_consumable_array._)(videos.map(function(item) {
197
213
  return {
198
214
  type: 'video',
199
215
  data: item
@@ -14,6 +14,7 @@ var _define_property = require("@swc/helpers/_/_define_property");
14
14
  var _object_spread = require("@swc/helpers/_/_object_spread");
15
15
  var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
16
16
  var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
17
+ var _to_consumable_array = require("@swc/helpers/_/_to_consumable_array");
17
18
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
18
19
  var _iconsreact = require("@nutui/icons-react");
19
20
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
@@ -57,9 +58,10 @@ var NoticeBar = function NoticeBar(props) {
57
58
  var _useState8 = (0, _sliced_to_array._)((0, _react.useState)(null), 2), isCanScroll = _useState8[0], SetIsCanScroll = _useState8[1];
58
59
  var isVertical = direction === 'vertical';
59
60
  var _useState9 = (0, _sliced_to_array._)((0, _react.useState)(null), 2), rect = _useState9[0], setRect = _useState9[1];
60
- var active = 0;
61
+ var activeRef = (0, _react.useRef)(0);
61
62
  var _useState10 = (0, _sliced_to_array._)((0, _react.useState)(false), 2), ready = _useState10[0], setReady = _useState10[1];
62
63
  var container = (0, _react.useRef)(null);
64
+ var _useState11 = (0, _sliced_to_array._)((0, _react.useState)(false), 2), isContainerReady = _useState11[0], setIsContainerReady = _useState11[1];
63
65
  var innerRef = (0, _react.useRef)(null);
64
66
  var swiperRef = (0, _react.useRef)({
65
67
  moving: false,
@@ -69,8 +71,8 @@ var NoticeBar = function NoticeBar(props) {
69
71
  offset: 0,
70
72
  size: 0
71
73
  });
72
- var _useState11 = (0, _sliced_to_array._)((0, _react.useState)([]), 2), childOffset = _useState11[0], setChildOffset = _useState11[1];
73
- var _useState12 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), offset = _useState12[0], setOffset = _useState12[1];
74
+ var _useState12 = (0, _sliced_to_array._)((0, _react.useState)([]), 2), childOffset = _useState12[0], setChildOffset = _useState12[1];
75
+ var _useState13 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), offset = _useState13[0], setOffset = _useState13[1];
74
76
  var _useMemo = (0, _react.useMemo)(function() {
75
77
  var childCount = 0;
76
78
  var childs = _react.default.Children.map(children, function(child) {
@@ -110,7 +112,9 @@ var NoticeBar = function NoticeBar(props) {
110
112
  // 销毁事件
111
113
  clearInterval(timer);
112
114
  };
113
- }, []);
115
+ }, [
116
+ childs
117
+ ]);
114
118
  (0, _react.useEffect)(function() {
115
119
  initScrollWrap(content);
116
120
  }, [
@@ -208,24 +212,24 @@ var NoticeBar = function NoticeBar(props) {
208
212
  };
209
213
  // 垂直自定义滚动方式
210
214
  var init = function init() {
211
- var active = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : +0;
215
+ var activeIndex = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
212
216
  var rects = (0, _getrect.getRect)(container === null || container === void 0 ? void 0 : container.current);
213
- var _active = Math.max(Math.min(childCount - 1, active), 0);
217
+ var _active = Math.max(Math.min(childCount - 1, activeIndex), 0);
214
218
  var _height = rects.height;
215
219
  trackSize = childCount * Number(_height);
216
220
  var targetOffset = getOffset(_active);
217
- swiperRef.current.moving = true;
218
- if (ready) {
219
- swiperRef.current.moving = false;
220
- }
221
- active = _active;
221
+ activeRef.current = _active;
222
222
  setRect(rects);
223
223
  setOffset(targetOffset);
224
+ setChildOffset(new Array(childCount).fill(0));
225
+ // 关闭动画并立即设置样式
226
+ swiperRef.current.moving = true;
227
+ setStyle(targetOffset, rects);
228
+ swiperRef.current.moving = false;
224
229
  setReady(true);
225
230
  };
226
231
  (0, _react.useEffect)(function() {
227
232
  if (ready) {
228
- stopAutoPlay();
229
233
  autoplay();
230
234
  }
231
235
  return function() {
@@ -235,18 +239,19 @@ var NoticeBar = function NoticeBar(props) {
235
239
  ready
236
240
  ]);
237
241
  (0, _react.useEffect)(function() {
238
- if (isVertical && children) {
239
- init();
242
+ if (isVertical && children && isContainerReady) {
240
243
  stopAutoPlay();
241
- autoplay();
244
+ setReady(false);
245
+ init();
242
246
  }
243
247
  }, [
244
248
  children,
245
- container === null || container === void 0 ? void 0 : container.current
249
+ isContainerReady
246
250
  ]);
247
251
  // 清除定时器
248
252
  var stopAutoPlay = function stopAutoPlay() {
249
253
  clearTimeout(swiperRef.current.autoplayTimer);
254
+ swiperRef.current.moving = false;
250
255
  swiperRef.current.autoplayTimer = null;
251
256
  };
252
257
  // 定时轮播
@@ -266,22 +271,25 @@ var NoticeBar = function NoticeBar(props) {
266
271
  // 父级容器偏移量
267
272
  var targetOffset = getOffset(targetActive, offset);
268
273
  // 循环滚动,调整开头结尾图片位置
269
- if (Array.isArray(children) && children[0] && targetOffset !== minOffset) {
270
- var rightBound = targetOffset < minOffset;
271
- childOffset[0] = rightBound ? trackSize : 0;
272
- }
273
- if (Array.isArray(children) && children[childCount - 1] && targetOffset !== 0) {
274
- var leftBound = targetOffset > 0;
275
- childOffset[childCount - 1] = leftBound ? -trackSize : 0;
276
- }
277
- setChildOffset(childOffset);
278
- active = targetActive;
274
+ setChildOffset(function(prevChildOffset) {
275
+ var newChildOffset = (0, _to_consumable_array._)(prevChildOffset);
276
+ if (Array.isArray(children) && children[0] && targetOffset !== minOffset) {
277
+ var rightBound = targetOffset < minOffset;
278
+ newChildOffset[0] = rightBound ? trackSize : 0;
279
+ }
280
+ if (Array.isArray(children) && children[childCount - 1] && targetOffset !== 0) {
281
+ var leftBound = targetOffset > 0;
282
+ newChildOffset[childCount - 1] = leftBound ? -trackSize : 0;
283
+ }
284
+ return newChildOffset;
285
+ });
286
+ activeRef.current = targetActive;
279
287
  setOffset(targetOffset);
280
- getStyle(targetOffset);
288
+ setStyle(targetOffset);
281
289
  };
282
290
  // 下一页
283
291
  var next = function next() {
284
- resettPosition();
292
+ resetPosition();
285
293
  requestFrame(function() {
286
294
  requestFrame(function() {
287
295
  swiperRef.current.moving = false;
@@ -294,16 +302,17 @@ var NoticeBar = function NoticeBar(props) {
294
302
  var handleItemClick = function handleItemClick(event, value) {
295
303
  onItemClick && onItemClick(event, value);
296
304
  };
297
- var getStyle = function getStyle() {
298
- var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset;
305
+ var setStyle = function setStyle() {
306
+ var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset, currentRect = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : rect;
299
307
  var target = innerRef.current;
300
308
  if (!target) {
301
309
  return;
302
310
  }
303
311
  var _offset = 0;
304
- // 容器高度-元素高度
305
- var val = rect.height - height;
306
- _offset = moveOffset + Number(active === childCount - 1 && val / 2);
312
+ // 使用传入的 currentRect 或状态中的 rect
313
+ var containerHeight = (currentRect === null || currentRect === void 0 ? void 0 : currentRect.height) || height;
314
+ var val = containerHeight - Number(height);
315
+ _offset = moveOffset + Number(activeRef.current === childCount - 1 && val / 2);
307
316
  target.style.transitionDuration = "".concat(swiperRef.current.moving ? 0 : duration, "ms");
308
317
  target.style.height = "".concat(Number(height) * (childCount + 1), "px");
309
318
  target.style.transform = "translate3D(0,".concat(_offset, "px,0)");
@@ -323,11 +332,12 @@ var NoticeBar = function NoticeBar(props) {
323
332
  };
324
333
  // 确定当前active 元素
325
334
  var getActive = function getActive(pace) {
335
+ var currentActive = activeRef.current;
326
336
  if (pace) {
327
- var _active = active + pace;
337
+ var _active = currentActive + pace;
328
338
  return range(_active, -1, childCount);
329
339
  }
330
- return active;
340
+ return currentActive;
331
341
  };
332
342
  // 计算位移
333
343
  var getOffset = function getOffset(active) {
@@ -345,14 +355,15 @@ var NoticeBar = function NoticeBar(props) {
345
355
  return Math.min(Math.max(num, min), max);
346
356
  };
347
357
  // 重置首尾位置信息
348
- var resettPosition = function resettPosition() {
358
+ var resetPosition = function resetPosition() {
359
+ var currentActive = activeRef.current;
349
360
  swiperRef.current.moving = true;
350
- if (active <= -1) {
361
+ if (currentActive <= -1) {
351
362
  move({
352
363
  pace: childCount
353
364
  });
354
365
  }
355
- if (active >= childCount) {
366
+ if (currentActive >= childCount) {
356
367
  move({
357
368
  pace: -childCount
358
369
  });
@@ -366,6 +377,20 @@ var NoticeBar = function NoticeBar(props) {
366
377
  stopAutoPlay();
367
378
  };
368
379
  }, []);
380
+ var hasVerticalContent = (0, _react.useMemo)(function() {
381
+ if (!isVertical) return false;
382
+ if (children) return (childs === null || childs === void 0 ? void 0 : childs.length) > 0;
383
+ return (list === null || list === void 0 ? void 0 : list.length) > 0;
384
+ }, [
385
+ isVertical,
386
+ childs,
387
+ list,
388
+ children
389
+ ]);
390
+ var containerRefCallback = (0, _react.useCallback)(function(ref) {
391
+ container.current = ref;
392
+ setIsContainerReady(true);
393
+ }, []);
369
394
  return /*#__PURE__*/ _react.default.createElement("div", {
370
395
  className: cls,
371
396
  style: style
@@ -391,10 +416,10 @@ var NoticeBar = function NoticeBar(props) {
391
416
  }, rightIcon || /*#__PURE__*/ _react.default.createElement(_iconsreact.Close, {
392
417
  width: 12,
393
418
  height: 12
394
- })) : null) : null, showNoticeBar && scrollList.current.length > 0 && isVertical ? /*#__PURE__*/ _react.default.createElement("div", {
419
+ })) : null) : null, showNoticeBar && hasVerticalContent && isVertical ? /*#__PURE__*/ _react.default.createElement("div", {
395
420
  className: "nut-noticebar-vertical",
396
421
  style: barStyle,
397
- ref: container,
422
+ ref: containerRefCallback,
398
423
  onClick: handleClick
399
424
  }, leftIcon ? /*#__PURE__*/ _react.default.createElement("div", {
400
425
  className: "nut-noticebar-box-left-icon"
@@ -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;
@@ -43,7 +45,7 @@ export interface BaseCalendar {
43
45
  renderDayBottom?: (date: CalendarDay) => string | JSX.Element;
44
46
  onClose: () => void;
45
47
  onConfirm: (param: string) => void;
46
- onDayClick: (data: string) => void;
48
+ onDayClick: (data: string[]) => void;
47
49
  onPageChange: (param: string) => void;
48
50
  }
49
51
  export interface BaseCalendarItem extends BaseProps {
@@ -1,3 +1,6 @@
1
1
  import { BaseImagePreview } from './base';
2
- export interface WebImagePreviewProps extends BaseImagePreview {
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
- export interface TaroImagePreviewProps extends Omit<BaseImagePreview, 'autoPlay'> {
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 {};
@@ -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
- preYear: number;
64
- preMonth: number;
63
+ year: number;
64
+ month: number;
65
65
  }[];
@@ -250,8 +250,8 @@ var getPreMonthDates = function getPreMonthDates(type, year, month, firstDayOfWe
250
250
  return {
251
251
  day: k + 1,
252
252
  type: type,
253
- preYear: preYear,
254
- preMonth: preMonth
253
+ year: preYear,
254
+ month: preMonth
255
255
  };
256
256
  });
257
257
  return months.slice(preDates - days);
@@ -29,7 +29,7 @@ export interface CalendarItemProps extends PopupProps {
29
29
  renderDayBottom: (date: CalendarDay) => string | JSX.Element;
30
30
  onConfirm: (data: string) => void;
31
31
  onUpdate: () => void;
32
- onDayClick: (data: string) => void;
32
+ onDayClick: (data: string[]) => void;
33
33
  onPageChange: (data: any) => void;
34
34
  }
35
35
  export declare const CalendarItem: React.ForwardRefExoticComponent<Partial<CalendarItemProps> & Omit<React.HTMLAttributes<HTMLDivElement>, ""> & React.RefAttributes<CalendarRef>>;
@@ -33,10 +33,10 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
33
33
  renderDay: undefined,
34
34
  renderDayTop: undefined,
35
35
  renderDayBottom: undefined,
36
- onConfirm: function(data) {},
36
+ onConfirm: function() {},
37
37
  onUpdate: function() {},
38
- onDayClick: function(data) {},
39
- onPageChange: function(data) {}
38
+ onDayClick: function() {},
39
+ onPageChange: function() {}
40
40
  });
41
41
  export var CalendarItem = /*#__PURE__*/ React.forwardRef(function(props, ref) {
42
42
  var locale = useConfig().locale;
@@ -1,5 +1,6 @@
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
+ import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
3
4
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
4
5
  import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
5
6
  import React, { useEffect, useRef, useState } from "react";
@@ -12,6 +13,7 @@ import Swiper from "../swiper";
12
13
  import SwiperItem from "../swiperitem";
13
14
  import { ComponentDefaults } from "../../utils/typings";
14
15
  import { usePropsValue } from "../../hooks/use-props-value";
16
+ import { mergeProps } from "../../utils";
15
17
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
16
18
  images: [],
17
19
  videos: [],
@@ -28,7 +30,24 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
28
30
  onClose: function() {}
29
31
  });
30
32
  export var ImagePreview = function(props) {
31
- var _$_object_spread = _object_spread({}, defaultProps, props), value = _$_object_spread.value, className = _$_object_spread.className, style = _$_object_spread.style, images = _$_object_spread.images, videos = _$_object_spread.videos, visible = _$_object_spread.visible, defaultValue = _$_object_spread.defaultValue, indicatorColor = _$_object_spread.indicatorColor, pagination = _$_object_spread.pagination, indicator = _$_object_spread.indicator, autoPlay = _$_object_spread.autoPlay, closeOnContentClick = _$_object_spread.closeOnContentClick, closeIcon = _$_object_spread.closeIcon, closeIconPosition = _$_object_spread.closeIconPosition, onClose = _$_object_spread.onClose, onChange = _$_object_spread.onChange;
33
+ var _mergeProps = mergeProps(defaultProps, props), value = _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, closeOnContentClick = _mergeProps.closeOnContentClick, closeIcon = _mergeProps.closeIcon, closeIconPosition = _mergeProps.closeIconPosition, onClose = _mergeProps.onClose, onChange = _mergeProps.onChange, rest = _object_without_properties(_mergeProps, [
34
+ "value",
35
+ "className",
36
+ "style",
37
+ "images",
38
+ "videos",
39
+ "visible",
40
+ "defaultValue",
41
+ "indicatorColor",
42
+ "pagination",
43
+ "indicator",
44
+ "autoPlay",
45
+ "closeOnContentClick",
46
+ "closeIcon",
47
+ "closeIconPosition",
48
+ "onClose",
49
+ "onChange"
50
+ ]);
32
51
  var classPrefix = 'nut-imagepreview';
33
52
  var ref = useRef(null);
34
53
  var _usePropsValue = _sliced_to_array(usePropsValue({
@@ -167,21 +186,18 @@ export var ImagePreview = function(props) {
167
186
  style: style,
168
187
  ref: ref,
169
188
  onTouchStart: onTouchStart
170
- }, showPop && /*#__PURE__*/ React.createElement(Swiper, {
171
- autoPlay: !!duration,
172
- duration: duration,
189
+ }, showPop && /*#__PURE__*/ React.createElement(Swiper, _object_spread({
190
+ autoplay: !!duration,
173
191
  className: "".concat(classPrefix, "-swiper"),
174
- loop: true,
175
192
  style: {
176
193
  '--nutui-indicator-color': indicatorColor
177
194
  },
178
- direction: "horizontal",
179
195
  onChange: function(page) {
180
196
  return slideChangeEnd(page);
181
197
  },
182
198
  defaultValue: innerNo > maxNo ? maxNo - 1 : innerNo - 1,
183
199
  indicator: indicator
184
- }, _to_consumable_array(videos.map(function(item) {
200
+ }, rest), _to_consumable_array(videos.map(function(item) {
185
201
  return {
186
202
  type: 'video',
187
203
  data: item