@nutui/nutui-react 1.1.4-beta.1 → 1.1.4-beta.2

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.
Files changed (53) hide show
  1. package/dist/esm/Avatar/style/index.js +1 -1
  2. package/dist/esm/Avatar.js +97 -20
  3. package/dist/esm/Barrage.js +0 -1
  4. package/dist/esm/CircleProgress.js +93 -56
  5. package/dist/esm/Skeleton.js +20 -12
  6. package/dist/esm/Step.js +14 -3
  7. package/dist/esm/Steps.js +4 -1
  8. package/dist/esm/Swiper.js +2 -1
  9. package/dist/esm/TabbarItem.js +9 -0
  10. package/dist/esm/Uploader/style/index.js +2 -1
  11. package/dist/esm/Uploader.js +84 -18
  12. package/dist/locales/base.js +1 -1
  13. package/dist/locales/en-US.js +1 -1
  14. package/dist/locales/zh-CN.js +1 -1
  15. package/dist/locales/zh-TW.js +1 -1
  16. package/dist/nutui.react.es.js +299 -110
  17. package/dist/nutui.react.umd.js +12 -12
  18. package/dist/packages/avatar/avatar.scss +16 -6
  19. package/dist/packages/avatargroup/avatargroup.scss +14 -0
  20. package/dist/packages/circleprogress/circleprogress.scss +12 -53
  21. package/dist/packages/configprovider/configprovider.scss +0 -2
  22. package/dist/packages/skeleton/skeleton.scss +1 -3
  23. package/dist/packages/step/step.scss +29 -29
  24. package/dist/packages/uploader/uploader.scss +97 -14
  25. package/dist/style.css +1 -1
  26. package/dist/style.es.js +1 -1
  27. package/dist/styles/themes/default.scss +1 -0
  28. package/dist/styles/variables.scss +36 -4
  29. package/dist/types/avatar/__tests__/avatar.spec.d.ts +1 -0
  30. package/dist/types/avatar/avatar.d.ts +6 -3
  31. package/dist/types/avatargroup/AvatarContext.d.ts +2 -0
  32. package/dist/types/avatargroup/__tests__/avatargroup.spec.d.ts +1 -0
  33. package/dist/types/avatargroup/avatargroup.d.ts +14 -0
  34. package/dist/types/avatargroup/index.d.ts +2 -0
  35. package/dist/types/barrage/__tests__/barrage.spec.d.ts +1 -0
  36. package/dist/types/button/button.d.ts +2 -2
  37. package/dist/types/checkbox/__test__/checkbox.spec.d.ts +1 -0
  38. package/dist/types/circleprogress/__tests__/circleprogress.spec.d.ts +1 -0
  39. package/dist/types/circleprogress/circleprogress.d.ts +11 -5
  40. package/dist/types/icon/__test__/icon.spec.d.ts +1 -0
  41. package/dist/types/infiniteloading/__tests__/infiniteloading.spec.d.ts +1 -0
  42. package/dist/types/inputnumber/__tests__/inputnumber.spec.d.ts +1 -0
  43. package/dist/types/overlay/__tests__/overlay.spec.d.ts +1 -0
  44. package/dist/types/skeleton/__test__/skeleton.spec.d.ts +1 -0
  45. package/dist/types/skeleton/skeleton.d.ts +2 -2
  46. package/dist/types/step/step.d.ts +1 -0
  47. package/dist/types/steps/__tests__/steps.spec.d.ts +1 -0
  48. package/dist/types/steps/steps.d.ts +1 -0
  49. package/dist/types/tabbaritem/tabbaritem.d.ts +1 -0
  50. package/dist/types/uploader/__tests__/uploader.spec.d.ts +1 -0
  51. package/dist/types/uploader/uploader.d.ts +9 -1
  52. package/package.json +6 -3
  53. package/dist/styles/variables-jdw.scss +0 -376
@@ -34,7 +34,7 @@ var __publicField = (obj, key, value) => {
34
34
  return value;
35
35
  };
36
36
  /*!
37
- * @nutui/nutui-react v1.1.4-beta.1 Wed May 11 2022 10:28:15 GMT+0800 (China Standard Time)
37
+ * @nutui/nutui-react v1.1.4-beta.2 Fri May 20 2022 09:38:53 GMT+0800 (China Standard Time)
38
38
  * (c) 2022 @jdf2e.
39
39
  * Released under the MIT License.
40
40
  */
@@ -2618,6 +2618,7 @@ const defaultProps$L = {
2618
2618
  tabTitle: "",
2619
2619
  icon: "",
2620
2620
  href: "",
2621
+ to: "",
2621
2622
  num: "",
2622
2623
  active: false,
2623
2624
  activeColor: "",
@@ -2627,12 +2628,17 @@ const defaultProps$L = {
2627
2628
  }
2628
2629
  };
