@nutui/nutui-react 2.3.9 → 2.3.10

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 (45) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/esm/ActionSheet/style/style.css +1 -1
  3. package/dist/esm/Address/style/style.css +1 -1
  4. package/dist/esm/Barrage/style/style.css +1 -1
  5. package/dist/esm/Barrage.js +18 -3
  6. package/dist/esm/Calendar/style/style.css +1 -1
  7. package/dist/esm/Cascader/style/style.css +1 -1
  8. package/dist/esm/DatePicker/style/style.css +1 -1
  9. package/dist/esm/ImagePreview/style/style.css +1 -1
  10. package/dist/esm/NumberKeyboard/style/style.css +1 -1
  11. package/dist/esm/Picker/style/style.css +1 -1
  12. package/dist/esm/Popover/style/style.css +1 -1
  13. package/dist/esm/Popup/style/style.css +1 -1
  14. package/dist/esm/ShortPassword/style/style.css +1 -1
  15. package/dist/esm/ShortPassword.js +27 -8
  16. package/dist/esm/SideNavBar/style/style.css +1 -1
  17. package/dist/esm/Tabs/style/style.css +1 -1
  18. package/dist/esm/TimeSelect/style/style.css +1 -1
  19. package/dist/esm/Tour/style/style.css +1 -1
  20. package/dist/esm/formitem2.js +39 -5
  21. package/dist/esm/types/src/packages/formitem/formitem.d.ts +6 -2
  22. package/dist/esm/types/src/packages/formitem/formitem.taro.d.ts +6 -2
  23. package/dist/esm/types/src/packages/shortpassword/shortpassword.d.ts +3 -2
  24. package/dist/esm/types/src/packages/shortpassword/shortpassword.taro.d.ts +3 -2
  25. package/dist/esm/types/src/packages/shortpassword/types.d.ts +4 -0
  26. package/dist/locales/base.js +1 -1
  27. package/dist/locales/en-US.js +1 -1
  28. package/dist/locales/id-ID.js +1 -1
  29. package/dist/locales/tr-TR.js +1 -1
  30. package/dist/locales/zh-CN.js +1 -1
  31. package/dist/locales/zh-TW.js +1 -1
  32. package/dist/locales/zh-UG.js +1 -1
  33. package/dist/nutui.react.es.js +85 -18
  34. package/dist/nutui.react.umd.js +85 -18
  35. package/dist/packages/barrage/barrage.scss +1 -1
  36. package/dist/packages/popup/popup.scss +1 -0
  37. package/dist/packages/tabs/tabs.scss +14 -14
  38. package/dist/style.css +1 -1
  39. package/dist/style.mjs +1 -1
  40. package/dist/types/packages/formitem/formitem.d.ts +14 -2
  41. package/dist/types/packages/formitem/formitem.taro.d.ts +6 -2
  42. package/dist/types/packages/shortpassword/shortpassword.d.ts +3 -2
  43. package/dist/types/packages/shortpassword/shortpassword.taro.d.ts +3 -2
  44. package/dist/types/packages/shortpassword/types.d.ts +4 -0
  45. package/package.json +1 -1
@@ -1179,6 +1179,7 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
1179
1179
  var _this3 = this;
1180
1180
  _classCallCheck(this, FormStore2);
1181
1181
  _defineProperty(this, "initialValues", {});
1182
+ _defineProperty(this, "updateList", []);
1182
1183
  _defineProperty(this, "store", {});
1183
1184
  _defineProperty(this, "fieldEntities", []);
1184
1185
  _defineProperty(this, "callbacks", {});
@@ -1224,6 +1225,15 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
1224
1225
  }
1225
1226
  });
1226
1227
  });
1228
+ _this3.updateList.forEach(function(item) {
1229
+ var shouldUpdate = item.condition;
1230
+ if (typeof item.condition === "function") {
1231
+ shouldUpdate = item.condition();
1232
+ }
1233
+ if (shouldUpdate) {
1234
+ item.entity.onStoreChange("update");
1235
+ }
1236
+ });
1227
1237
  });
