@nutui/nutui-react 2.3.9 → 2.3.11

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 (141) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/esm/ActionSheet/style/style.css +1 -1
  3. package/dist/esm/ActionSheet.js +3 -3
  4. package/dist/esm/Address/style/style.css +1 -1
  5. package/dist/esm/Animate/style/style.css +1 -1
  6. package/dist/esm/Audio/style/style.css +1 -1
  7. package/dist/esm/BackTop.js +1 -1
  8. package/dist/esm/Badge/style/style.css +1 -1
  9. package/dist/esm/Barrage/style/style.css +1 -1
  10. package/dist/esm/Barrage.js +18 -3
  11. package/dist/esm/Calendar/style/style.css +1 -1
  12. package/dist/esm/Card/style/style.css +1 -1
  13. package/dist/esm/Cascader/style/style.css +1 -1
  14. package/dist/esm/Checkbox/style/style.css +1 -1
  15. package/dist/esm/CheckboxGroup/style/style.css +1 -1
  16. package/dist/esm/Col/style/style.css +1 -1
  17. package/dist/esm/Collapse/style/style.css +1 -1
  18. package/dist/esm/CollapseItem/style/style.css +1 -1
  19. package/dist/esm/DatePicker/style/style.css +1 -1
  20. package/dist/esm/Dialog/style/style.css +1 -1
  21. package/dist/esm/Divider/style/style.css +1 -1
  22. package/dist/esm/Form/style/style.css +1 -1
  23. package/dist/esm/FormItem/style/style.css +1 -1
  24. package/dist/esm/Grid/style/style.css +1 -1
  25. package/dist/esm/GridItem/style/style.css +1 -1
  26. package/dist/esm/ImagePreview/style/style.css +1 -1
  27. package/dist/esm/Indicator/style/style.css +1 -1
  28. package/dist/esm/Input.js +4 -1
  29. package/dist/esm/InputNumber.js +107 -161
  30. package/dist/esm/Menu/style/style.css +1 -1
  31. package/dist/esm/MenuItem/style/style.css +1 -1
  32. package/dist/esm/NavBar/style/style.css +1 -1
  33. package/dist/esm/NoticeBar/style/style.css +1 -1
  34. package/dist/esm/NumberKeyboard/style/style.css +1 -1
  35. package/dist/esm/Picker/style/style.css +1 -1
  36. package/dist/esm/Popover/style/style.css +1 -1
  37. package/dist/esm/Popup/style/style.css +1 -1
  38. package/dist/esm/Price/style/style.css +1 -1
  39. package/dist/esm/Radio/style/style.css +1 -1
  40. package/dist/esm/RadioGroup/style/style.css +1 -1
  41. package/dist/esm/Range/style/style.css +1 -1
  42. package/dist/esm/SearchBar/style/style.css +1 -1
  43. package/dist/esm/ShortPassword/style/style.css +1 -1
  44. package/dist/esm/ShortPassword.js +28 -12
  45. package/dist/esm/SideNavBar/style/style.css +1 -1
  46. package/dist/esm/Skeleton/style/style.css +1 -1
  47. package/dist/esm/Skeleton.js +2 -4
  48. package/dist/esm/Step/style/style.css +1 -1
  49. package/dist/esm/Steps/style/style.css +1 -1
  50. package/dist/esm/Swipe/style/style.css +1 -1
  51. package/dist/esm/Swiper/style/style.css +1 -1
  52. package/dist/esm/Switch/style/style.css +1 -1
  53. package/dist/esm/Tabbar/style/style.css +1 -1
  54. package/dist/esm/TabbarItem/style/style.css +1 -1
  55. package/dist/esm/Table/style/style.css +1 -1
  56. package/dist/esm/Tabs/style/style.css +1 -1
  57. package/dist/esm/TextArea/style/style.css +1 -1
  58. package/dist/esm/TimeSelect/style/style.css +1 -1
  59. package/dist/esm/Tour/style/style.css +1 -1
  60. package/dist/esm/VirtualList/style/style.css +1 -1
  61. package/dist/esm/formitem2.js +39 -5
  62. package/dist/esm/types/src/packages/formitem/formitem.d.ts +6 -2
  63. package/dist/esm/types/src/packages/formitem/formitem.taro.d.ts +6 -2
  64. package/dist/esm/types/src/packages/inputnumber/inputnumber.d.ts +15 -15
  65. package/dist/esm/types/src/packages/inputnumber/inputnumber.taro.d.ts +15 -17
  66. package/dist/esm/types/src/packages/shortpassword/shortpassword.d.ts +3 -2
  67. package/dist/esm/types/src/packages/shortpassword/shortpassword.taro.d.ts +3 -2
  68. package/dist/esm/types/src/packages/shortpassword/types.d.ts +4 -0
  69. package/dist/locales/base.js +1 -1
  70. package/dist/locales/en-US.js +1 -1
  71. package/dist/locales/id-ID.js +1 -1
  72. package/dist/locales/tr-TR.js +1 -1
  73. package/dist/locales/zh-CN.js +1 -1
  74. package/dist/locales/zh-TW.js +1 -1
  75. package/dist/locales/zh-UG.js +1 -1
  76. package/dist/nutui.react.es.js +219 -202
  77. package/dist/nutui.react.umd.js +219 -202
  78. package/dist/packages/animate/animate.scss +0 -27
  79. package/dist/packages/audio/audio.scss +0 -5
  80. package/dist/packages/avatarcropper/avatarcropper.scss +0 -2
  81. package/dist/packages/badge/badge.scss +7 -0
  82. package/dist/packages/barrage/barrage.scss +23 -4
  83. package/dist/packages/button/button.scss +0 -1
  84. package/dist/packages/calendar/calendar.scss +4 -4
  85. package/dist/packages/calendarcard/calendarcard.scss +0 -1
  86. package/dist/packages/cascader/cascader.scss +0 -1
  87. package/dist/packages/checkbox/checkbox.scss +0 -2
  88. package/dist/packages/checkboxgroup/checkboxgroup.scss +1 -3
  89. package/dist/packages/col/col.scss +2 -2
  90. package/dist/packages/collapseitem/collapseitem.scss +2 -3
  91. package/dist/packages/dialog/dialog.scss +4 -0
  92. package/dist/packages/divider/divider.scss +1 -1
  93. package/dist/packages/fixednav/fixednav.scss +0 -2
  94. package/dist/packages/form/form.scss +24 -26
  95. package/dist/packages/formitem/formitem.scss +0 -1
  96. package/dist/packages/grid/grid.scss +1 -1
  97. package/dist/packages/griditem/griditem.scss +28 -26
  98. package/dist/packages/imagepreview/imagepreview.scss +0 -1
  99. package/dist/packages/indicator/indicator.scss +2 -3
  100. package/dist/packages/menu/menu.scss +0 -7
  101. package/dist/packages/menuitem/menuitem.scss +14 -10
  102. package/dist/packages/navbar/navbar.scss +3 -5
  103. package/dist/packages/noticebar/noticebar.scss +20 -0
  104. package/dist/packages/numberkeyboard/numberkeyboard.scss +25 -18
  105. package/dist/packages/pagination/pagination.scss +0 -2
  106. package/dist/packages/picker/picker.scss +9 -0
  107. package/dist/packages/popover/popover.scss +0 -4
  108. package/dist/packages/popup/popup.scss +4 -19
  109. package/dist/packages/price/price.scss +1 -0
  110. package/dist/packages/radio/radio.scss +0 -1
  111. package/dist/packages/radiogroup/radiogroup.scss +10 -1
  112. package/dist/packages/range/range.scss +127 -127
  113. package/dist/packages/rate/rate.scss +0 -1
  114. package/dist/packages/searchbar/searchbar.scss +3 -2
  115. package/dist/packages/shortpassword/shortpassword.scss +4 -0
  116. package/dist/packages/skeleton/skeleton.scss +13 -3
  117. package/dist/packages/space/space.scss +0 -1
  118. package/dist/packages/step/step.scss +21 -25
  119. package/dist/packages/swipe/swipe.scss +0 -15
  120. package/dist/packages/swiper/swiper.scss +0 -1
  121. package/dist/packages/switch/switch.scss +11 -0
  122. package/dist/packages/table/table.scss +4 -5
  123. package/dist/packages/tabs/tabs.scss +16 -18
  124. package/dist/packages/tag/tag.scss +0 -1
  125. package/dist/packages/textarea/textarea.scss +1 -6
  126. package/dist/packages/timeselect/timeselect.scss +1 -6
  127. package/dist/packages/tour/tour.scss +1 -5
  128. package/dist/packages/trendarrow/trendarrow.scss +0 -1
  129. package/dist/packages/uploader/uploader.scss +0 -1
  130. package/dist/packages/virtuallist/virtuallist.scss +12 -12
  131. package/dist/style.css +1 -1
  132. package/dist/style.mjs +1 -1
  133. package/dist/styles/variables.scss +11 -7
  134. package/dist/types/packages/formitem/formitem.d.ts +14 -2
  135. package/dist/types/packages/formitem/formitem.taro.d.ts +6 -2
  136. package/dist/types/packages/inputnumber/inputnumber.d.ts +28 -28
  137. package/dist/types/packages/inputnumber/inputnumber.taro.d.ts +15 -17
  138. package/dist/types/packages/shortpassword/shortpassword.d.ts +3 -2
  139. package/dist/types/packages/shortpassword/shortpassword.taro.d.ts +3 -2
  140. package/dist/types/packages/shortpassword/types.d.ts +4 -0
  141. package/package.json +5 -5
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  /*!
8
- * @nutui/nutui-react v2.3.9 Fri Feb 02 2024 16:13:40 GMT+0800 (China Standard Time)
8
+ * @nutui/nutui-react v2.3.11 Fri Feb 23 2024 19:38:03 GMT+0800 (China Standard Time)
9
9
  * (c) 2023 @jdf2e.
10
10
  * Released under the MIT License.
11
11
  */