2629
2630
  const TabbarItem = (props) => {
2630
- const { tabTitle, icon, href, num, active, activeColor, unactiveColor, index: index2, handleClick } = __spreadValues(__spreadValues({}, defaultProps$L), props);
2631
+ const { tabTitle, icon, href, to: to2, num, active, activeColor, unactiveColor, index: index2, handleClick } = __spreadValues(__spreadValues({}, defaultProps$L), props);
2631
2632
  const b2 = cn("tabbar-item");
2632
2633
  const bIcon = cn("tabbar-item__icon-box");
2634
+ const history = useHistory();
2633
2635
  useEffect(() => {
2634
2636
  if (active && href) {
2635
2637
  window.location.href = href;
2638
+ return;
2639
+ }
2640
+ if (active && to2) {
2641
+ history.push(to2);
2636
2642
  }
2637
2643
  }, [active]);
2638
2644
  return /* @__PURE__ */ React__default.createElement("div", {
@@ -5801,6 +5807,8 @@ const defaultProps$t = {
5801
5807
  url: "",
5802
5808
  maximum: 1,
5803
5809
  uploadIcon: "photograph",
5810
+ uploadIconSize: "",
5811
+ listType: "picture",
5804
5812
  name: "file",
5805
5813
  accept: "*",
5806
5814
  disabled: false,
@@ -5825,6 +5833,7 @@ const defaultProps$t = {
5825
5833
  class FileItem {
5826
5834
  constructor() {
5827
5835
  __publicField(this, "status", "ready");
5836
+ __publicField(this, "message", "\u51C6\u5907\u4E2D..");
5828
5837
  __publicField(this, "uid", new Date().getTime().toString());
5829
5838
  __publicField(this, "name");
5830
5839
  __publicField(this, "url");
@@ -5836,8 +5845,11 @@ const InternalUploader = (props, ref) => {
5836
5845
  const _a = __spreadValues(__spreadValues({}, defaultProps$t), props), {
5837
5846
  children,
5838
5847
  uploadIcon,
5848
+ uploadIconSize,
5839
5849
  name,
5840
5850
  accept,
5851
+ defaultFileList,
5852
+ listType,
5841
5853
  disabled,
5842
5854
  multiple,
5843
5855
  url,
@@ -5858,6 +5870,8 @@ const InternalUploader = (props, ref) => {
5858
5870
  clearInput,
5859
5871
  start: start2,
5860
5872
  removeImage,
5873
+ change,
5874
+ fileItemClick,
5861
5875
  progress,
5862
5876
  success,
5863
5877
  update: update2,
@@ -5868,8 +5882,11 @@ const InternalUploader = (props, ref) => {
5868
5882
  } = _a, restProps = __objRest(_a, [
5869
5883
  "children",
5870
5884
  "uploadIcon",
5885
+ "uploadIconSize",
5871
5886
  "name",
5872
5887
  "accept",
5888
+ "defaultFileList",
5889
+ "listType",
5873
5890
  "disabled",
5874
5891
  "multiple",
5875
5892
  "url",
@@ -5890,6 +5907,8 @@ const InternalUploader = (props, ref) => {
5890
5907
  "clearInput",
5891
5908
  "start",
5892
5909
  "removeImage",
5910
+ "change",
5911
+ "fileItemClick",
5893
5912
  "progress",
5894
5913
  "success",
5895
5914
  "update",
@@ -5900,6 +5919,11 @@ const InternalUploader = (props, ref) => {
5900
5919
  ]);
5901
5920
  const [fileList, setFileList] = useState([]);
5902
5921
  const [uploadQueue, setUploadQueue] = useState([]);
5922
+ useEffect(() => {
5923
+ if (defaultFileList) {
5924
+ setFileList(defaultFileList);
5925
+ }
5926
+ }, [defaultFileList]);
5903
5927
  const b2 = cn("uploader");
5904
5928
  const classes = classNames(className, b2(""));
5905
5929
  useImperativeHandle(ref, () => ({
@@ -5938,6 +5962,7 @@ const InternalUploader = (props, ref) => {
5938
5962
  fileList2.map((item) => {
5939
5963
  if (item.uid === fileItem.uid) {
5940
5964
  item.status = "ready";
5965
+ item.message = "\u51C6\u5907\u4E0A\u4F20";
5941
5966
  }
5942
5967
  });
5943
5968
  return [...fileList2];
@@ -5949,6 +5974,7 @@ const InternalUploader = (props, ref) => {
5949
5974
  fileList2.map((item) => {
5950
5975
  if (item.uid === fileItem.uid) {
5951
5976
  item.status = "uploading";
5977
+ item.message = "\u4E0A\u4F20\u4E2D...";
5952
5978
  }
5953
5979
  });
5954
5980
  return [...fileList2];
@@ -5961,6 +5987,7 @@ const InternalUploader = (props, ref) => {
5961
5987
  fileList2.map((item) => {
5962
5988
  if (item.uid === fileItem.uid) {
5963
5989
  item.status = "success";
5990
+ item.message = "\u4E0A\u4F20\u6210\u529F";
5964
5991
  }
5965
5992
  });
5966
5993
  return [...fileList2];
@@ -5975,6 +6002,7 @@ const InternalUploader = (props, ref) => {
5975
6002
  fileList2.map((item) => {
5976
6003
  if (item.uid === fileItem.uid) {
5977
6004
  item.status = "error";
6005
+ item.message = "\u4E0A\u4F20\u5931\u8D25";
5978
6006
  }
5979
6007
  });
5980
6008
  return [...fileList2];
@@ -6004,6 +6032,7 @@ const InternalUploader = (props, ref) => {
6004
6032
  fileItem.type = file.type;
6005
6033
  fileItem.formData = formData;
6006
6034
  fileItem.uid = file.lastModified + fileItem.uid;
6035
+ fileItem.message = "\u51C6\u5907\u4E0A\u4F20";
6007
6036
  executeUpload(fileItem, index2);
6008
6037
  if (isPreview && file.type.includes("image")) {
6009
6038
  const reader = new FileReader();
@@ -6071,9 +6100,12 @@ const InternalUploader = (props, ref) => {
6071
6100
  clearInputValue($el);
6072
6101
  }
6073
6102
  };
6103
+ const handleItemClick = (file) => {
6104
+ fileItemClick && fileItemClick(file);
6105
+ };
6074
6106
  return /* @__PURE__ */ React__default.createElement("div", __spreadValues({
6075
6107
  className: classes
6076
- }, restProps), children ? /* @__PURE__ */ React__default.createElement("div", {
6108
+ }, restProps), children && /* @__PURE__ */ React__default.createElement("div", {
6077
6109
  className: "nut-uploader__slot"
6078
6110
  }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children, maximum > fileList.length && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, capture ? /* @__PURE__ */ React__default.createElement("input", {
6079
6111
  className: "nut-uploader__input",
@@ -6092,30 +6124,63 @@ const InternalUploader = (props, ref) => {
6092
6124
  disabled,
6093
6125
  multiple,
6094
6126
  onChange: fileChange
6095
- })))) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, fileList.length !== 0 && fileList.map((item, index2) => {
6096
- console.log("item", item);
6127
+ })))), fileList.length !== 0 && fileList.map((item, index2) => {
6097
6128
  return /* @__PURE__ */ React__default.createElement("div", {
6098
- className: "nut-uploader__preview",
6129
+ className: `nut-uploader__preview ${listType}`,
6099
6130
  key: item.uid
6100
- }, /* @__PURE__ */ React__default.createElement("div", {
6131
+ }, listType == "picture" && !children && /* @__PURE__ */ React__default.createElement("div", {
6101
6132
  className: "nut-uploader__preview-img"
6102
- }, isDeletable && /* @__PURE__ */ React__default.createElement(Icon, {
6133
+ }, item.status === "ready" ? /* @__PURE__ */ React__default.createElement("div", {
6134
+ className: "nut-uploader__preview__progress"
6135
+ }, /* @__PURE__ */ React__default.createElement("div", {
6136
+ className: "nut-uploader__preview__progress__msg"
6137
+ }, item.message)) : item.status !== "success" && /* @__PURE__ */ React__default.createElement("div", {
6138
+ className: "nut-uploader__preview__progress"
6139
+ }, /* @__PURE__ */ React__default.createElement(Icon, {
6140
+ color: "#fff",
6141
+ name: `${item.status == "error" ? "failure" : "loading"}`
6142
+ }), /* @__PURE__ */ React__default.createElement("div", {
6143
+ className: "nut-uploader__preview__progress__msg"
6144
+ }, item.message)), isDeletable && /* @__PURE__ */ React__default.createElement(Icon, {
6103
6145
  color: "rgba(0,0,0,0.6)",
6104
6146
  className: "close",
6105
- name: "circle-close",
6147
+ name: "failure",
6106
6148
  click: () => onDelete(item, index2)
6107
- }), item.type.includes("image") && item.url && /* @__PURE__ */ React__default.createElement("img", {
6149
+ }), item.type.includes("image") ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, item.url && /* @__PURE__ */ React__default.createElement("img", {
6108
6150
  className: "nut-uploader__preview-img__c",
6109
- src: item.url
6110
- }), !item.type.includes("image") && defaultImg && /* @__PURE__ */ React__default.createElement("img", {
6151
+ src: item.url,
6152
+ onClick: () => handleItemClick(item)
6153
+ })) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, defaultImg ? /* @__PURE__ */ React__default.createElement("img", {
6111
6154
  className: "nut-uploader__preview-img__c",
6112
- src: defaultImg
6113
- }), item.status !== "success" && /* @__PURE__ */ React__default.createElement("div", {
6155
+ src: defaultImg,
6156
+ onClick: () => handleItemClick(item)
6157
+ }) : /* @__PURE__ */ React__default.createElement("div", {
6158
+ className: "nut-uploader__preview-img__file"
6159
+ }, /* @__PURE__ */ React__default.createElement("div", {
6160
+ onClick: () => handleItemClick(item),
6161
+ className: "nut-uploader__preview-img__file__name"
6162
+ }, /* @__PURE__ */ React__default.createElement(Icon, {
6163
+ color: "#808080",
6164
+ name: "link"
6165
+ }), "\xA0", item.name))), /* @__PURE__ */ React__default.createElement("div", {
6114
6166
  className: "tips"
6115
- }, item.status)));
6116
- }), maximum > fileList.length && /* @__PURE__ */ React__default.createElement("div", {
6117
- className: "nut-uploader__upload"
6167
+ }, item.name)), listType == "list" && /* @__PURE__ */ React__default.createElement("div", {
6168
+ className: "nut-uploader__preview-list"
6169
+ }, /* @__PURE__ */ React__default.createElement("div", {
6170
+ className: `nut-uploader__preview-img__file__name ${item.status}`,
6171
+ onClick: () => handleItemClick(item)
6172
+ }, /* @__PURE__ */ React__default.createElement(Icon, {
6173
+ name: "link"
6174
+ }), "\xA0", item.name), /* @__PURE__ */ React__default.createElement(Icon, {
6175
+ color: "#808080",
6176
+ className: "nut-uploader__preview-img__file__del",
6177
+ name: "del",
6178
+ click: () => onDelete(item, index2)
6179
+ })));
6180
+ }), maximum > fileList.length && listType == "picture" && !children && /* @__PURE__ */ React__default.createElement("div", {
6181
+ className: `nut-uploader__upload ${listType}`
6118
6182
  }, /* @__PURE__ */ React__default.createElement(Icon, {
6183
+ size: uploadIconSize,
6119
6184
  color: "#808080",
6120
6185
  name: uploadIcon
6121
6186
  }), capture ? /* @__PURE__ */ React__default.createElement("input", {
@@ -6135,7 +6200,7 @@ const InternalUploader = (props, ref) => {
6135
6200
  disabled,
6136
6201
  multiple,
6137
6202
  onChange: fileChange
6138
- }))));
6203
+ })));
6139
6204
  };
6140
6205
  const Uploader = React__default.forwardRef(InternalUploader);
6141
6206
  Uploader.defaultProps = defaultProps$t;
@@ -11485,86 +11550,118 @@ const Switch = (props) => {
11485
11550
  };
11486
11551
  Switch.defaultProps = defaultProps$n;
11487
11552
  Switch.displayName = "NutSwitch";
11553
+ const isObject = (val) => val !== null && typeof val === "object";
11488
11554
  const defaultProps$m = {
11489
- strokeInnerWidth: 10,
11490
- progress: 10,
11491
- isAuto: false,
11492
- progressOption: {}
11555
+ strokeWidth: 5,
11556
+ radius: 50,
11557
+ strokeLinecap: "round",
11558
+ circleColor: "",
11559
+ pathColor: "",
11560
+ clockwise: true
11493
11561
  };
11494
11562
  const CircleProgress = (props) => {
11563
+ var _b;
11495
11564
  const _a = __spreadValues(__spreadValues({}, defaultProps$m), props), {
11496
11565
  children,
11497
- strokeInnerWidth,
11498
11566
  progress,
11499
- isAuto,
11500
- progressOption,
11501
11567
  className,
11502
- style
11568
+ radius,
11569
+ pathColor,
11570
+ clockwise,
11571
+ circleColor,
11572
+ strokeWidth,
11573
+ style,
11574
+ strokeLinecap
11503
11575
  } = _a, restProps = __objRest(_a, [
11504
11576
  "children",
11505
- "strokeInnerWidth",
11506
11577
  "progress",
11507
- "isAuto",
11508
- "progressOption",
11509
11578
  "className",
11510
- "style"
11579
+ "radius",
11580
+ "pathColor",
11581
+ "clockwise",
11582
+ "circleColor",
11583
+ "strokeWidth",
11584
+ "style",
11585
+ "strokeLinecap"
11511
11586
  ]);
11512
11587
  const b2 = cn("circleprogress");
11513
11588
  const classes = classNames(className, b2(""));
11514
- const option = () => {
11515
- const baseOption = {
11516
- radius: 50,
11517
- strokeOutWidth: 10,
11518
- backColor: "#d9d9d9",
11519
- progressColor: "red",
11520
- cy: 1,
11521
- cx: 1,
11522
- size: 1,
11523
- startPosition: ""
11524
- };
11525
- Object.assign(baseOption, progressOption);
11526
- baseOption.cy = baseOption.cx = baseOption.radius + baseOption.strokeOutWidth;
11527
- baseOption.size = (baseOption.radius + baseOption.strokeOutWidth) * 2;
11528
- baseOption.startPosition = `rotate(-90,${baseOption.cx},${baseOption.cy})`;
11529
- return baseOption;
11530
- };
11589
+ const refRandomId = Math.random().toString(36).slice(-8);
11531
11590
  const styles = __spreadValues({
11532
- height: `${option().size}px`,
11533
- width: `${option().size}px`
11591
+ height: `${Number(radius) * 2}px`,
11592
+ width: `${Number(radius) * 2}px`
11534
11593
  }, style);
11535
- const arcLength = () => {
11536
- const circleLength = Math.floor(2 * Math.PI * option().radius);
11537
- const progressLength = progress / 100 * circleLength;
11538
- return `${progressLength},${circleLength}`;
11594
+ const pathStyle = {
11595
+ stroke: pathColor
11596
+ };
11597
+ const hoverStyle = () => {
11598
+ let perimeter = 283;
11599
+ let offset = perimeter * Number(progress) / 100;
11600
+ return {
11601
+ stroke: isObject(circleColor) ? `url(#${refRandomId})` : circleColor,
11602
+ strokeDasharray: `${offset}px ${perimeter}px`
11603
+ };
11604
+ };
11605
+ const path = () => {
11606
+ const isWise = clockwise ? 1 : 0;
11607
+ return `M 50 50 m -45 0 a 45 45 0 1 ${isWise} 90 0 a 45 45 0 1 ${isWise} -90 0`;
11608
+ };
11609
+ const hoverColor = () => {
11610
+ return isObject(circleColor) ? `url(#${refRandomId})` : circleColor;
11611
+ };
11612
+ const stop2 = () => {
11613
+ if (!isObject(circleColor)) {
11614
+ return;
11615
+ }
11616
+ let color = circleColor;
11617
+ const colorArr = Object.keys(color).sort((a, b22) => parseFloat(a) - parseFloat(b22));
11618
+ let stopArr = [];
11619
+ colorArr.map((item) => {
11620
+ let obj = {
11621
+ key: "",
11622
+ value: ""
11623
+ };
11624
+ obj.key = item;
11625
+ obj.value = color[item];
11626
+ stopArr.push(obj);
11627
+ });
11628
+ return stopArr;
11539
11629
  };
11540
11630
  return /* @__PURE__ */ React__default.createElement("div", __spreadValues({
11541
11631
  className: classes,
11542
11632
  style: styles
11543
11633
  }, restProps), /* @__PURE__ */ React__default.createElement("svg", {
11544
- height: option().size,
11545
- width: option().size,
11546
- "x-mlns": "http://www.w3.org/200/svg"
11547
- }, /* @__PURE__ */ React__default.createElement("circle", {
11548
- r: option().radius,
11549
- cx: option().cx,
11550
- cy: option().cy,
11551
- stroke: option().backColor,
11552
- strokeWidth: option().strokeOutWidth,
11553
- fill: "none"
11554
- }), /* @__PURE__ */ React__default.createElement("circle", {
11555
- r: option().radius,
11556
- cx: option().cx,
11557
- cy: option().cy,
11558
- stroke: option().progressColor,
11559
- strokeWidth: strokeInnerWidth,
11560
- strokeDasharray: arcLength(),
11561
- transform: option().startPosition,
11634
+ viewBox: "0 0 100 100"
11635
+ }, /* @__PURE__ */ React__default.createElement("defs", null, /* @__PURE__ */ React__default.createElement("linearGradient", {
11636
+ id: refRandomId,
11637
+ x1: "100%",
11638
+ y1: "0%",
11639
+ x2: "0%",
11640
+ y2: "0%"
11641
+ }, (_b = stop2()) == null ? void 0 : _b.map((item, index2) => {
11642
+ return /* @__PURE__ */ React__default.createElement("stop", {
11643
+ key: index2,
11644
+ offset: item.key,
11645
+ stopColor: item.value
11646
+ });
11647
+ }))), /* @__PURE__ */ React__default.createElement("path", {
11648
+ className: "nut-circleprogress-path",
11649
+ style: pathStyle,
11650
+ d: path(),
11651
+ fill: "none",
11652
+ strokeWidth
11653
+ }), /* @__PURE__ */ React__default.createElement("path", {
11654
+ className: "nut-circleprogress-hover",
11655
+ style: hoverStyle(),
11656
+ d: path(),
11562
11657
  fill: "none",
11563
- strokeLinecap: "round",
11564
- style: { transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease 0s" }
11658
+ stroke: hoverColor(),
11659
+ strokeLinecap,
11660
+ transform: "rotate(90,50,50)",
11661
+ strokeWidth
11565
11662
  })), /* @__PURE__ */ React__default.createElement("div", {
11566
- className: "nut-circleprogress-content"
11567
- }, !isAuto ? `${progress}%` : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children)));
11663
+ className: "nut-circleprogress-text"
11664
+ }, children ? children : /* @__PURE__ */ React__default.createElement("div", null, progress, "%")));
11568
11665
  };
11569
11666
  CircleProgress.defaultProps = defaultProps$m;
11570
11667
  CircleProgress.displayName = "NutCircleProgress";
@@ -11829,7 +11926,7 @@ const defaultProps$k = {
11829
11926
  };
11830
11927
  const Steps = (props) => {
11831
11928
  const propSteps = __spreadValues(__spreadValues({}, defaultProps$k), props);
11832
- const _a = propSteps, { children, direction, className } = _a, restProps = __objRest(_a, ["children", "direction", "className"]);
11929
+ const _a = propSteps, { children, current, direction, className, progressDot, clickStep } = _a, restProps = __objRest(_a, ["children", "current", "direction", "className", "progressDot", "clickStep"]);
11833
11930
  const parentSteps = {
11834
11931
  propSteps
11835
11932
  };
@@ -11851,6 +11948,7 @@ const defaultProps$j = {
11851
11948
  content: "",
11852
11949
  activeIndex: 0,
11853
11950
  icon: "",
11951
+ iconColor: "",
11854
11952
  size: "12px"
11855
11953
  };
11856
11954
  const Step = (props) => {
@@ -11860,6 +11958,7 @@ const Step = (props) => {
11860
11958
  content,
11861
11959
  activeIndex,
11862
11960
  icon,
11961
+ iconColor,
11863
11962
  size,
11864
11963
  className,
11865
11964
  renderContent
@@ -11869,6 +11968,7 @@ const Step = (props) => {
11869
11968
  "content",
11870
11969
  "activeIndex",
11871
11970
  "icon",
11971
+ "iconColor",
11872
11972
  "size",
11873
11973
  "className",
11874
11974
  "renderContent"
@@ -11881,13 +11981,19 @@ const Step = (props) => {
11881
11981
  return "finish";
11882
11982
  return index2 === +parent.propSteps.current ? "process" : "wait";
11883
11983
  };
11984
+ const handleClickStep = () => {
11985
+ var _a2;
11986
+ (_a2 = parent.propSteps) == null ? void 0 : _a2.clickStep(activeIndex);
11987
+ };
11884
11988
  const b2 = cn("step");
11885
11989
  const classes = classNames({
11886
11990
  [`${b2("")}-${getCurrentStatus()}`]: true
11887
11991
  }, className, b2(""));
11888
- return /* @__PURE__ */ React__default.createElement("div", __spreadValues({
11992
+ return /* @__PURE__ */ React__default.createElement("div", __spreadProps(__spreadValues({
11889
11993
  className: classes
11890
- }, restProps), /* @__PURE__ */ React__default.createElement("div", {
11994
+ }, restProps), {
11995
+ onClick: handleClickStep
11996
+ }), /* @__PURE__ */ React__default.createElement("div", {
11891
11997
  className: "nut-step-head"
11892
11998
  }, /* @__PURE__ */ React__default.createElement("div", {
11893
11999
  className: "nut-step-line"
@@ -11895,6 +12001,7 @@ const Step = (props) => {
11895
12001
  className: `nut-step-icon ${!dot ? icon ? "is-icon" : "is-text" : ""}`
11896
12002
  }, icon ? /* @__PURE__ */ React__default.createElement(Icon, {
11897
12003
  className: "nut-step-icon-inner",
12004
+ color: iconColor,
11898
12005
  name: icon,
11899
12006
  size
11900
12007
  }) : dot ? /* @__PURE__ */ React__default.createElement("span", null) : /* @__PURE__ */ React__default.createElement("span", {
@@ -11913,7 +12020,7 @@ Step.defaultProps = defaultProps$j;
11913
12020
  Step.displayName = "NutStep";
11914
12021
  const DataContext = createContext({});
11915
12022
  const defaultProps$i = {
11916
- width: window.innerWidth,
12023
+ width: typeof window === "object" ? window.innerWidth : 375,
11917
12024
  height: 0,
11918
12025
  duration: 500,
11919
12026
  initPage: 0,
@@ -12341,46 +12448,122 @@ const SwiperItem = React__default.forwardRef((props, ref) => {
12341
12448
  });
12342
12449
  SwiperItem.defaultProps = defaultProps$h;
12343
12450
  SwiperItem.displayName = "NutSwiperItem";
12451
+ const AvatarContext = createContext({});
12344
12452
  const defaultProps$g = {
12345
- size: "normal",
12453
+ size: "",
12346
12454
  icon: "",
12347
- shape: "round",
12348
12455
  bgColor: "#eee",
12456
+ color: "#666",
12349
12457
  prefixCls: "nut-avatar",
12350
- src: ""
12458
+ url: "",
12459
+ alt: ""
12351
12460
  };
12352
12461
  const Avatar = (props) => {
12353
- const _a = __spreadValues(__spreadValues({}, defaultProps$g), props), { children, prefixCls, size, shape, bgColor, src, icon, className, style } = _a, rest = __objRest(_a, ["children", "prefixCls", "size", "shape", "bgColor", "src", "icon", "className", "style"]);
12354
- const sizeValue = ["large", "normal", "small"];
12462
+ var _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
12463
+ const _a = __spreadValues(__spreadValues({}, defaultProps$g), props), {
12464
+ children,
12465
+ prefixCls,
12466
+ size,
12467
+ shape,
12468
+ bgColor,
12469
+ color,
12470
+ url,
12471
+ alt,
12472
+ icon,
12473
+ className,
12474
+ style,
12475
+ activeAvatar,
12476
+ onError
12477
+ } = _a, rest = __objRest(_a, [
12478
+ "children",
12479
+ "prefixCls",
12480
+ "size",
12481
+ "shape",
12482
+ "bgColor",
12483
+ "color",
12484
+ "url",
12485
+ "alt",
12486
+ "icon",
12487
+ "className",
12488
+ "style",
12489
+ "activeAvatar",
12490
+ "onError"
12491
+ ]);
12492
+ const [maxSum, setMaxSum] = useState(0);
12493
+ const [showMax, setShowMax] = useState(false);
12494
+ const [avatarIndex, setAvatarIndex] = useState(1);
12495
+ const avatarRef = useRef(null);
12496
+ const parent = useContext$1(AvatarContext);
12497
+ const b2 = cn("avatar");
12355
12498
  const classes = classNames({
12356
- [`${prefixCls}`]: true,
12357
- [`avatar-${size}`]: true,
12358
- [`avatar-${shape}`]: true
12499
+ [`nut-avatar-${size || ((_b = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _b.size) || "normal"}`]: true,
12500
+ [`nut-avatar-${shape || ((_c = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c.shape) || "round"}`]: true
12359
12501
  });
12360
- const cls = classNames(classes, className);
12502
+ const cls = classNames(b2(""), classes, className);
12503
+ const sizeValue = ["large", "normal", "small"];
12361
12504
  const styles = __spreadValues({
12362
12505
  width: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
12363
12506
  height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
12364
- backgroundImage: src ? `url(${src})` : "",
12365
- backgroundColor: `${bgColor}`
12507
+ backgroundColor: `${bgColor}`,
12508
+ color: `${color}`,
12509
+ marginLeft: avatarIndex != 1 && ((_d = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _d.span) ? `${(_e = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _e.span}px` : "",
12510
+ zIndex: ((_f = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _f.zIndex) == "right" ? `${Math.abs(maxSum - avatarIndex)}` : ""
12366
12511
  }, style);
12367
- const iconStyles = !!icon && !src ? icon : "";
12368
- const handleClick = (e2) => {
12369
- if (props.onClick) {
12370
- props.onClick(e2);
12512
+ const maxStyles = {
12513
+ backgroundColor: `${(_g = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _g.maxBgColor}`,
12514
+ color: `${(_h = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _h.maxColor}`
12515
+ };
12516
+ const iconStyles = !!icon ? icon : "";
12517
+ useEffect(() => {
12518
+ var _a2;
12519
+ const avatarChildren = (_a2 = parent == null ? void 0 : parent.avatarGroupRef) == null ? void 0 : _a2.current.children;
12520
+ if (avatarChildren) {
12521
+ avatarLength(avatarChildren);
12522
+ }
12523
+ }, []);
12524
+ const avatarLength = (children2) => {
12525
+ var _a2, _b2, _c2;
12526
+ for (let i = 0; i < children2.length; i++) {
12527
+ if (children2[i] && children2[i].classList && children2[i].classList[0] == "nut-avatar") {
12528
+ children2[i].setAttribute("data-index", i + 1);
12529
+ }
12530
+ }
12531
+ const index2 = (_b2 = (_a2 = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a2.dataset) == null ? void 0 : _b2.index;
12532
+ const maxCount = (_c2 = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c2.maxCount;
12533
+ setMaxSum(children2.length);
12534
+ setAvatarIndex(index2);
12535
+ if (index2 == children2.length && index2 != maxCount && children2.length > maxCount) {
12536
+ setShowMax(true);
12371
12537
  }
12372
12538
  };
12373
- return /* @__PURE__ */ React__default.createElement("div", __spreadProps(__spreadValues({
12539
+ const errorEvent = (e2) => {
12540
+ if (props.onError) {
12541
+ props.onError(e2);
12542
+ }
12543
+ };
12544
+ const clickAvatar = (e2) => {
12545
+ if (props.activeAvatar) {
12546
+ props.activeAvatar(e2);
12547
+ }
12548
+ };
12549
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, (showMax || !((_i = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _i.maxCount) || avatarIndex <= ((_j = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _j.maxCount)) && /* @__PURE__ */ React__default.createElement("div", __spreadProps(__spreadValues({
12374
12550
  className: cls
12375
12551
  }, rest), {
12376
- style: styles,
12377
- onClick: handleClick
12378
- }), /* @__PURE__ */ React__default.createElement(Icon, {
12552
+ style: !showMax ? styles : maxStyles,
12553
+ onClick: clickAvatar,
12554
+ ref: avatarRef
12555
+ }), (!((_k = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _k.maxCount) || avatarIndex <= ((_l = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _l.maxCount)) && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, url && /* @__PURE__ */ React__default.createElement("img", {
12556
+ src: url,
12557
+ alt,
12558
+ onError: errorEvent
12559
+ }), icon && /* @__PURE__ */ React__default.createElement(Icon, {
12379
12560
  className: "icon",
12380
12561
  name: iconStyles
12381
12562
  }), children && /* @__PURE__ */ React__default.createElement("span", {
12382
12563
  className: "text"
12383
- }, children));
12564
+ }, children)), showMax && /* @__PURE__ */ React__default.createElement("div", {
12565
+ className: "text"
12566
+ }, ((_m = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _m.maxContent) ? (_n = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _n.maxContent : `+ ${avatarIndex - ((_o = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _o.maxCount)}`)));
12384
12567
  };
12385
12568
  Avatar.defaultProps = defaultProps$g;
12386
12569
  Avatar.displayName = "NutAvatar";
@@ -12746,8 +12929,8 @@ const Popover = (props) => {
12746
12929
  Popover.defaultProps = defaultProps$c;
12747
12930
  Popover.displayName = "NutPopover";
12748
12931
  const defaultProps$b = {
12749
- width: 100,
12750
- height: 100,
12932
+ width: "100px",
12933
+ height: "100px",
12751
12934
  row: 1,
12752
12935
  animated: false,
12753
12936
  title: false,
@@ -12799,33 +12982,40 @@ const Skeleton = (props) => {
12799
12982
  return Array.from({ length: num }, (v2, i) => i);
12800
12983
  };
12801
12984
  const getStyle = () => {
12985
+ if (avatarSize) {
12986
+ return {
12987
+ width: avatarSize,
12988
+ height: avatarSize
12989
+ };
12990
+ }
12802
12991
  return {
12803
- width: avatarSize,
12804
- height: avatarSize
12992
+ width: "50px",
12993
+ height: "50px"
12805
12994
  };
12806
12995
  };
12807
12996
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, loading ? /* @__PURE__ */ React__default.createElement("div", null, children) : /* @__PURE__ */ React__default.createElement("div", __spreadValues({
12808
12997
  className: classes
12809
- }, restProps), /* @__PURE__ */ React__default.createElement("div", {
12998
+ }, restProps), animated2 && /* @__PURE__ */ React__default.createElement("div", {
12810
12999
  className: "skeleton-animation"
12811
13000
  }), /* @__PURE__ */ React__default.createElement("div", {
12812
13001
  className: "nut-skeleton-content"
12813
13002
  }, avatar && /* @__PURE__ */ React__default.createElement(Avatar, {
12814
13003
  className: avatarClass,
12815
13004
  bgColor: "rgb(239, 239, 239)",
13005
+ shape: avatarShape,
12816
13006
  style: getStyle()
12817
- }), row === 1 ? /* @__PURE__ */ React__default.createElement("div", {
13007
+ }), row === 1 && /* @__PURE__ */ React__default.createElement("div", {
12818
13008
  className: blockClass,
12819
- style: { width: `${width}px`, height: `${height}px` }
12820
- }) : /* @__PURE__ */ React__default.createElement("div", {
13009
+ style: { width, height }
13010
+ }), /* @__PURE__ */ React__default.createElement("div", {
12821
13011
  className: "skeleton-content-line"
12822
13012
  }, title && /* @__PURE__ */ React__default.createElement("div", {
12823
13013
  className: "skeleton-title"
12824
13014
  }), repeatLines(row).map((item, index2) => {
12825
13015
  return /* @__PURE__ */ React__default.createElement("div", {
12826
- className: `${blockClass} skeleton-lines`,
13016
+ className: blockClass,
12827
13017
  key: index2,
12828
- style: { width: `${width}px`, height: `${height}px` }
13018
+ style: { width, height }
12829
13019
  });
12830
13020
  })))));
12831
13021
  };
@@ -13817,7 +14007,6 @@ const InternalBarrage = (props, ref) => {
13817
14007
  barrageContainer.current.appendChild(el);
13818
14008
  const width = el.offsetWidth;
13819
14009
  const height = el.offsetHeight;
13820
- console.log(el.offsetWidth, el.offsetHeight);
13821
14010
  el.classList.add("move");
13822
14011
  el.style.animationDuration = `${speeds}ms`;
13823
14012
  el.style.top = `${_index % rows * (height + top) + 20}px`;