1228
1238
  _defineProperty(this, "setCallback", function(callback) {
1229
1239
  _this3.callbacks = _objectSpread(_objectSpread({}, _this3.callbacks), callback);
@@ -1357,6 +1367,17 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
1357
1367
  entity.onStoreChange("reset");
1358
1368
  });
1359
1369
  });
1370
+ _defineProperty(this, "registerUpdate", function(field, shouldUpdate) {
1371
+ _this3.updateList.push({
1372
+ entity: field,
1373
+ condition: shouldUpdate
1374
+ });
1375
+ return function() {
1376
+ _this3.updateList = _this3.updateList.filter(function(i) {
1377
+ return i.entity !== field;
1378
+ });
1379
+ };
1380
+ });
1360
1381
  _defineProperty(this, "dispatch", function(_ref5) {
1361
1382
  var name = _ref5.name;
1362
1383
  _this3.validateFields([name]);
@@ -1369,7 +1390,8 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
1369
1390
  setInitialValues: _this3.setInitialValues,
1370
1391
  dispatch: _this3.dispatch,
1371
1392
  store: _this3.store,
1372
- fieldEntities: _this3.fieldEntities
1393
+ fieldEntities: _this3.fieldEntities,
1394
+ registerUpdate: _this3.registerUpdate
1373
1395
  };
1374
1396
  }
1375
1397
  });
@@ -1422,7 +1444,9 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
1422
1444
  message: ""
1423
1445
  }],
1424
1446
  errorMessageAlign: "left",
1425
- validateTrigger: "onChange"
1447
+ validateTrigger: "onChange",
1448
+ shouldUpdate: false,
1449
+ noStyle: false
1426
1450
  });