@@ -4430,19 +4430,6 @@ function getAllScrollableParents(element, scrollableParents = []) {
4430
4430
  }
4431
4431
  return getAllScrollableParents(element.parentElement, scrollableParents);
4432
4432
  }
4433
- let passiveSupported = false;
4434
- if (canUseDom) {
4435
- try {
4436
- const opts = Object.defineProperty({}, "passive", {
4437
- get() {
4438
- passiveSupported = true;
4439
- }
4440
- });
4441
- window.addEventListener("test-passive-supported", null, opts);
4442
- } catch (e2) {
4443
- console.log(e2);
4444
- }
4445
- }
4446
4433
  let totalLockCount = 0;
4447
4434
  const BODY_LOCK_CLASS = "nut-overflow-hidden";
4448
4435
  function getScrollableElement(el) {
@@ -4491,7 +4478,7 @@ function useLockScroll(rootRef, shouldLock) {
4491
4478
  document.addEventListener(
4492
4479
  "touchmove",
4493
4480
  onTouchMove,
4494
- passiveSupported ? { passive: false } : false
4481
+ false
4495
4482
  );
4496
4483
  if (!totalLockCount) {
4497
4484
  document.body.classList.add(BODY_LOCK_CLASS);
@@ -5200,7 +5187,7 @@ const BackTop = (props) => {
5200
5187
  startTime = otime;
5201
5188
  duration > 0 ? scrollAnimation() : scroll();
5202
5189
  };
5203
- const styles = style ? {
5190
+ const styles = Object.keys(style || {}).length !== 0 ? {
5204
5191
  zIndex,
5205
5192
  ...style
5206
5193
  } : {
@@ -14094,7 +14081,7 @@ const InternalPickerPanel = (props, ref) => {
14094
14081
  }));
14095
14082
  useEffect(() => {
14096
14083
  var _a2, _b, _c;
14097
- const options22 = passiveSupported ? { passive: false } : false;
14084
+ const options22 = false;
14098
14085
  (_a2 = PickerPanelRef.current) == null ? void 0 : _a2.addEventListener("touchstart", touchStart, options22);
14099
14086
  (_b = PickerPanelRef.current) == null ? void 0 : _b.addEventListener("touchmove", touchMove, options22);
14100
14087
  (_c = PickerPanelRef.current) == null ? void 0 : _c.addEventListener("touchend", touchEnd, options22);
@@ -15786,6 +15773,7 @@ class FormStore {
15786
15773
  constructor() {
15787
15774
  // 初始化数据
15788
15775
  __publicField(this, "initialValues", {});
15776
+ __publicField(this, "updateList", []);
15789
15777
  // 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
15790
15778
  __publicField(this, "store", {});
15791
15779
  // 所有的组件实例
@@ -15855,6 +15843,15 @@ class FormStore {
15855
15843
  }
15856
15844
  });
15857
15845
  });
15846
+ this.updateList.forEach((item) => {
15847
+ let shouldUpdate = item.condition;
15848
+ if (typeof item.condition === "function") {
15849
+ shouldUpdate = item.condition();
15850
+ }
15851
+ if (shouldUpdate) {
15852
+ item.entity.onStoreChange("update");
15853
+ }
15854
+ });
15858
15855
  });
15859
15856
  __publicField(this, "setCallback", (callback) => {
15860
15857
  this.callbacks = {
@@ -15920,6 +15917,16 @@ class FormStore {
15920
15917
  entity.onStoreChange("reset");
15921
15918
  });
15922
15919
  });
15920
+ // 监听事件
15921
+ __publicField(this, "registerUpdate", (field, shouldUpdate) => {
15922
+ this.updateList.push({
15923
+ entity: field,
15924
+ condition: shouldUpdate
15925
+ });
15926
+ return () => {
15927
+ this.updateList = this.updateList.filter((i) => i.entity !== field);
15928
+ };
15929
+ });
15923
15930
  __publicField(this, "dispatch", ({ name }) => {
15924
15931
  this.validateFields([name]);
15925
15932
  });
@@ -15931,7 +15938,8 @@ class FormStore {
15931
15938
  setInitialValues: this.setInitialValues,
15932
15939
  dispatch: this.dispatch,
15933
15940
  store: this.store,
15934
- fieldEntities: this.fieldEntities
15941
+ fieldEntities: this.fieldEntities,
15942
+ registerUpdate: this.registerUpdate
15935
15943
  };
15936
15944
  }
