@nutui/nutui-react 2.6.12 → 2.6.14

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.6.12 Fri Jul 05 2024 14:48:13 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.6.14 Fri Jul 19 2024 16:21:28 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -9627,7 +9627,7 @@ const InternalCascader = (props, ref) => {
9627
9627
  };
9628
9628
  const syncValue = async () => {
9629
9629
  const currentValue = innerValue;
9630
- if (currentValue === void 0 || currentValue !== defaultValue || !state.tree.nodes.length) {
9630
+ if (currentValue === void 0 || ![defaultValue, value].includes(currentValue) || !state.tree.nodes.length) {
9631
9631
  return;
9632
9632
  }
9633
9633
  if (currentValue.length === 0) {
@@ -9659,7 +9659,7 @@ const InternalCascader = (props, ref) => {
9659
9659
  state.initLoading = false;
9660
9660
  }
9661
9661
  }
9662
- if (needToSync.length && currentValue === defaultValue) {
9662
+ if (needToSync.length && [defaultValue, value].includes(currentValue)) {
9663
9663
  const pathNodes = state.tree.getPathNodesByValue(needToSync);
9664
9664
  pathNodes.forEach((node, index) => {
9665
9665
  state.tabsCursor = index;
@@ -10722,6 +10722,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10722
10722
  }
10723
10723
  const scrollTop = e2.target.scrollTop;
10724
10724
  let current = Math.floor(scrollTop / avgHeight);
10725
+ if (current < 0) return;
10725
10726
  if (!monthsData[current + 1]) return;
10726
10727
  const nextTop = monthsData[current + 1].scrollTop;
10727
10728
  const nextHeight = monthsData[current + 1].cssHeight;
@@ -13681,7 +13682,7 @@ class FormStore {
13681
13682
  this.store = values;
13682
13683
  }
13683
13684
  };
13684
- this.setFieldsValue = (newStore) => {
13685
+ this.setFieldsValue = (newStore, needValidate = true) => {
13685
13686
  this.store = {
13686
13687
  ...this.store,
13687
13688
  ...newStore
@@ -13703,7 +13704,7 @@ class FormStore {
13703
13704
  item.entity.onStoreChange("update");
13704
13705
  }
13705
13706
  });
13706
- this.validateFields();
13707
+ needValidate && this.validateFields();
13707
13708
  };
13708
13709
  this.setCallback = (callback) => {
13709
13710
  this.callbacks = {
@@ -13948,7 +13949,7 @@ const _FormItem = class _FormItem extends React__default.Component {
13948
13949
  if (this.props.getValueFromEvent) {
13949
13950
  next = this.props.getValueFromEvent(...args);
13950
13951
  }
13951
- setFieldsValue({ [name]: next });
13952
+ setFieldsValue({ [name]: next }, false);
13952
13953
  }
13953
13954
  };
13954
13955
  const { validateTrigger } = this.props;
@@ -14708,7 +14709,7 @@ const MenuItem = forwardRef((props, ref) => {
14708
14709
  handleClick2(item);
14709
14710
  }
14710
14711
  },
14711
- item.value === innerValue ? /* @__PURE__ */ React__default.createElement("i", null, icon || /* @__PURE__ */ React__default.createElement(
14712
+ item.value === innerValue ? /* @__PURE__ */ React__default.createElement("i", { className: "nut-menu-container-item-icon" }, icon || /* @__PURE__ */ React__default.createElement(
14712
14713
  o$5,
14713
14714
  {
14714
14715
  color: activeColor,
@@ -14718,7 +14719,7 @@ const MenuItem = forwardRef((props, ref) => {
14718
14719
  /* @__PURE__ */ React__default.createElement(
14719
14720
  "div",
14720
14721
  {
14721
- className: getIconCName(item.value, value),
14722
+ className: `nut-menu-container-item-title ${getIconCName(item.value, value)}`,
14722
14723
  style: {
14723
14724
  color: `${item.value === innerValue ? activeColor : ""}`
14724
14725
  }
@@ -17383,7 +17384,18 @@ const defaultProps$D = {
17383
17384
  }
17384
17385
  };
17385
17386
  const Drag = (props) => {
17386
- const { attract, direction, boundary, children, className, style, ...reset } = {
17387
+ const {
17388
+ attract,
17389
+ direction,
17390
+ boundary,
17391
+ onDrag,
17392
+ onDragStart,
17393
+ onDragEnd,
17394
+ children,
17395
+ className,
17396
+ style,
17397
+ ...reset
17398
+ } = {
17387
17399
  ...defaultProps$D,
17388
17400
  ...props
17389
17401
  };
@@ -17414,7 +17426,16 @@ const Drag = (props) => {
17414
17426
  }
17415
17427
  };
17416
17428
  const bind = useDrag(
17417
- ({ down, last, offset: [x, y] }) => {
17429
+ (state) => {
17430
+ const {
17431
+ down,
17432
+ last,
17433
+ offset: [x, y],
17434
+ first
17435
+ } = state;
17436
+ first && (onDragStart == null ? void 0 : onDragStart());
17437
+ onDrag == null ? void 0 : onDrag({ offset: [x, y] });
17438
+ last && (onDragEnd == null ? void 0 : onDragEnd({ offset: [x, y] }));
17418
17439
  api.start({ x, y, immediate: down });
17419
17440
  if (last) {
17420
17441
  if (direction !== "y" && attract) {
@@ -20569,15 +20590,17 @@ const getPerSlidePosition$1 = (index, position, loop2, count) => {
20569
20590
  const defaultEffect = (args) => {
20570
20591
  return React__default.Children.map(args.children, (child, index) => {
20571
20592
  const { isVertical, getSpringsAxis, loop: loop2, count } = args;
20593
+ const rtl = useRtl();
20594
+ const position = rtl ? "right" : "left";
20572
20595
  return /* @__PURE__ */ React__default.createElement(
20573
20596
  animated.div,
20574
20597
  {
20575
20598
  className: "nut-swiper-slide",
20576
20599
  style: {
20577
- [isVertical ? "y" : "x"]: getSpringsAxis().to((position) => {
20578
- return getPerSlidePosition$1(index, position, loop2, count);
20600
+ [isVertical ? "y" : "x"]: getSpringsAxis().to((position2) => {
20601
+ return getPerSlidePosition$1(index, position2, loop2, count);
20579
20602
  }),
20580
- [isVertical ? "top" : "left"]: `-${index * 100}%`
20603
+ [isVertical ? "top" : position]: `-${index * 100}%`
20581
20604
  }
20582
20605
  },
20583
20606
  child
@@ -20597,6 +20620,8 @@ const getPerSlidePosition = (index, position, loop2, count) => {
20597
20620
  };
20598
20621
  const focusEffect = (args) => {
20599
20622
  return React__default.Children.map(args.children, (child, index) => {
20623
+ const rtl = useRtl();
20624
+ const position = rtl ? "right" : "left";
20600
20625
  const {
20601
20626
  isVertical,
20602
20627
  springs,
@@ -20614,11 +20639,11 @@ const focusEffect = (args) => {
20614
20639
  className: "nut-swiper-slide",
20615
20640
  style: {
20616
20641
  [isVertical ? "y" : "x"]: springs[isVertical ? "y" : "x"].to(
20617
- (position) => {
20618
- return getPerSlidePosition(index, position, loop2, count);
20642
+ (position2) => {
20643
+ return getPerSlidePosition(index, position2, loop2, count);
20619
20644
  }
20620
20645
  ),
20621
- [isVertical ? "top" : "left"]: `-${index * 100}%`,
20646
+ [isVertical ? "top" : position]: `-${index * 100}%`,
20622
20647
  scale: springs.s.to((ss) => {
20623
20648
  const scales = getRefValue(transforms);
20624
20649
  if (!scales) return 1;
@@ -21131,7 +21156,6 @@ const ImagePreview = (props) => {
21131
21156
  className: classNames(classPrefix2, className),
21132
21157
  style,
21133
21158
  ref,
21134
- onClick: closeOnImg,
21135
21159
  onTouchStart
21136
21160
  },
21137
21161
  showPop ? /* @__PURE__ */ React__default.createElement(
@@ -21150,10 +21174,24 @@ const ImagePreview = (props) => {
21150
21174
  indicator
21151
21175
  },
21152
21176
  (videos && videos.length > 0 ? videos.map((item, index) => {
21153
- return /* @__PURE__ */ React__default.createElement(SwiperItem, { key: index }, /* @__PURE__ */ React__default.createElement(Video, { source: item.source, options: item.options }));
21177
+ return /* @__PURE__ */ React__default.createElement(SwiperItem, { key: index }, /* @__PURE__ */ React__default.createElement(
21178
+ Video,
21179
+ {
21180
+ source: item.source,
21181
+ options: item.options,
21182
+ onClick: closeOnImg
21183
+ }
21184
+ ));
21154
21185
  }) : []).concat(
21155
21186
  images && images.length > 0 ? images.map((item, index) => {
21156
- return /* @__PURE__ */ React__default.createElement(SwiperItem, { key: index }, /* @__PURE__ */ React__default.createElement(Image$1, { src: item.src, draggable: false }));
21187
+ return /* @__PURE__ */ React__default.createElement(SwiperItem, { key: index }, /* @__PURE__ */ React__default.createElement(
21188
+ Image$1,
21189
+ {
21190
+ src: item.src,
21191
+ draggable: false,
21192
+ onClick: closeOnImg
21193
+ }
21194
+ ));
21157
21195
  }) : []
21158
21196
  )
21159
21197
  ) : null
@@ -2,7 +2,7 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.nutui = {}, global2.React, global2.ReactDOM));
3
3
  })(this, function(exports2, React, ReactDOM) {
4
4
  "use strict";/*!
5
- * @nutui/nutui-react v2.6.12 Fri Jul 05 2024 14:48:13 GMT+0800 (China Standard Time)
5
+ * @nutui/nutui-react v2.6.14 Fri Jul 19 2024 16:21:28 GMT+0800 (China Standard Time)
6
6
  * (c) 2023 @jdf2e.
7
7
  * Released under the MIT License.
8
8
  */
@@ -9645,7 +9645,7 @@
9645
9645
  };
9646
9646
  const syncValue = async () => {
9647
9647
  const currentValue = innerValue;
9648
- if (currentValue === void 0 || currentValue !== defaultValue || !state.tree.nodes.length) {
9648
+ if (currentValue === void 0 || ![defaultValue, value].includes(currentValue) || !state.tree.nodes.length) {
9649
9649
  return;
9650
9650
  }
9651
9651
  if (currentValue.length === 0) {
@@ -9677,7 +9677,7 @@
9677
9677
  state.initLoading = false;
9678
9678
  }
9679
9679
  }
9680
- if (needToSync.length && currentValue === defaultValue) {
9680
+ if (needToSync.length && [defaultValue, value].includes(currentValue)) {
9681
9681
  const pathNodes = state.tree.getPathNodesByValue(needToSync);
9682
9682
  pathNodes.forEach((node, index) => {
9683
9683
  state.tabsCursor = index;
@@ -10740,6 +10740,7 @@
10740
10740
  }
10741
10741
  const scrollTop = e2.target.scrollTop;
10742
10742
  let current = Math.floor(scrollTop / avgHeight);
10743
+ if (current < 0) return;
10743
10744
  if (!monthsData[current + 1]) return;
10744
10745
  const nextTop = monthsData[current + 1].scrollTop;
10745
10746
  const nextHeight = monthsData[current + 1].cssHeight;
@@ -13699,7 +13700,7 @@
13699
13700
  this.store = values;
13700
13701
  }
13701
13702
  };
13702
- this.setFieldsValue = (newStore) => {
13703
+ this.setFieldsValue = (newStore, needValidate = true) => {
13703
13704
  this.store = {
13704
13705
  ...this.store,
13705
13706
  ...newStore
@@ -13721,7 +13722,7 @@
13721
13722
  item.entity.onStoreChange("update");
13722
13723
  }
13723
13724
  });
13724
- this.validateFields();
13725
+ needValidate && this.validateFields();
13725
13726
  };
13726
13727
  this.setCallback = (callback) => {
13727
13728
  this.callbacks = {
@@ -13966,7 +13967,7 @@
13966
13967
  if (this.props.getValueFromEvent) {
13967
13968
  next = this.props.getValueFromEvent(...args);
13968
13969
  }
13969
- setFieldsValue({ [name]: next });
13970
+ setFieldsValue({ [name]: next }, false);
13970
13971
  }
13971
13972
  };
13972
13973
  const { validateTrigger } = this.props;
@@ -14726,7 +14727,7 @@
14726
14727
  handleClick2(item);
14727
14728
  }
14728
14729
  },
14729
- item.value === innerValue ? /* @__PURE__ */ React.createElement("i", null, icon || /* @__PURE__ */ React.createElement(
14730
+ item.value === innerValue ? /* @__PURE__ */ React.createElement("i", { className: "nut-menu-container-item-icon" }, icon || /* @__PURE__ */ React.createElement(
14730
14731
  o$5,
14731
14732
  {
14732
14733
  color: activeColor,
@@ -14736,7 +14737,7 @@
14736
14737
  /* @__PURE__ */ React.createElement(
14737
14738
  "div",
14738
14739
  {
14739
- className: getIconCName(item.value, value),
14740
+ className: `nut-menu-container-item-title ${getIconCName(item.value, value)}`,
14740
14741
  style: {
14741
14742
  color: `${item.value === innerValue ? activeColor : ""}`
14742
14743
  }
@@ -17401,7 +17402,18 @@
17401
17402
  }
17402
17403
  };
17403
17404
  const Drag = (props) => {
17404
- const { attract, direction, boundary, children, className, style, ...reset } = {
17405
+ const {
17406
+ attract,
17407
+ direction,
17408
+ boundary,
17409
+ onDrag,
17410
+ onDragStart,
17411
+ onDragEnd,
17412
+ children,
17413
+ className,
17414
+ style,
17415
+ ...reset
17416
+ } = {
17405
17417
  ...defaultProps$D,
17406
17418
  ...props
17407
17419
  };
@@ -17432,7 +17444,16 @@
17432
17444
  }
17433
17445
  };
17434
17446
  const bind = useDrag(
17435
- ({ down, last, offset: [x, y] }) => {
17447
+ (state) => {
17448
+ const {
17449
+ down,
17450
+ last,
17451
+ offset: [x, y],
17452
+ first
17453
+ } = state;
17454
+ first && (onDragStart == null ? void 0 : onDragStart());
17455
+ onDrag == null ? void 0 : onDrag({ offset: [x, y] });
17456
+ last && (onDragEnd == null ? void 0 : onDragEnd({ offset: [x, y] }));
17436
17457
  api.start({ x, y, immediate: down });
17437
17458
  if (last) {
17438
17459
  if (direction !== "y" && attract) {
@@ -20587,15 +20608,17 @@
20587
20608
  const defaultEffect = (args) => {
20588
20609
  return React.Children.map(args.children, (child, index) => {
20589
20610
  const { isVertical, getSpringsAxis, loop: loop2, count } = args;
20611
+ const rtl = useRtl();
20612
+ const position = rtl ? "right" : "left";
20590
20613
  return /* @__PURE__ */ React.createElement(
20591
20614
  animated.div,
20592
20615
  {
20593
20616
  className: "nut-swiper-slide",
20594
20617
  style: {
20595
- [isVertical ? "y" : "x"]: getSpringsAxis().to((position) => {
20596
- return getPerSlidePosition$1(index, position, loop2, count);
20618
+ [isVertical ? "y" : "x"]: getSpringsAxis().to((position2) => {
20619
+ return getPerSlidePosition$1(index, position2, loop2, count);
20597
20620
  }),
20598
- [isVertical ? "top" : "left"]: `-${index * 100}%`
20621
+ [isVertical ? "top" : position]: `-${index * 100}%`
20599
20622
  }
20600
20623
  },
20601
20624
  child
@@ -20615,6 +20638,8 @@
20615
20638
  };
20616
20639
  const focusEffect = (args) => {
20617
20640
  return React.Children.map(args.children, (child, index) => {
20641
+ const rtl = useRtl();
20642
+ const position = rtl ? "right" : "left";
20618
20643
  const {
20619
20644
  isVertical,
20620
20645
  springs,
@@ -20632,11 +20657,11 @@
20632
20657
  className: "nut-swiper-slide",
20633
20658
  style: {
20634
20659
  [isVertical ? "y" : "x"]: springs[isVertical ? "y" : "x"].to(
20635
- (position) => {
20636
- return getPerSlidePosition(index, position, loop2, count);
20660
+ (position2) => {
20661
+ return getPerSlidePosition(index, position2, loop2, count);
20637
20662
  }
20638
20663
  ),
20639
- [isVertical ? "top" : "left"]: `-${index * 100}%`,
20664
+ [isVertical ? "top" : position]: `-${index * 100}%`,
20640
20665
  scale: springs.s.to((ss) => {
20641
20666
  const scales = getRefValue(transforms);
20642
20667
  if (!scales) return 1;
@@ -21149,7 +21174,6 @@
21149
21174
  className: classNames(classPrefix2, className),
21150
21175
  style,
21151
21176
  ref,
21152
- onClick: closeOnImg,
21153
21177
  onTouchStart
21154
21178
  },
21155
21179
  showPop ? /* @__PURE__ */ React.createElement(
@@ -21168,10 +21192,24 @@
21168
21192
  indicator
21169
21193
  },
21170
21194
  (videos && videos.length > 0 ? videos.map((item, index) => {
21171
- return /* @__PURE__ */ React.createElement(SwiperItem, { key: index }, /* @__PURE__ */ React.createElement(Video, { source: item.source, options: item.options }));
21195
+ return /* @__PURE__ */ React.createElement(SwiperItem, { key: index }, /* @__PURE__ */ React.createElement(
21196
+ Video,
21197
+ {
21198
+ source: item.source,
21199
+ options: item.options,
21200
+ onClick: closeOnImg
21201
+ }
21202
+ ));
21172
21203
  }) : []).concat(
21173
21204
  images && images.length > 0 ? images.map((item, index) => {
21174
- return /* @__PURE__ */ React.createElement(SwiperItem, { key: index }, /* @__PURE__ */ React.createElement(Image$1, { src: item.src, draggable: false }));
21205
+ return /* @__PURE__ */ React.createElement(SwiperItem, { key: index }, /* @__PURE__ */ React.createElement(
21206
+ Image$1,
21207
+ {
21208
+ src: item.src,
21209
+ draggable: false,
21210
+ onClick: closeOnImg
21211
+ }
21212
+ ));
21175
21213
  }) : []
21176
21214
  )
21177
21215
  ) : null
@@ -5,7 +5,7 @@
5
5
  flex-direction: column;
6
6
  justify-content: center;
7
7
  padding: $empty-padding;
8
- background-color: $color-background-overlay;
8
+ background-color: $empty-background-color;
9
9
 
10
10
  &-image {
11
11
  width: $empty-image-size;
@@ -11,6 +11,7 @@
11
11
  user-select: none;
12
12
  overflow: hidden;
13
13
  background: $tabs-titles-background-color;
14
+ scrollbar-width: none;
14
15
 
15
16
  &::-webkit-scrollbar {
16
17
  display: none;