1427
1451
  var FormItem = /* @__PURE__ */ function(_React__default$Compo) {
1428
1452
  _inherits(FormItem2, _React__default$Compo);
@@ -1433,6 +1457,7 @@ var FormItem = /* @__PURE__ */ function(_React__default$Compo) {
1433
1457
  _this4 = _super.call(this, props);
1434
1458
  _defineProperty(_assertThisInitialized(_this4), "cancelRegister", void 0);
1435
1459
  _defineProperty(_assertThisInitialized(_this4), "componentRef", void 0);
1460
+ _defineProperty(_assertThisInitialized(_this4), "eventOff", void 0);
1436
1461
  _defineProperty(_assertThisInitialized(_this4), "getControlled", function(children) {
1437
1462
  var _children$props;
1438
1463
  var _this4$context = _this4.context, setFieldsValue = _this4$context.setFieldsValue, getFieldValue = _this4$context.getFieldValue;
@@ -1546,8 +1571,9 @@ var FormItem = /* @__PURE__ */ function(_React__default$Compo) {
1546
1571
  _createClass(FormItem2, [{
1547
1572
  key: "componentDidMount",
1548
1573
  value: function componentDidMount() {
1549
- var _this$context$getInte = this.context.getInternal(SECRET), registerField = _this$context$getInte.registerField;
1574
+ var _this$context$getInte = this.context.getInternal(SECRET), registerField = _this$context$getInte.registerField, registerUpdate = _this$context$getInte.registerUpdate;
1550
1575
  this.cancelRegister = registerField(this);
1576
+ this.eventOff = registerUpdate(this, this.props.shouldUpdate);
1551
1577
  }
1552
1578
  }, {
1553
1579
  key: "componentWillUnmount",
@@ -1555,16 +1581,24 @@ var FormItem = /* @__PURE__ */ function(_React__default$Compo) {
1555
1581
  if (this.cancelRegister) {
1556
1582
  this.cancelRegister();
1557
1583
  }
1584
+ if (this.eventOff) {
1585
+ this.eventOff();
1586
+ }
1558
1587
  }
1559
1588
  }, {
1560
1589
  key: "render",
1561
1590
  value: function render() {
1562
1591
  var children = this.props.children;
1563
1592
  var child = Array.isArray(children) ? children[0] : children;
1564
- var returnChildNode = React__default.cloneElement(child, this.getControlled(child));
1593
+ var returnChildNode;
1594
+ if (!this.props.shouldUpdate) {
1595
+ returnChildNode = React__default.cloneElement(child, this.getControlled(child));
1596
+ } else {
1597
+ returnChildNode = child(this.context);
1598
+ }
1565
1599
  return React__default.createElement(React__default.Fragment, {
1566
1600
  key: this.state.resetCount
1567
- }, this.renderLayout(returnChildNode));
1601
+ }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode));
1568
1602
  }
1569
1603
  }]);
1570
1604
  return FormItem2;
@@ -1,9 +1,9 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { BaseFormField } from './types';
3
3
  import { Context } from '../form/context';
4
4
  import { BasicComponent } from '@/utils/typings';
5
5
  type TextAlign = 'start' | 'end' | 'left' | 'right' | 'center' | 'justify' | 'match-parent';
6
- export interface FormItemProps extends BasicComponent, BaseFormField {
6
+ export interface FormItemProps extends Omit<BasicComponent, 'children'>, BaseFormField {
7
7
  required: boolean;
8
8
  initialValue: any;
9
9
  trigger: string;
@@ -12,6 +12,9 @@ export interface FormItemProps extends BasicComponent, BaseFormField {
12
12
  onClick: (event: React.MouseEvent, componentRef: React.MutableRefObject<any>) => void;
13
13
  errorMessageAlign: TextAlign;
14
14
  validateTrigger: string | string[];
15
+ shouldUpdate: boolean;
16
+ noStyle: boolean;
17
+ children: ReactNode | ((obj: any) => React.ReactNode);
15
18
  }
16
19
  export declare class FormItem extends React.Component<Partial<FormItemProps>, {
17
20
  resetCount: number;
@@ -21,6 +24,7 @@ export declare class FormItem extends React.Component<Partial<FormItemProps>, {
21
24
  context: React.ContextType<typeof Context>;
22
25
  private cancelRegister;
23
26
  private componentRef;
27
+ private eventOff;
24
28
  constructor(props: FormItemProps);
25
29
  componentDidMount(): void;
26
30
  componentWillUnmount(): void;
@@ -1,9 +1,9 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { BaseFormField } from './types';
3
3
  import { Context } from '../form/context';
4
4
  import { BasicComponent } from '@/utils/typings';
5
5
  type TextAlign = 'start' | 'end' | 'left' | 'right' | 'center' | 'justify' | 'match-parent';
6
- export interface FormItemProps extends BasicComponent, BaseFormField {
6
+ export interface FormItemProps extends Omit<BasicComponent, 'children'>, BaseFormField {
7
7
  required: boolean;
8
8
  initialValue: any;
9
9
  trigger: string;
@@ -12,6 +12,9 @@ export interface FormItemProps extends BasicComponent, BaseFormField {
12
12
  onClick: (event: React.MouseEvent, componentRef: React.MutableRefObject<any>) => void;
13
13
  errorMessageAlign: TextAlign;
14
14
  validateTrigger: string | string[];
15
+ shouldUpdate: boolean;
16
+ noStyle: boolean;
17
+ children: ReactNode | ((obj: any) => React.ReactNode);
15
18
  }
16
19
  export declare class FormItem extends React.Component<Partial<FormItemProps>, {
17
20
  resetCount: number;
@@ -21,6 +24,7 @@ export declare class FormItem extends React.Component<Partial<FormItemProps>, {
21
24
  context: React.ContextType<typeof Context>;
22
25
  private cancelRegister;
23
26
  private componentRef;
27
+ private eventOff;
24
28
  constructor(props: FormItemProps);
25
29
  componentDidMount(): void;
26
30
  componentWillUnmount(): void;
@@ -1,4 +1,4 @@
1
- import { FunctionComponent, ReactNode } from 'react';
1
+ import React, { ForwardRefRenderFunction, ReactNode } from 'react';
2
2
  import { PopupProps } from '@/packages/popup/index';
3
3
  export interface ShortPasswordProps extends PopupProps {
4
4
  value: string;
@@ -19,4 +19,5 @@ export interface ShortPasswordProps extends PopupProps {
19
19
  onTips: () => void;
20
20
  onComplete: (value: string) => void;
21
21
  }
22
- export declare const ShortPassword: FunctionComponent<Partial<ShortPasswordProps>>;
22
+ export declare const InternalShortPassword: ForwardRefRenderFunction<unknown, Partial<ShortPasswordProps>>;
23
+ export declare const ShortPassword: React.ForwardRefExoticComponent<Partial<ShortPasswordProps> & React.RefAttributes<unknown>>;
@@ -1,4 +1,4 @@
1
- import { FunctionComponent, ReactNode } from 'react';
1
+ import React, { ForwardRefRenderFunction, ReactNode } from 'react';
2
2
  import { PopupProps } from '@/packages/popup/popup.taro';
3
3
  export interface ShortPasswordProps extends PopupProps {
4
4
  value: string;
@@ -19,4 +19,5 @@ export interface ShortPasswordProps extends PopupProps {
19
19
  onTips: () => void;
20
20
  onComplete: (value: string) => void;
21
21
  }
22
- export declare const ShortPassword: FunctionComponent<Partial<ShortPasswordProps>>;
22
+ export declare const InternalShortPassword: ForwardRefRenderFunction<unknown, Partial<ShortPasswordProps>>;
23
+ export declare const ShortPassword: React.ForwardRefExoticComponent<Partial<ShortPasswordProps> & React.RefAttributes<unknown>>;
@@ -0,0 +1,4 @@
1
+ export type ShortPasswordActions = {
2
+ open: () => void;
3
+ close: () => void;
4
+ };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.3.9 Fri Feb 02 2024 16:14:14 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.3.10 Tue Feb 06 2024 16:13:21 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.3.9 Fri Feb 02 2024 16:14:14 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.3.10 Tue Feb 06 2024 16:13:21 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.3.9 Fri Feb 02 2024 16:14:14 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.3.10 Tue Feb 06 2024 16:13:21 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.3.9 Fri Feb 02 2024 16:14:14 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.3.10 Tue Feb 06 2024 16:13:21 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.3.9 Fri Feb 02 2024 16:14:14 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.3.10 Tue Feb 06 2024 16:13:21 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.3.9 Fri Feb 02 2024 16:14:14 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.3.10 Tue Feb 06 2024 16:13:21 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.3.9 Fri Feb 02 2024 16:14:14 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.3.10 Tue Feb 06 2024 16:13:21 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
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.10 Tue Feb 06 2024 16:12:46 GMT+0800 (China Standard Time)
9
9
  * (c) 2023 @jdf2e.
10
10
  * Released under the MIT License.
11
11
  */
@@ -15786,6 +15786,7 @@ class FormStore {
15786
15786
  constructor() {
15787
15787
  // 初始化数据
15788
15788
  __publicField(this, "initialValues", {});
15789
+ __publicField(this, "updateList", []);
15789
15790
  // 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
15790
15791
  __publicField(this, "store", {});
15791
15792
  // 所有的组件实例
@@ -15855,6 +15856,15 @@ class FormStore {
15855
15856
  }
15856
15857
  });
15857
15858
  });
15859
+ this.updateList.forEach((item) => {
15860
+ let shouldUpdate = item.condition;
15861
+ if (typeof item.condition === "function") {
15862
+ shouldUpdate = item.condition();
15863
+ }
15864
+ if (shouldUpdate) {
15865
+ item.entity.onStoreChange("update");
15866
+ }
15867
+ });
15858
15868
  });
15859
15869
  __publicField(this, "setCallback", (callback) => {
15860
15870
  this.callbacks = {
@@ -15920,6 +15930,16 @@ class FormStore {
15920
15930
  entity.onStoreChange("reset");
15921
15931
  });
15922
15932
  });
15933
+ // 监听事件
15934
+ __publicField(this, "registerUpdate", (field, shouldUpdate) => {
15935
+ this.updateList.push({
15936
+ entity: field,
15937
+ condition: shouldUpdate
15938
+ });
15939
+ return () => {
15940
+ this.updateList = this.updateList.filter((i) => i.entity !== field);
15941
+ };
15942
+ });
15923
15943
  __publicField(this, "dispatch", ({ name }) => {
15924
15944
  this.validateFields([name]);
15925
15945
  });
@@ -15931,7 +15951,8 @@ class FormStore {
15931
15951
  setInitialValues: this.setInitialValues,
15932
15952
  dispatch: this.dispatch,
15933
15953
  store: this.store,
15934
- fieldEntities: this.fieldEntities
15954
+ fieldEntities: this.fieldEntities,
15955
+ registerUpdate: this.registerUpdate
15935
15956
  };
15936
15957
  }
15937
15958
  });
@@ -16062,13 +16083,16 @@ const defaultProps$W = {
16062
16083
  label: "",
16063
16084
  rules: [{ required: false, message: "" }],
16064
16085
  errorMessageAlign: "left",
16065
- validateTrigger: "onChange"
16086
+ validateTrigger: "onChange",
16087
+ shouldUpdate: false,
16088
+ noStyle: false
16066
16089
  };
16067
16090
  class FormItem extends React__default.Component {
16068
16091
  constructor(props) {
16069
16092
  super(props);
16070
16093
  __publicField(this, "cancelRegister");
16071
16094
  __publicField(this, "componentRef");
16095
+ __publicField(this, "eventOff");
16072
16096
  // children添加value属性和onChange事件
16073
16097
  __publicField(this, "getControlled", (children) => {
16074
16098
  var _a2;
@@ -16183,22 +16207,31 @@ class FormItem extends React__default.Component {
16183
16207
  };
16184
16208
  }
16185
16209
  componentDidMount() {
16186
- const { registerField } = this.context.getInternal(SECRET);
16210
+ const { registerField, registerUpdate } = this.context.getInternal(SECRET);
16187
16211
  this.cancelRegister = registerField(this);
16212
+ this.eventOff = registerUpdate(this, this.props.shouldUpdate);
16188
16213
  }
16189
16214
  componentWillUnmount() {
16190
16215
  if (this.cancelRegister) {
16191
16216
  this.cancelRegister();
16192
16217
  }
16218
+ if (this.eventOff) {
16219
+ this.eventOff();
16220
+ }
16193
16221
  }
16194
16222
  render() {
16195
16223
  const { children } = this.props;
16196
16224
  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));
16225
+ let returnChildNode;
16226
+ if (!this.props.shouldUpdate) {
16227
+ returnChildNode = React__default.cloneElement(
16228
+ child,
16229
+ this.getControlled(child)
16230
+ );
16231
+ } else {
16232
+ returnChildNode = child(this.context);
16233
+ }
16234
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: this.state.resetCount }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode));
16202
16235
  }
16203
16236
  }
16204
16237
  __publicField(FormItem, "defaultProps", defaultProps$W);
@@ -18109,13 +18142,13 @@ const defaultProps$L = {
18109
18142
  // 1~6
18110
18143
  autoFocus: false
18111
18144
  };
18112
- const ShortPassword = (props) => {
18145
+ const InternalShortPassword = (props, ref) => {
18113
18146
  const { locale } = useConfig();
18114
18147
  const {
18115
18148
  title,
18116
18149
  description,
18117
18150
  tips,
18118
- visible,
18151
+ visible: deleteVisible,
18119
18152
  value,
18120
18153
  error,
18121
18154
  hideFooter,
@@ -18146,6 +18179,24 @@ const ShortPassword = (props) => {
18146
18179
  const format2 = (val) => {
18147
18180
  return val.slice(0, comLen);
18148
18181
  };
18182
+ const [visible, setVisible] = usePropsValue({
18183
+ value: props.visible,
18184
+ defaultValue: false,
18185
+ finalValue: false
18186
+ });
18187
+ const handleClose = () => {
18188
+ onClose == null ? void 0 : onClose();
18189
+ setVisible(false);
18190
+ };
18191
+ const actions = {
18192
+ open: () => {
18193
+ setVisible(true);
18194
+ },
18195
+ close: () => {
18196
+ setVisible(false);
18197
+ }
18198
+ };
18199
+ useImperativeHandle(ref, () => actions);
18149
18200
  const [inputValue, setInputValue] = usePropsValue({ value, onChange });
18150
18201
  useEffect(() => {
18151
18202
  if (visible && autoFocus) {
@@ -18172,8 +18223,8 @@ const ShortPassword = (props) => {
18172
18223
  },
18173
18224
  visible,
18174
18225
  closeable: true,
18175
- onOverlayClick: onClose,
18176
- onCloseIconClick: onClose,
18226
+ onOverlayClick: handleClose,
18227
+ onCloseIconClick: handleClose,
18177
18228
  ...rest
18178
18229
  },
18179
18230
  /* @__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) => {
@@ -18181,8 +18232,7 @@ const ShortPassword = (props) => {
18181
18232
  }))), /* @__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)))
18182
18233
  );
18183
18234
  };
18184
- ShortPassword.defaultProps = defaultProps$L;
18185
- ShortPassword.displayName = "NutShortPassword";
18235
+ const ShortPassword = React__default.forwardRef(InternalShortPassword);
18186
18236
  const defaultProps$K = {
18187
18237
  ...ComponentDefaults,
18188
18238
  type: "png",
@@ -24487,6 +24537,8 @@ const InternalBarrage = (props, ref) => {
24487
24537
  const barrageCWidth = useRef(0);
24488
24538
  const timer = useRef(0);
24489
24539
  const index = useRef(0);
24540
+ const times = useRef([]);
24541
+ const historyIndex = useRef(-1);
24490
24542
  const classes = classNames(classPrefix$1, className);
24491
24543
  useImperativeHandle(ref, () => ({
24492
24544
  add: (word) => {
@@ -24517,9 +24569,15 @@ const InternalBarrage = (props, ref) => {
24517
24569
  }, [list]);
24518
24570
  const run = () => {
24519
24571
  clearInterval(timer.current);
24572
+ let intervalCache = interval;
24573
+ const _index = (loop2 ? index.current % list.length : index.current) % rows;
24574
+ const result = times.current[_index] - rows * interval;
24575
+ if (result > 0) {
24576
+ intervalCache += result;
24577
+ }
24520
24578
  timer.current = window.setTimeout(() => {
24521
24579
  play();
24522
- }, interval);
24580
+ }, intervalCache);
24523
24581
  };
24524
24582
  const play = () => {
24525
24583
  if (!loop2 && index.current >= list.length) {
@@ -24527,14 +24585,23 @@ const InternalBarrage = (props, ref) => {
24527
24585
  }
24528
24586
  const _index = loop2 ? index.current % list.length : index.current;
24529
24587
  const el = document.createElement(`div`);
24588
+ let currentIndex = _index % rows;
24589
+ if (currentIndex <= historyIndex.current || historyIndex.current === 3 && currentIndex !== 0 || Math.abs(currentIndex - historyIndex.current) !== 1) {
24590
+ currentIndex = historyIndex.current + 1 >= rows ? 0 : historyIndex.current + 1;
24591
+ }
24592
+ historyIndex.current = currentIndex;
24530
24593
  el.innerHTML = list[_index];
24531
24594
  el.classList.add("barrage-item");
24532
24595
  barrageContainer.current.appendChild(el);
24533
24596
  const width = el.offsetWidth;
24534
24597
  const height = el.offsetHeight;
24535
24598
  el.classList.add("move");
24536
- el.style.animationDuration = `${duration}ms`;
24537
- el.style.top = `${_index % rows * (height + gapY) + 20}px`;
24599
+ const elScrollDuration = Math.ceil(
24600
+ width / barrageCWidth.current * duration
24601
+ );
24602
+ times.current[currentIndex] = elScrollDuration;
24603
+ el.style.animationDuration = `${duration + elScrollDuration}ms`;
24604
+ el.style.top = `${currentIndex * (height + gapY) + 20}px`;
24538
24605
  el.style.width = `${width}px`;
24539
24606
  el.addEventListener("animationend", () => {
24540
24607
  barrageContainer.current.removeChild(el);