15937
15945
  });
@@ -16062,13 +16070,16 @@ const defaultProps$W = {
16062
16070
  label: "",
16063
16071
  rules: [{ required: false, message: "" }],
16064
16072
  errorMessageAlign: "left",
16065
- validateTrigger: "onChange"
16073
+ validateTrigger: "onChange",
16074
+ shouldUpdate: false,
16075
+ noStyle: false
16066
16076
  };
16067
16077
  class FormItem extends React__default.Component {
16068
16078
  constructor(props) {
16069
16079
  super(props);
16070
16080
  __publicField(this, "cancelRegister");
16071
16081
  __publicField(this, "componentRef");
16082
+ __publicField(this, "eventOff");
16072
16083
  // children添加value属性和onChange事件
16073
16084
  __publicField(this, "getControlled", (children) => {
16074
16085
  var _a2;
@@ -16183,22 +16194,31 @@ class FormItem extends React__default.Component {
16183
16194
  };
16184
16195
  }
16185
16196
  componentDidMount() {
16186
- const { registerField } = this.context.getInternal(SECRET);
16197
+ const { registerField, registerUpdate } = this.context.getInternal(SECRET);
16187
16198
  this.cancelRegister = registerField(this);
16199
+ this.eventOff = registerUpdate(this, this.props.shouldUpdate);
16188
16200
  }
16189
16201
  componentWillUnmount() {
16190
16202
  if (this.cancelRegister) {
16191
16203
  this.cancelRegister();
16192
16204
  }
16205
+ if (this.eventOff) {
16206
+ this.eventOff();
16207
+ }
16193
16208
  }
16194
16209
  render() {
16195
16210
  const { children } = this.props;
16196
16211
  const child = Array.isArray(children) ? children[0] : children;
16197
- const returnChildNode = React__default.cloneElement(
16198
- child,
16199
- this.getControlled(child)
16200
- );
16201
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: this.state.resetCount }, this.renderLayout(returnChildNode));
16212
+ let returnChildNode;
16213
+ if (!this.props.shouldUpdate) {
16214
+ returnChildNode = React__default.cloneElement(
16215
+ child,
16216
+ this.getControlled(child)
16217
+ );
16218
+ } else {
16219
+ returnChildNode = child(this.context);
16220
+ }
16221
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: this.state.resetCount }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode));
16202
16222
  }
