@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.
@@ -2,7 +2,8 @@ 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, { useEffect, useMemo, useRef, useState } from "react";
5
+ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
6
+ import React, { useEffect, useMemo, useRef, useState, useCallback } from "react";
6
7
  import { Close, Notice } from "@nutui/icons-react";
7
8
  import classNames from "classnames";
8
9
  import { getRect } from "../../utils/get-rect";
@@ -45,9 +46,10 @@ export var NoticeBar = function(props) {
45
46
  var _useState8 = _sliced_to_array(useState(null), 2), isCanScroll = _useState8[0], SetIsCanScroll = _useState8[1];
46
47
  var isVertical = direction === 'vertical';
47
48
  var _useState9 = _sliced_to_array(useState(null), 2), rect = _useState9[0], setRect = _useState9[1];
48
- var active = 0;
49
+ var activeRef = useRef(0);
49
50
  var _useState10 = _sliced_to_array(useState(false), 2), ready = _useState10[0], setReady = _useState10[1];
50
51
  var container = useRef(null);
52
+ var _useState11 = _sliced_to_array(useState(false), 2), isContainerReady = _useState11[0], setIsContainerReady = _useState11[1];
51
53
  var innerRef = useRef(null);
52
54
  var swiperRef = useRef({
53
55
  moving: false,
@@ -57,8 +59,8 @@ export var NoticeBar = function(props) {
57
59
  offset: 0,
58
60
  size: 0
59
61
  });
60
- var _useState11 = _sliced_to_array(useState([]), 2), childOffset = _useState11[0], setChildOffset = _useState11[1];
61
- var _useState12 = _sliced_to_array(useState(0), 2), offset = _useState12[0], setOffset = _useState12[1];
62
+ var _useState12 = _sliced_to_array(useState([]), 2), childOffset = _useState12[0], setChildOffset = _useState12[1];
63
+ var _useState13 = _sliced_to_array(useState(0), 2), offset = _useState13[0], setOffset = _useState13[1];
62
64
  var _useMemo = useMemo(function() {
63
65
  var childCount = 0;
64
66
  var childs = React.Children.map(children, function(child) {
@@ -98,7 +100,9 @@ export var NoticeBar = function(props) {
98
100
  // 销毁事件
99
101
  clearInterval(timer);
100
102
  };
101
- }, []);
103
+ }, [
104
+ childs
105
+ ]);
102
106
  useEffect(function() {
103
107
  initScrollWrap(content);
104
108
  }, [
@@ -196,24 +200,24 @@ export var NoticeBar = function(props) {
196
200
  };
197
201
  // 垂直自定义滚动方式
198
202
  var init = function() {
199
- var active = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : +0;
203
+ var activeIndex = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
200
204
  var rects = getRect(container === null || container === void 0 ? void 0 : container.current);
201
- var _active = Math.max(Math.min(childCount - 1, active), 0);
205
+ var _active = Math.max(Math.min(childCount - 1, activeIndex), 0);
202
206
  var _height = rects.height;
203
207
  trackSize = childCount * Number(_height);
204
208
  var targetOffset = getOffset(_active);
205
- swiperRef.current.moving = true;
206
- if (ready) {
207
- swiperRef.current.moving = false;
208
- }
209
- active = _active;
209
+ activeRef.current = _active;
210
210
  setRect(rects);
211
211
  setOffset(targetOffset);
212
+ setChildOffset(new Array(childCount).fill(0));
213
+ // 关闭动画并立即设置样式
214
+ swiperRef.current.moving = true;
215
+ setStyle(targetOffset, rects);
216
+ swiperRef.current.moving = false;
212
217
  setReady(true);
213
218
  };
214
219
  useEffect(function() {
215
220
  if (ready) {
216
- stopAutoPlay();
217
221
  autoplay();
218
222
  }
219
223
  return function() {
@@ -223,18 +227,19 @@ export var NoticeBar = function(props) {
223
227
  ready
224
228
  ]);
225
229
  useEffect(function() {
226
- if (isVertical && children) {
227
- init();
230
+ if (isVertical && children && isContainerReady) {
228
231
  stopAutoPlay();
229
- autoplay();
232
+ setReady(false);
233
+ init();
230
234
  }
231
235
  }, [
232
236
  children,
233
- container === null || container === void 0 ? void 0 : container.current
237
+ isContainerReady
234
238
  ]);
235
239
  // 清除定时器
236
240
  var stopAutoPlay = function() {
237
241
  clearTimeout(swiperRef.current.autoplayTimer);
242
+ swiperRef.current.moving = false;
238
243
  swiperRef.current.autoplayTimer = null;
239
244
  };
240
245
  // 定时轮播
@@ -254,22 +259,25 @@ export var NoticeBar = function(props) {
254
259
  // 父级容器偏移量
255
260
  var targetOffset = getOffset(targetActive, offset);
256
261
  // 循环滚动,调整开头结尾图片位置
257
- if (Array.isArray(children) && children[0] && targetOffset !== minOffset) {
258
- var rightBound = targetOffset < minOffset;
259
- childOffset[0] = rightBound ? trackSize : 0;
260
- }
261
- if (Array.isArray(children) && children[childCount - 1] && targetOffset !== 0) {
262
- var leftBound = targetOffset > 0;
263
- childOffset[childCount - 1] = leftBound ? -trackSize : 0;
264
- }
265
- setChildOffset(childOffset);
266
- active = targetActive;
262
+ setChildOffset(function(prevChildOffset) {
263
+ var newChildOffset = _to_consumable_array(prevChildOffset);
264
+ if (Array.isArray(children) && children[0] && targetOffset !== minOffset) {
265
+ var rightBound = targetOffset < minOffset;
266
+ newChildOffset[0] = rightBound ? trackSize : 0;
267
+ }
268
+ if (Array.isArray(children) && children[childCount - 1] && targetOffset !== 0) {
269
+ var leftBound = targetOffset > 0;
270
+ newChildOffset[childCount - 1] = leftBound ? -trackSize : 0;
271
+ }
272
+ return newChildOffset;
273
+ });
274
+ activeRef.current = targetActive;
267
275
  setOffset(targetOffset);
268
- getStyle(targetOffset);
276
+ setStyle(targetOffset);
269
277
  };
270
278
  // 下一页
271
279
  var next = function() {
272
- resettPosition();
280
+ resetPosition();
273
281
  requestFrame(function() {
274
282
  requestFrame(function() {
275
283
  swiperRef.current.moving = false;
@@ -282,16 +290,17 @@ export var NoticeBar = function(props) {
282
290
  var handleItemClick = function(event, value) {
283
291
  onItemClick && onItemClick(event, value);
284
292
  };
285
- var getStyle = function() {
286
- var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset;
293
+ var setStyle = function() {
294
+ var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset, currentRect = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : rect;
287
295
  var target = innerRef.current;
288
296
  if (!target) {
289
297
  return;
290
298
  }
291
299
  var _offset = 0;
292
- // 容器高度-元素高度
293
- var val = rect.height - height;
294
- _offset = moveOffset + Number(active === childCount - 1 && val / 2);
300
+ // 使用传入的 currentRect 或状态中的 rect
301
+ var containerHeight = (currentRect === null || currentRect === void 0 ? void 0 : currentRect.height) || height;
302
+ var val = containerHeight - Number(height);
303
+ _offset = moveOffset + Number(activeRef.current === childCount - 1 && val / 2);
295
304
  target.style.transitionDuration = "".concat(swiperRef.current.moving ? 0 : duration, "ms");
296
305
  target.style.height = "".concat(Number(height) * (childCount + 1), "px");
297
306
  target.style.transform = "translate3D(0,".concat(_offset, "px,0)");
@@ -311,11 +320,12 @@ export var NoticeBar = function(props) {
311
320
  };
312
321
  // 确定当前active 元素
313
322
  var getActive = function(pace) {
323
+ var currentActive = activeRef.current;
314
324
  if (pace) {
315
- var _active = active + pace;
325
+ var _active = currentActive + pace;
316
326
  return range(_active, -1, childCount);
317
327
  }
318
- return active;
328
+ return currentActive;
319
329
  };
320
330
  // 计算位移
321
331
  var getOffset = function(active) {
@@ -333,14 +343,15 @@ export var NoticeBar = function(props) {
333
343
  return Math.min(Math.max(num, min), max);
334
344
  };
335
345
  // 重置首尾位置信息
336
- var resettPosition = function() {
346
+ var resetPosition = function() {
347
+ var currentActive = activeRef.current;
337
348
  swiperRef.current.moving = true;
338
- if (active <= -1) {
349
+ if (currentActive <= -1) {
339
350
  move({
340
351
  pace: childCount
341
352
  });
342
353
  }
343
- if (active >= childCount) {
354
+ if (currentActive >= childCount) {
344
355
  move({
345
356
  pace: -childCount
346
357
  });
@@ -354,6 +365,20 @@ export var NoticeBar = function(props) {
354
365
  stopAutoPlay();
355
366
  };
356
367
  }, []);
368
+ var hasVerticalContent = useMemo(function() {
369
+ if (!isVertical) return false;
370
+ if (children) return (childs === null || childs === void 0 ? void 0 : childs.length) > 0;
371
+ return (list === null || list === void 0 ? void 0 : list.length) > 0;
372
+ }, [
373
+ isVertical,
374
+ childs,
375
+ list,
376
+ children
377
+ ]);
378
+ var containerRefCallback = useCallback(function(ref) {
379
+ container.current = ref;
380
+ setIsContainerReady(true);
381
+ }, []);
357
382
  return /*#__PURE__*/ React.createElement("div", {
358
383
  className: cls,
359
384
  style: style
@@ -379,10 +404,10 @@ export var NoticeBar = function(props) {
379
404
  }, rightIcon || /*#__PURE__*/ React.createElement(Close, {
380
405
  width: 12,
381
406
  height: 12
382
- })) : null) : null, showNoticeBar && scrollList.current.length > 0 && isVertical ? /*#__PURE__*/ React.createElement("div", {
407
+ })) : null) : null, showNoticeBar && hasVerticalContent && isVertical ? /*#__PURE__*/ React.createElement("div", {
383
408
  className: "nut-noticebar-vertical",
384
409
  style: barStyle,
385
- ref: container,
410
+ ref: containerRefCallback,
386
411
  onClick: handleClick
387
412
  }, leftIcon ? /*#__PURE__*/ React.createElement("div", {
388
413
  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;
@@ -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
- 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
  }[];
@@ -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
- preYear: preYear,
233
- preMonth: preMonth
232
+ year: preYear,
233
+ month: preMonth
234
234
  };
235
235
  });
236
236
  return months.slice(preDates - days);
@@ -2077,8 +2077,8 @@ Check the top-level render call using <` + t + ">.");
2077
2077
  return {
2078
2078
  day: k + 1,
2079
2079
  type: type2,
2080
- preYear,
2081
- preMonth
2080
+ year: preYear,
2081
+ month: preMonth
2082
2082
  };
2083
2083
  });
2084
2084
  return months.slice(preDates - days);
@@ -12730,13 +12730,13 @@ Please add \`${key2}Action\` when creating your handler.`);
12730
12730
  renderDay: void 0,
12731
12731
  renderDayTop: void 0,
12732
12732
  renderDayBottom: void 0,
12733
- onConfirm: function(data2) {
12733
+ onConfirm: function() {
12734
12734
  },
12735
12735
  onUpdate: function() {
12736
12736
  },
12737
- onDayClick: function(data2) {
12737
+ onDayClick: function() {
12738
12738
  },
12739
- onPageChange: function(data2) {
12739
+ onPageChange: function() {
12740
12740
  }
12741
12741
  });
12742
12742
  var CalendarItem = /* @__PURE__ */ React.forwardRef(function(props, ref) {
@@ -20884,9 +20884,10 @@ Please add \`${key2}Action\` when creating your handler.`);
20884
20884
  var _useState8 = _sliced_to_array(React.useState(null), 2), isCanScroll = _useState8[0], SetIsCanScroll = _useState8[1];
20885
20885
  var isVertical = direction === "vertical";
20886
20886
  var _useState9 = _sliced_to_array(React.useState(null), 2), rect = _useState9[0], setRect = _useState9[1];
20887
- var active2 = 0;
20887
+ var activeRef = React.useRef(0);
20888
20888
  var _useState10 = _sliced_to_array(React.useState(false), 2), ready = _useState10[0], setReady = _useState10[1];
20889
20889
  var container = React.useRef(null);
20890
+ var _useState11 = _sliced_to_array(React.useState(false), 2), isContainerReady = _useState11[0], setIsContainerReady = _useState11[1];
20890
20891
  var innerRef = React.useRef(null);
20891
20892
  var swiperRef = React.useRef({
20892
20893
  moving: false,
@@ -20896,8 +20897,8 @@ Please add \`${key2}Action\` when creating your handler.`);
20896
20897
  offset: 0,
20897
20898
  size: 0
20898
20899
  });
20899
- var _useState11 = _sliced_to_array(React.useState([]), 2), childOffset = _useState11[0], setChildOffset = _useState11[1];
20900
- var _useState12 = _sliced_to_array(React.useState(0), 2), offset = _useState12[0], setOffset = _useState12[1];
20900
+ var _useState12 = _sliced_to_array(React.useState([]), 2), childOffset = _useState12[0], setChildOffset = _useState12[1];
20901
+ var _useState13 = _sliced_to_array(React.useState(0), 2), offset = _useState13[0], setOffset = _useState13[1];
20901
20902
  var _useMemo = React.useMemo(function() {
20902
20903
  var childCount2 = 0;
20903
20904
  var childs2 = React.Children.map(children, function(child) {
@@ -20934,7 +20935,9 @@ Please add \`${key2}Action\` when creating your handler.`);
20934
20935
  return function() {
20935
20936
  clearInterval(timer);
20936
20937
  };
20937
- }, []);
20938
+ }, [
20939
+ childs
20940
+ ]);
20938
20941
  React.useEffect(function() {
20939
20942
  initScrollWrap();
20940
20943
  }, [
@@ -21027,24 +21030,23 @@ Please add \`${key2}Action\` when creating your handler.`);
21027
21030
  marginTop: animate ? "-".concat(height2, "px") : ""
21028
21031
  };
21029
21032
  var init = function() {
21030
- var active3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
21033
+ var activeIndex = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
21031
21034
  var rects = getRect(container === null || container === void 0 ? void 0 : container.current);
21032
- var _active = Math.max(Math.min(childCount - 1, active3), 0);
21035
+ var _active = Math.max(Math.min(childCount - 1, activeIndex), 0);
21033
21036
  var _height = rects.height;
21034
21037
  trackSize = childCount * Number(_height);
21035
21038
  var targetOffset = getOffset(_active);
21036
- swiperRef.current.moving = true;
21037
- if (ready) {
21038
- swiperRef.current.moving = false;
21039
- }
21040
- active3 = _active;
21039
+ activeRef.current = _active;
21041
21040
  setRect(rects);
21042
21041
  setOffset(targetOffset);
21042
+ setChildOffset(new Array(childCount).fill(0));
21043
+ swiperRef.current.moving = true;
21044
+ setStyle(targetOffset, rects);
21045
+ swiperRef.current.moving = false;
21043
21046
  setReady(true);
21044
21047
  };
21045
21048
  React.useEffect(function() {
21046
21049
  if (ready) {
21047
- stopAutoPlay();
21048
21050
  autoplay();
21049
21051
  }
21050
21052
  return function() {
@@ -21054,17 +21056,18 @@ Please add \`${key2}Action\` when creating your handler.`);
21054
21056
  ready
21055
21057
  ]);
21056
21058
  React.useEffect(function() {
21057
- if (isVertical && children) {
21058
- init();
21059
+ if (isVertical && children && isContainerReady) {
21059
21060
  stopAutoPlay();
21060
- autoplay();
21061
+ setReady(false);
21062
+ init();
21061
21063
  }
21062
21064
  }, [
21063
21065
  children,
21064
- container === null || container === void 0 ? void 0 : container.current
21066
+ isContainerReady
21065
21067
  ]);
21066
21068
  var stopAutoPlay = function() {
21067
21069
  clearTimeout(swiperRef.current.autoplayTimer);
21070
+ swiperRef.current.moving = false;
21068
21071
  swiperRef.current.autoplayTimer = null;
21069
21072
  };
21070
21073
  var autoplay = function() {
@@ -21080,21 +21083,24 @@ Please add \`${key2}Action\` when creating your handler.`);
21080
21083
  if (childCount <= 1) return;
21081
21084
  var targetActive = getActive(pace);
21082
21085
  var targetOffset = getOffset(targetActive, offset2);
21083
- if (Array.isArray(children) && children[0] && targetOffset !== minOffset) {
21084
- var rightBound = targetOffset < minOffset;
21085
- childOffset[0] = rightBound ? trackSize : 0;
21086
- }
21087
- if (Array.isArray(children) && children[childCount - 1] && targetOffset !== 0) {
21088
- var leftBound = targetOffset > 0;
21089
- childOffset[childCount - 1] = leftBound ? -trackSize : 0;
21090
- }
21091
- setChildOffset(childOffset);
21092
- active2 = targetActive;
21086
+ setChildOffset(function(prevChildOffset) {
21087
+ var newChildOffset = _to_consumable_array(prevChildOffset);
21088
+ if (Array.isArray(children) && children[0] && targetOffset !== minOffset) {
21089
+ var rightBound = targetOffset < minOffset;
21090
+ newChildOffset[0] = rightBound ? trackSize : 0;
21091
+ }
21092
+ if (Array.isArray(children) && children[childCount - 1] && targetOffset !== 0) {
21093
+ var leftBound = targetOffset > 0;
21094
+ newChildOffset[childCount - 1] = leftBound ? -trackSize : 0;
21095
+ }
21096
+ return newChildOffset;
21097
+ });
21098
+ activeRef.current = targetActive;
21093
21099
  setOffset(targetOffset);
21094
- getStyle(targetOffset);
21100
+ setStyle(targetOffset);
21095
21101
  };
21096
21102
  var next = function() {
21097
- resettPosition();
21103
+ resetPosition();
21098
21104
  requestFrame(function() {
21099
21105
  requestFrame(function() {
21100
21106
  swiperRef.current.moving = false;
@@ -21107,15 +21113,16 @@ Please add \`${key2}Action\` when creating your handler.`);
21107
21113
  var handleItemClick = function(event, value2) {
21108
21114
  onItemClick && onItemClick(event, value2);
21109
21115
  };
21110
- var getStyle = function() {
21111
- var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset;
21116
+ var setStyle = function() {
21117
+ var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset, currentRect = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : rect;
21112
21118
  var target = innerRef.current;
21113
21119
  if (!target) {
21114
21120
  return;
21115
21121
  }
21116
21122
  var _offset = 0;
21117
- var val2 = rect.height - height2;
21118
- _offset = moveOffset + Number(active2 === childCount - 1 && val2 / 2);
21123
+ var containerHeight = (currentRect === null || currentRect === void 0 ? void 0 : currentRect.height) || height2;
21124
+ var val2 = containerHeight - Number(height2);
21125
+ _offset = moveOffset + Number(activeRef.current === childCount - 1 && val2 / 2);
21119
21126
  target.style.transitionDuration = "".concat(swiperRef.current.moving ? 0 : duration, "ms");
21120
21127
  target.style.height = "".concat(Number(height2) * (childCount + 1), "px");
21121
21128
  target.style.transform = "translate3D(0,".concat(_offset, "px,0)");
@@ -21133,15 +21140,16 @@ Please add \`${key2}Action\` when creating your handler.`);
21133
21140
  return style2;
21134
21141
  };
21135
21142
  var getActive = function(pace) {
21143
+ var currentActive = activeRef.current;
21136
21144
  if (pace) {
21137
- var _active = active2 + pace;
21145
+ var _active = currentActive + pace;
21138
21146
  return range2(_active, -1, childCount);
21139
21147
  }
21140
- return active2;
21148
+ return currentActive;
21141
21149
  };
21142
- var getOffset = function(active3) {
21150
+ var getOffset = function(active2) {
21143
21151
  var offset2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
21144
- var currentPosition = active3 * Number(height2);
21152
+ var currentPosition = active2 * Number(height2);
21145
21153
  var targetOffset = offset2 - currentPosition;
21146
21154
  return targetOffset;
21147
21155
  };
@@ -21151,14 +21159,15 @@ Please add \`${key2}Action\` when creating your handler.`);
21151
21159
  var range2 = function(num, min, max) {
21152
21160
  return Math.min(Math.max(num, min), max);
21153
21161
  };
21154
- var resettPosition = function() {
21162
+ var resetPosition = function() {
21163
+ var currentActive = activeRef.current;
21155
21164
  swiperRef.current.moving = true;
21156
- if (active2 <= -1) {
21165
+ if (currentActive <= -1) {
21157
21166
  move({
21158
21167
  pace: childCount
21159
21168
  });
21160
21169
  }
21161
- if (active2 >= childCount) {
21170
+ if (currentActive >= childCount) {
21162
21171
  move({
21163
21172
  pace: -childCount
21164
21173
  });
@@ -21172,6 +21181,20 @@ Please add \`${key2}Action\` when creating your handler.`);
21172
21181
  stopAutoPlay();
21173
21182
  };
21174
21183
  }, []);
21184
+ var hasVerticalContent = React.useMemo(function() {
21185
+ if (!isVertical) return false;
21186
+ if (children) return (childs === null || childs === void 0 ? void 0 : childs.length) > 0;
21187
+ return (list === null || list === void 0 ? void 0 : list.length) > 0;
21188
+ }, [
21189
+ isVertical,
21190
+ childs,
21191
+ list,
21192
+ children
21193
+ ]);
21194
+ var containerRefCallback = React.useCallback(function(ref) {
21195
+ container.current = ref;
21196
+ setIsContainerReady(true);
21197
+ }, []);
21175
21198
  return /* @__PURE__ */ React.createElement("div", {
21176
21199
  className: cls,
21177
21200
  style
@@ -21197,10 +21220,10 @@ Please add \`${key2}Action\` when creating your handler.`);
21197
21220
  }, rightIcon || /* @__PURE__ */ React.createElement(n$6, {
21198
21221
  width: 12,
21199
21222
  height: 12
21200
- })) : null) : null, showNoticeBar && scrollList.current.length > 0 && isVertical ? /* @__PURE__ */ React.createElement("div", {
21223
+ })) : null) : null, showNoticeBar && hasVerticalContent && isVertical ? /* @__PURE__ */ React.createElement("div", {
21201
21224
  className: "nut-noticebar-vertical",
21202
21225
  style: barStyle,
21203
- ref: container,
21226
+ ref: containerRefCallback,
21204
21227
  onClick: handleClick
21205
21228
  }, leftIcon ? /* @__PURE__ */ React.createElement("div", {
21206
21229
  className: "nut-noticebar-box-left-icon"
@@ -24307,7 +24330,24 @@ Please add \`${key2}Action\` when creating your handler.`);
24307
24330
  }
24308
24331
  });
24309
24332
  var ImagePreview = function(props) {
24310
- var _$_object_spread = _object_spread({}, defaultProps$g, props), value2 = _$_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;
24333
+ var _mergeProps = mergeProps(defaultProps$g, 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, closeOnContentClick = _mergeProps.closeOnContentClick, closeIcon = _mergeProps.closeIcon, closeIconPosition = _mergeProps.closeIconPosition, onClose = _mergeProps.onClose, onChange = _mergeProps.onChange, rest = _object_without_properties(_mergeProps, [
24334
+ "value",
24335
+ "className",
24336
+ "style",
24337
+ "images",
24338
+ "videos",
24339
+ "visible",
24340
+ "defaultValue",
24341
+ "indicatorColor",
24342
+ "pagination",
24343
+ "indicator",
24344
+ "autoPlay",
24345
+ "closeOnContentClick",
24346
+ "closeIcon",
24347
+ "closeIconPosition",
24348
+ "onClose",
24349
+ "onChange"
24350
+ ]);
24311
24351
  var classPrefix2 = "nut-imagepreview";
24312
24352
  var ref = React.useRef(null);
24313
24353
  var _usePropsValue = _sliced_to_array(usePropsValue({
@@ -24435,21 +24475,18 @@ Please add \`${key2}Action\` when creating your handler.`);
24435
24475
  style,
24436
24476
  ref,
24437
24477
  onTouchStart
24438
- }, showPop && /* @__PURE__ */ React.createElement(InnerSwiper, {
24439
- autoPlay: !!duration,
24440
- duration,
24478
+ }, showPop && /* @__PURE__ */ React.createElement(InnerSwiper, _object_spread({
24479
+ autoplay: !!duration,
24441
24480
  className: "".concat(classPrefix2, "-swiper"),
24442
- loop: true,
24443
24481
  style: {
24444
24482
  "--nutui-indicator-color": indicatorColor
24445
24483
  },
24446
- direction: "horizontal",
24447
24484
  onChange: function(page) {
24448
24485
  return slideChangeEnd(page);
24449
24486
  },
24450
24487
  defaultValue: innerNo > maxNo ? maxNo - 1 : innerNo - 1,
24451
24488
  indicator
24452
- }, _to_consumable_array(videos.map(function(item) {
24489
+ }, rest), _to_consumable_array(videos.map(function(item) {
24453
24490
  return {
24454
24491
  type: "video",
24455
24492
  data: item