16203
16223
  }
16204
16224
  __publicField(FormItem, "defaultProps", defaultProps$W);
@@ -16364,7 +16384,10 @@ const Input = forwardRef(
16364
16384
  name,
16365
16385
  className: "nut-input-native",
16366
16386
  ref: inputRef,
16367
- style: { textAlign: align },
16387
+ style: {
16388
+ textAlign: `${// eslint-disable-next-line no-nested-ternary
16389
+ align === "right" ? "end" : align === "left" ? "start" : "center"}`
16390
+ },
16368
16391
  type: inputType(type4),
16369
16392
  maxLength,
16370
16393
  placeholder: placeholder || locale.placeholder,
@@ -16415,11 +16438,10 @@ Input.displayName = "NutInput";
16415
16438
  const defaultProps$U = {
16416
16439
  ...ComponentDefaults,
16417
16440
  disabled: false,
16418
- min: 1,
16419
- max: 9999,
16420
16441
  readOnly: false,
16421
16442
  allowEmpty: false,
16422
- defaultValue: 0,
16443
+ min: 1,
16444
+ max: 9999,
16423
16445
  step: 1,
16424
16446
  digits: 0,
16425
16447
  async: false
@@ -16452,199 +16474,159 @@ const InputNumber = (props) => {
16452
16474
  ...defaultProps$U,
16453
16475
  ...props
16454
16476
  };
16455
- const inputRef = useRef("");
16456
- const [_checked, setChecked] = usePropsValue({
16457
- value,
16458
- defaultValue
16477
+ const classes = classNames(classPrefix$g, {
16478
+ [`${classPrefix$g}-disabled`]: disabled
16459
16479
  });
16480
+ const [focused, setFocused] = useState(false);
16481
+ const inputRef = useRef(null);
16460
16482
  useEffect(() => {
16461
- if (formatter) {
16462
- if (_checked || _checked === 0) {
16463
- inputRef.current = formatter(_checked);
16464
- setChecked(formatter(_checked));
16465
- }
16466
- }
16467
- }, []);
16468
- const classes = classNames(
16469
- {
16470
- [`${classPrefix$g}`]: true,
16471
- [`${classPrefix$g}-disabled`]: disabled
16472
- },
16473
- className
16474
- );
16475
- const styles = {
16476
- ...style
16477
- };
16478
- const addAllow = (value2 = _checked) => {
16479
- if (formatter) {
16480
- const numValue = String(value2).replace(/[^0-9|.]/gi, "");
16481
- return Number(numValue) < Number(max) && !disabled;
16483
+ var _a2, _b;
16484
+ if (focused) {
16485
+ (_b = (_a2 = inputRef.current) == null ? void 0 : _a2.select) == null ? void 0 : _b.call(_a2);
16482
16486
  }
16483
- return Number(value2) < Number(max) && !disabled;
16484
- };
16485
- const reduceAllow = (value2 = _checked) => {
16486
- if (formatter) {
16487
- const numValue = String(value2).replace(/[^0-9|.]/gi, "");
16488
- return Number(numValue) > Number(min) && !disabled;
16487
+ }, [focused]);
16488
+ const [shadowValue, setShadowValue] = usePropsValue({
16489
+ value: typeof value === "string" ? parseFloat(value) : value,
16490
+ defaultValue: typeof defaultValue === "string" ? parseFloat(defaultValue) : defaultValue,
16491
+ onChange: (value2) => {
16489
16492
  }
16490
- return Number(value2) > Number(min) && !disabled;
16491
- };
16492
- const iconMinusClasses = classNames("nut-inputnumber-icon icon-minus", {
16493
- "nut-inputnumber-icon-disabled": !reduceAllow()
16494
16493
  });
16495
- const iconAddClasses = classNames("nut-inputnumber-icon icon-plus", {
16496
- "nut-inputnumber-icon-disabled": !addAllow()
16497
- });
16498
- const fixedDecimalPlaces = (v) => {
16499
- return Number(v).toFixed(Number(digits));
16500
- };
16501
- const emitChange = (value2, e2) => {
16502
- const outputValue = fixedDecimalPlaces(value2);
16503
- onChange && onChange(outputValue, e2);
16504
- if (!async) {
16505
- if (Number(outputValue) < Number(min)) {
16506
- formatter ? setChecked(formatter(Number(min))) : setChecked(Number(min));
16507
- } else if (Number(outputValue) > Number(max)) {
16508
- formatter ? setChecked(formatter(Number(max))) : setChecked(Number(max));
16509
- } else {
16510
- formatter ? setChecked(formatter(outputValue)) : setChecked(outputValue);
16511
- }
16494
+ const bound2 = (value2, min2, max2) => {
16495
+ let res = value2;
16496
+ if (min2 !== void 0) {
16497
+ res = Math.max(Number(min2), res);
16512
16498
  }
16513
- };
16514
- const reduceNumber = (e2) => {
16515
- onMinus && onMinus(e2);
16516
- if (reduceAllow()) {
16517
- if (formatter) {
16518
- const numValue = String(_checked).replace(/[^0-9|.]/gi, "");
16519
- const outputValue = Number(numValue) - Number(step);
16520
- inputRef.current = formatter(outputValue);
16521
- emitChange(outputValue, e2);
16522
- } else {
16523
- const outputValue = Number(_checked) - Number(step);
16524
- emitChange(outputValue, e2);
16525
- }
16526
- } else {
16527
- onOverlimit && onOverlimit(e2);
16499
+ if (max2 !== void 0) {
16500
+ res = Math.min(Number(max2), res);
16528
16501
  }
16502
+ return res;
16529
16503
  };
16530
- const addNumber = (e2) => {
16531
- onPlus && onPlus(e2);
16532
- if (addAllow()) {
16533
- if (formatter) {
16534
- const numValue = String(_checked).replace(/[^0-9|.]/gi, "");
16535
- const outputValue = Number(numValue) + Number(step);
16536
- inputRef.current = formatter(outputValue);
16537
- emitChange(outputValue, e2);
16538
- } else {
16539
- const outputValue = Number(_checked) + Number(step);
16540
- emitChange(outputValue, e2);
16541
- }
16542
- } else {
16543
- onOverlimit && onOverlimit(e2);
16504
+ const format2 = (value2) => {
16505
+ if (value2 === null)
16506
+ return "";
16507
+ if (typeof value2 === "string")
16508
+ value2 = parseFloat(value2);
16509
+ const fixedValue = bound2(value2, Number(min), Number(max));
16510
+ if (formatter) {
16511
+ return formatter(fixedValue);
16544
16512
  }
16545
- };
16546
- const changeValue = (e2) => {
16547
- const input = e2.target;
16548
- onChange && onChange(input.valueAsNumber, e2);
16549
- if (!async) {
16550
- if (Number.isNaN(input.valueAsNumber)) {
16551
- setChecked("");
16552
- } else {
16553
- setChecked(input.valueAsNumber);
16554
- }
16513
+ if (digits) {
16514
+ return fixedValue.toFixed(digits).toString();
16555
16515
  }
16516
+ return fixedValue.toString();
16556
16517
  };
16557
- const changeFormatValue = (e2) => {
16558
- const input = e2.target.value;
16559
- const numReg = /^[0-9]*$/;
16560
- const numValue = input.replace(/[^0-9|.]/gi, "");
16561
- if (formatter) {
16562
- if (!numReg.test(input[0]) && numValue) {
16563
- setChecked(formatter(numValue));
16564
- } else if (!numReg.test(input[0]) && !numValue) {
16565
- setChecked(input);
16566
- } else if (numReg.test(input[0])) {
16567
- if (formatter(numValue) === inputRef.current) {
16568
- setChecked(numValue);
16569
- } else {
16570
- setChecked(formatter(numValue));
16571
- inputRef.current = formatter(numValue);
16572
- }
16573
- }
16518
+ const [inputValue, setInputValue] = useState(format2(shadowValue));
16519
+ useEffect(() => {
16520
+ if (!focused && !async) {
16521
+ setShadowValue(bound2(Number(shadowValue), Number(min), Number(max)));
16522
+ setInputValue(format2(shadowValue));
16574
16523
  }
16575
- };
16576
- const burFormatValue = (e2) => {
16577
- const input = e2.target.value;
16578
- const numReg = /^[0-9]*$/;
16579
- const numValue = input.replace(/[^0-9|.]/gi, "");
16580
- if (formatter) {
16581
- if (formatter(numValue) === input) {
16582
- emitChange(numValue, e2);
16583
- return;
16584
- }
16585
- if (!numReg.test(input) || !input) {
16586
- setChecked(formatter(""));
16524
+ }, [focused, shadowValue]);
16525
+ useEffect(() => {
16526
+ if (async) {
16527
+ setShadowValue(bound2(Number(value), Number(min), Number(max)));
16528
+ setInputValue(format2(value));
16529
+ }
16530
+ }, [value]);
16531
+ const calcNextValue = (current, step2, symbol) => {
16532
+ const dig = digits + 1;
16533
+ return (parseFloat(current || "0") * dig + parseFloat(step2) * dig * symbol) / dig;
16534
+ };
16535
+ const update2 = (negative, e2) => {
16536
+ if (step !== void 0) {
16537
+ const shouldOverBoundary = calcNextValue(
16538
+ shadowValue,
16539
+ step,
16540
+ negative ? -1 : 1
16541
+ );
16542
+ const nextValue = bound2(shouldOverBoundary, Number(min), Number(max));
16543
+ setShadowValue(nextValue);
16544
+ if (negative ? shouldOverBoundary < min : shouldOverBoundary > max) {
16545
+ onOverlimit == null ? void 0 : onOverlimit(e2);
16546
+ } else {
16547
+ onChange == null ? void 0 : onChange(nextValue, e2);
16587
16548
  }
16588
16549
  }
16589
16550
  };
16590
- const focusValue = (e2) => {
16551
+ const handleReduce = (e2) => {
16591
16552
  if (disabled)
16592
16553
  return;
16593
- if (readOnly)
16594
- return;
16595
- onFocus && onFocus(e2);
16554
+ onMinus == null ? void 0 : onMinus(e2);
16555
+ update2(true, e2);
16596
16556
  };
16597
- const burValue = (e2) => {
16557
+ const handlePlus = (e2) => {
16598
16558
  if (disabled)
16599
16559
  return;
16600
- if (readOnly)
16601
- return;
16602
- const input = e2.target;
16603
- let value2 = input.valueAsNumber;
16604
- if (Number.isNaN(value2) && !allowEmpty) {
16605
- value2 = Number(defaultValue);
16560
+ onPlus == null ? void 0 : onPlus(e2);
16561
+ update2(false, e2);
16562
+ };
16563
+ const parseValue = (text) => {
16564
+ if (text === "")
16565
+ return null;
16566
+ if (text === "-")
16567
+ return null;
16568
+ return text;
16569
+ };
16570
+ const handleInputChange = (e2) => {
16571
+ setInputValue(e2.target.value);
16572
+ const valueStr = parseValue(e2.target.value);
16573
+ if (valueStr === null) {
16574
+ if (allowEmpty) {
16575
+ setShadowValue(null);
16576
+ } else {
16577
+ setShadowValue(defaultValue);
16578
+ }
16579
+ } else {
16580
+ setShadowValue(valueStr);
16606
16581
  }
16607
- if (value2 < Number(min)) {
16608
- value2 = Number(min);
16609
- } else if (value2 > Number(max)) {
16610
- value2 = Number(max);
16582
+ if (!async) {
16583
+ onChange == null ? void 0 : onChange(parseFloat(valueStr || "0").toFixed(digits), e2);
16611
16584
  }
16612
- emitChange(value2, e2);
16585
+ };
16586
+ const handleFocus = (e2) => {
16587
+ setFocused(true);
16588
+ setInputValue(
16589
+ shadowValue !== void 0 && shadowValue !== null ? bound2(Number(shadowValue), Number(min), Number(max)).toString() : ""
16590
+ );
16591
+ onFocus && onFocus(e2);
16592
+ };
16593
+ const handleBlur = (e2) => {
16594
+ setFocused(false);
16613
16595
  onBlur && onBlur(e2);
16596
+ if (async) {
16597
+ const valueStr = parseValue(e2.target.value);
16598
+ onChange == null ? void 0 : onChange(parseFloat(valueStr || "0").toFixed(digits), e2);
16599
+ }
16614
16600
  };
16615
- return /* @__PURE__ */ React__default.createElement("div", { className: classes, style: styles, ...restProps }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-input-minus" }, /* @__PURE__ */ React__default.createElement(
16601
+ return /* @__PURE__ */ React__default.createElement("div", { className: classes, style, ...restProps }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-input-minus" }, /* @__PURE__ */ React__default.createElement(
16616
16602
  o,
16617
16603
  {
16618
- className: iconMinusClasses,
16619
- onClick: (e2) => reduceNumber(e2)
16604
+ className: classNames("nut-inputnumber-icon icon-minus", {
16605
+ [`${classPrefix$g}-icon-disabled`]: shadowValue === min || disabled
16606
+ }),
16607
+ onClick: handleReduce
16620
16608
  }
16621
- )), /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, formatter ? /* @__PURE__ */ React__default.createElement(
16609
+ )), /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
16622
16610
  "input",
16623
16611
  {
16624
- type: "text",
16625
- min,
16626
- max,
16612
+ ref: inputRef,
16613
+ inputMode: "decimal",
16627
16614
  disabled,
16628
16615
  readOnly,
16629
- value: _checked,
16630
- onInput: changeFormatValue,
16631
- onBlur: burFormatValue,
16632
- onFocus: focusValue
16616
+ value: inputValue,
16617
+ onInput: handleInputChange,
16618
+ onBlur: handleBlur,
16619
+ onFocus: handleFocus
16633
16620
  }
16634
- ) : /* @__PURE__ */ React__default.createElement(
16635
- "input",
16621
+ )), /* @__PURE__ */ React__default.createElement("div", { className: "nut-input-add" }, /* @__PURE__ */ React__default.createElement(
16622
+ l$2,
16636
16623
  {
16637
- type: "number",
16638
- min,
16639
- max,
16640
- disabled,
16641
- readOnly,
16642
- value: _checked,
16643
- onInput: changeValue,
16644
- onBlur: burValue,
16645
- onFocus: focusValue
16624
+ className: classNames("nut-inputnumber-icon icon-plus", {
16625
+ [`${classPrefix$g}-icon-disabled`]: shadowValue === max || disabled
16626
+ }),
16627
+ onClick: handlePlus
16646
16628
  }
16647
- )), /* @__PURE__ */ React__default.createElement("div", { className: "nut-input-add" }, /* @__PURE__ */ React__default.createElement(l$2, { className: iconAddClasses, onClick: (e2) => addNumber(e2) })));
16629
+ )));
16648
16630
  };
16649
16631
  InputNumber.defaultProps = defaultProps$U;
16650
16632
  InputNumber.displayName = "NutInputNumber";
@@ -18109,13 +18091,13 @@ const defaultProps$L = {
18109
18091
  // 1~6
18110
18092
  autoFocus: false
18111
18093
  };
18112
- const ShortPassword = (props) => {
18094
+ const InternalShortPassword = (props, ref) => {
18113
18095
  const { locale } = useConfig();
18114
18096
  const {
18115
18097
  title,
18116
18098
  description,
18117
18099
  tips,
18118
- visible,
18100
+ visible: deleteVisible,
18119
18101
  value,
18120
18102
  error,
18121
18103
  hideFooter,
@@ -18146,6 +18128,24 @@ const ShortPassword = (props) => {
18146
18128
  const format2 = (val) => {
18147
18129
  return val.slice(0, comLen);
18148
18130
  };
18131
+ const [visible, setVisible] = usePropsValue({
18132
+ value: props.visible,
18133
+ defaultValue: false,
18134
+ finalValue: false
18135
+ });
18136
+ const handleClose = () => {
18137
+ onClose == null ? void 0 : onClose();
18138
+ setVisible(false);
18139
+ };
18140
+ const actions = {
18141
+ open: () => {
18142
+ setVisible(true);
18143
+ },
18144
+ close: () => {
18145
+ setVisible(false);
18146
+ }
18147
+ };
18148
+ useImperativeHandle(ref, () => actions);
18149
18149
  const [inputValue, setInputValue] = usePropsValue({ value, onChange });
18150
18150
  useEffect(() => {
18151
18151
  if (visible && autoFocus) {
@@ -18172,17 +18172,16 @@ const ShortPassword = (props) => {
18172
18172
  },
18173
18173
  visible,
18174
18174
  closeable: true,
18175
- onOverlayClick: onClose,
18176
- onCloseIconClick: onClose,
18175
+ onOverlayClick: handleClose,
18176
+ onCloseIconClick: handleClose,
18177
18177
  ...rest
18178
18178
  },
18179
18179
  /* @__PURE__ */ React__default.createElement("div", { className: classNames(classPrefix2, className), style }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-title` }, title || locale.shortpassword.title), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-description` }, description || locale.shortpassword.description), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-input`, onClick: onFocus }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-input-site` }), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-input-fake` }, [...new Array(comLen).keys()].map((item, index) => {
18180
18180
  return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-input-fake-li`, key: index }, inputValue.length > index && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, plain ? inputValue[index] : /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-input-fake-li-icon` })));
18181
- }))), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-message` }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-message-error` }, error), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-message-forget`, onClick: onTips }, tips || /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(s, { width: 11, height: 11, style: { marginRight: "3px" } }), locale.shortpassword.tips))), !hideFooter && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-footer` }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-footer-cancel`, onClick: onCancel }, locale.cancel), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-footer-sure`, onClick: sure }, locale.confirm)))
18181
+ }))), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-message` }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-message-error` }, error), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-message-forget`, onClick: onTips }, tips || /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(s, { width: 11, height: 11 }), locale.shortpassword.tips))), !hideFooter && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-footer` }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-footer-cancel`, onClick: onCancel }, locale.cancel), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-footer-sure`, onClick: sure }, locale.confirm)))
18182
18182
  );
18183
18183
  };
18184
- ShortPassword.defaultProps = defaultProps$L;
18185
- ShortPassword.displayName = "NutShortPassword";
18184
+ const ShortPassword = React__default.forwardRef(InternalShortPassword);
18186
18185
  const defaultProps$K = {
18187
18186
  ...ComponentDefaults,
18188
18187
  type: "png",
@@ -19158,6 +19157,7 @@ const ActionSheet = (props) => {
19158
19157
  return /* @__PURE__ */ React__default.createElement(
19159
19158
  Popup,
19160
19159
  {
19160
+ ...rest,
19161
19161
  round: true,
19162
19162
  visible,
19163
19163
  position: "bottom",
@@ -19168,7 +19168,7 @@ const ActionSheet = (props) => {
19168
19168
  onCancel && onCancel();
19169
19169
  }
19170
19170
  },
19171
- /* @__PURE__ */ React__default.createElement("div", { className: `${className}`, style, ...rest }, options2.length ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-list` }, options2.map((item, index) => {
19171
+ /* @__PURE__ */ React__default.createElement("div", { className: `${className}`, style }, options2.length ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-list` }, options2.map((item, index) => {
19172
19172
  return /* @__PURE__ */ React__default.createElement(
19173
19173
  "div",
19174
19174
  {
@@ -20901,7 +20901,7 @@ const PullToRefresh = (p) => {
20901
20901
  axis: "y",
20902
20902
  target: elementRef,
20903
20903
  enabled: !props.disabled,
20904
- eventOptions: passiveSupported ? { passive: false } : false
20904
+ eventOptions: false
20905
20905
  }
20906
20906
  );
20907
20907
  const renderIcons = (status2) => {
@@ -21118,7 +21118,7 @@ const Skeleton = (props) => {
21118
21118
  const classPrefix2 = "nut-skeleton";
21119
21119
  const classes = classNames(classPrefix2, className);
21120
21120
  const avatarClass = classNames({
21121
- avatar: true,
21121
+ [`nut-avatar`]: true,
21122
21122
  [`avatar-${avatarShape}`]: avatarShape
21123
21123
  });
21124
21124
  const repeatLines = (num) => {
@@ -21136,7 +21136,7 @@ const Skeleton = (props) => {
21136
21136
  height: "50px"
21137
21137
  };
21138
21138
  };
21139
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, visible ? /* @__PURE__ */ React__default.createElement("div", null, children) : /* @__PURE__ */ React__default.createElement("div", { className: classes, ...rest }, animated2 && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-animation` }), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-content` }, avatar && /* @__PURE__ */ React__default.createElement(
21139
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, visible ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children) : /* @__PURE__ */ React__default.createElement("div", { className: classes, ...rest }, animated2 && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-animation` }), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-content` }, avatar && /* @__PURE__ */ React__default.createElement(
21140
21140
  Avatar,
21141
21141
  {
21142
21142
  className: avatarClass,
@@ -24487,6 +24487,8 @@ const InternalBarrage = (props, ref) => {
24487
24487
  const barrageCWidth = useRef(0);
24488
24488
  const timer = useRef(0);
24489
24489
  const index = useRef(0);
24490
+ const times = useRef([]);
24491
+ const historyIndex = useRef(-1);
24490
24492
  const classes = classNames(classPrefix$1, className);
24491
24493
  useImperativeHandle(ref, () => ({
24492
24494
  add: (word) => {
@@ -24517,9 +24519,15 @@ const InternalBarrage = (props, ref) => {
24517
24519
  }, [list]);
24518
24520
  const run = () => {
24519
24521
  clearInterval(timer.current);
24522
+ let intervalCache = interval;
24523
+ const _index = (loop2 ? index.current % list.length : index.current) % rows;
24524
+ const result = times.current[_index] - rows * interval;
24525
+ if (result > 0) {
24526
+ intervalCache += result;
24527
+ }
24520
24528
  timer.current = window.setTimeout(() => {
24521
24529
  play();
24522
- }, interval);
24530
+ }, intervalCache);
24523
24531
  };
24524
24532
  const play = () => {
24525
24533
  if (!loop2 && index.current >= list.length) {
@@ -24527,14 +24535,23 @@ const InternalBarrage = (props, ref) => {
24527
24535
  }
24528
24536
  const _index = loop2 ? index.current % list.length : index.current;
24529
24537
  const el = document.createElement(`div`);
24538
+ let currentIndex = _index % rows;
24539
+ if (currentIndex <= historyIndex.current || historyIndex.current === 3 && currentIndex !== 0 || Math.abs(currentIndex - historyIndex.current) !== 1) {
24540
+ currentIndex = historyIndex.current + 1 >= rows ? 0 : historyIndex.current + 1;
24541
+ }
24542
+ historyIndex.current = currentIndex;
24530
24543
  el.innerHTML = list[_index];
24531
24544
  el.classList.add("barrage-item");
24532
24545
  barrageContainer.current.appendChild(el);
24533
24546
  const width = el.offsetWidth;
24534
24547
  const height = el.offsetHeight;
24535
24548
  el.classList.add("move");
24536
- el.style.animationDuration = `${duration}ms`;
24537
- el.style.top = `${_index % rows * (height + gapY) + 20}px`;
24549
+ const elScrollDuration = Math.ceil(
24550
+ width / barrageCWidth.current * duration
24551
+ );
24552
+ times.current[currentIndex] = elScrollDuration;
24553
+ el.style.animationDuration = `${duration + elScrollDuration}ms`;
24554
+ el.style.top = `${currentIndex * (height + gapY) + 20}px`;
24538
24555
  el.style.width = `${width}px`;
24539
24556
  el.addEventListener("animationend", () => {
24540
24557
  barrageContainer.current.removeChild(el);