@nutui/nutui-react-taro 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.
- package/CHANGELOG.md +22 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/ActionSheet.js +1 -1
- package/dist/esm/Address/style/style.css +1 -1
- package/dist/esm/Address.js +3 -3
- package/dist/esm/Animate/style/style.css +1 -1
- package/dist/esm/Audio/style/style.css +1 -1
- package/dist/esm/BackTop.js +1 -1
- package/dist/esm/Badge/style/style.css +1 -1
- package/dist/esm/Barrage/style/style.css +1 -1
- package/dist/esm/Barrage.js +4 -2
- package/dist/esm/Calendar/style/style.css +1 -1
- package/dist/esm/Card/style/style.css +1 -1
- package/dist/esm/Cascader/style/style.css +1 -1
- package/dist/esm/Cascader.js +2 -2
- package/dist/esm/Checkbox/style/style.css +1 -1
- package/dist/esm/CheckboxGroup/style/style.css +1 -1
- package/dist/esm/Col/style/style.css +1 -1
- package/dist/esm/Collapse/style/style.css +1 -1
- package/dist/esm/CollapseItem/style/style.css +1 -1
- package/dist/esm/DatePicker/style/style.css +1 -1
- package/dist/esm/Dialog/style/style.css +1 -1
- package/dist/esm/Divider/style/style.css +1 -1
- package/dist/esm/Form/style/style.css +1 -1
- package/dist/esm/Form.js +1 -1
- package/dist/esm/FormItem/style/style.css +1 -1
- package/dist/esm/FormItem.js +1 -1
- package/dist/esm/Grid/style/style.css +1 -1
- package/dist/esm/GridItem/style/style.css +1 -1
- package/dist/esm/ImagePreview/style/style.css +1 -1
- package/dist/esm/Indicator/style/style.css +1 -1
- package/dist/esm/Input.js +1 -1
- package/dist/esm/InputNumber.js +1 -1
- package/dist/esm/Menu/style/style.css +1 -1
- package/dist/esm/MenuItem/style/style.css +1 -1
- package/dist/esm/NavBar/style/style.css +1 -1
- package/dist/esm/NoticeBar/style/style.css +1 -1
- package/dist/esm/NumberKeyboard/style/style.css +1 -1
- package/dist/esm/Picker/style/style.css +1 -1
- package/dist/esm/Popover/style/style.css +1 -1
- package/dist/esm/Popup/style/style.css +1 -1
- package/dist/esm/Price/style/style.css +1 -1
- package/dist/esm/Radio/style/style.css +1 -1
- package/dist/esm/RadioGroup/style/style.css +1 -1
- package/dist/esm/Range/style/style.css +1 -1
- package/dist/esm/SearchBar/style/style.css +1 -1
- package/dist/esm/ShortPassword/style/style.css +1 -1
- package/dist/esm/ShortPassword.js +1 -1
- package/dist/esm/SideNavBar/style/style.css +1 -1
- package/dist/esm/Skeleton/style/style.css +1 -1
- package/dist/esm/Skeleton.js +1 -1
- package/dist/esm/Step/style/style.css +1 -1
- package/dist/esm/Steps/style/style.css +1 -1
- package/dist/esm/Sticky.js +1 -1
- package/dist/esm/Swipe/style/style.css +1 -1
- package/dist/esm/Swiper/style/style.css +1 -1
- package/dist/esm/Switch/style/style.css +1 -1
- package/dist/esm/Tabbar/style/style.css +1 -1
- package/dist/esm/TabbarItem/style/style.css +1 -1
- package/dist/esm/Table/style/style.css +1 -1
- package/dist/esm/Tabs/style/style.css +1 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/TextArea/style/style.css +1 -1
- package/dist/esm/TimeSelect/style/style.css +1 -1
- package/dist/esm/Tour/style/style.css +1 -1
- package/dist/esm/VirtualList/style/style.css +1 -1
- package/dist/esm/{actionsheet.taro-6NiOrNyd.js → actionsheet.taro-kKhb0Vwt.js} +1 -1
- package/dist/esm/{address.taro-B54ZOtmo.js → address.taro-zQuxQEce.js} +1 -1
- package/dist/esm/{backtop.taro-Y3vOJiXq.js → backtop.taro-Cfld7ina.js} +1 -1
- package/dist/esm/barrage.taro-6nbq7wtt.js +118 -0
- package/dist/esm/{cascader.taro-BxyK5ybo.js → cascader.taro-M2nZWxiB.js} +1 -1
- package/dist/esm/{formitem.taro-atY4A0pS.js → formitem.taro-viaUkMmm.js} +42 -13
- package/dist/esm/{input.taro-YoPsV-op.js → input.taro-xCoGdppk.js} +4 -1
- package/dist/esm/inputnumber.taro-WPpS0Xl9.js +169 -0
- package/dist/esm/nutui-react.es.js +12 -12
- package/dist/esm/{shortpassword.taro-bZCwIpEn.js → shortpassword.taro-JBWXzk6I.js} +19 -6
- package/dist/esm/{skeleton.taro-Pg7WtP0e.js → skeleton.taro--AtiA7MK.js} +2 -2
- package/dist/esm/{sticky.taro-MmKUU2Wv.js → sticky.taro-p-evMNR-.js} +1 -1
- package/dist/esm/{tabs.taro-w8ra49Qb.js → tabs.taro-Yj7vgtSg.js} +1 -1
- package/dist/esm/types/src/packages/formitem/formitem.d.ts +6 -2
- package/dist/esm/types/src/packages/formitem/formitem.taro.d.ts +6 -2
- package/dist/esm/types/src/packages/inputnumber/inputnumber.d.ts +15 -15
- package/dist/esm/types/src/packages/inputnumber/inputnumber.taro.d.ts +15 -17
- package/dist/esm/types/src/packages/shortpassword/shortpassword.d.ts +3 -2
- package/dist/esm/types/src/packages/shortpassword/shortpassword.taro.d.ts +3 -2
- package/dist/esm/types/src/packages/shortpassword/types.d.ts +4 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +277 -247
- package/dist/nutui.react.umd.js +277 -247
- package/dist/packages/animate/animate.scss +0 -27
- package/dist/packages/audio/audio.scss +0 -5
- package/dist/packages/avatarcropper/avatarcropper.scss +0 -2
- package/dist/packages/badge/badge.scss +7 -0
- package/dist/packages/barrage/barrage.scss +23 -4
- package/dist/packages/button/button.scss +0 -1
- package/dist/packages/calendar/calendar.scss +4 -4
- package/dist/packages/calendarcard/calendarcard.scss +0 -1
- package/dist/packages/cascader/cascader.scss +0 -1
- package/dist/packages/checkbox/checkbox.scss +0 -2
- package/dist/packages/checkboxgroup/checkboxgroup.scss +1 -3
- package/dist/packages/col/col.scss +2 -2
- package/dist/packages/collapseitem/collapseitem.scss +2 -3
- package/dist/packages/dialog/dialog.scss +4 -0
- package/dist/packages/divider/divider.scss +1 -1
- package/dist/packages/fixednav/fixednav.scss +0 -2
- package/dist/packages/form/form.scss +24 -26
- package/dist/packages/formitem/formitem.scss +0 -1
- package/dist/packages/grid/grid.scss +1 -1
- package/dist/packages/griditem/griditem.scss +28 -26
- package/dist/packages/imagepreview/imagepreview.scss +0 -1
- package/dist/packages/indicator/indicator.scss +2 -3
- package/dist/packages/menu/menu.scss +0 -7
- package/dist/packages/menuitem/menuitem.scss +14 -10
- package/dist/packages/navbar/navbar.scss +3 -5
- package/dist/packages/noticebar/noticebar.scss +20 -0
- package/dist/packages/numberkeyboard/numberkeyboard.scss +25 -18
- package/dist/packages/pagination/pagination.scss +0 -2
- package/dist/packages/picker/picker.scss +9 -0
- package/dist/packages/popover/popover.scss +0 -4
- package/dist/packages/popup/popup.scss +4 -19
- package/dist/packages/price/price.scss +1 -0
- package/dist/packages/radio/radio.scss +0 -1
- package/dist/packages/radiogroup/radiogroup.scss +10 -1
- package/dist/packages/range/range.scss +127 -127
- package/dist/packages/rate/rate.scss +0 -1
- package/dist/packages/searchbar/searchbar.scss +3 -2
- package/dist/packages/shortpassword/shortpassword.scss +4 -0
- package/dist/packages/skeleton/skeleton.scss +13 -3
- package/dist/packages/space/space.scss +0 -1
- package/dist/packages/step/step.scss +21 -25
- package/dist/packages/swipe/swipe.scss +0 -15
- package/dist/packages/swiper/swiper.scss +0 -1
- package/dist/packages/switch/switch.scss +11 -0
- package/dist/packages/table/table.scss +4 -5
- package/dist/packages/tabs/tabs.scss +16 -18
- package/dist/packages/tag/tag.scss +0 -1
- package/dist/packages/textarea/textarea.scss +1 -6
- package/dist/packages/timeselect/timeselect.scss +1 -6
- package/dist/packages/tour/tour.scss +1 -5
- package/dist/packages/trendarrow/trendarrow.scss +0 -1
- package/dist/packages/uploader/uploader.scss +0 -1
- package/dist/packages/virtuallist/virtuallist.scss +12 -12
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables.scss +11 -7
- package/dist/types/packages/formitem/formitem.d.ts +6 -2
- package/dist/types/packages/formitem/formitem.taro.d.ts +14 -2
- package/dist/types/packages/inputnumber/inputnumber.d.ts +15 -15
- package/dist/types/packages/inputnumber/inputnumber.taro.d.ts +28 -30
- package/dist/types/packages/shortpassword/shortpassword.d.ts +3 -2
- package/dist/types/packages/shortpassword/shortpassword.taro.d.ts +3 -2
- package/dist/types/packages/shortpassword/types.d.ts +4 -0
- package/package.json +5 -5
- package/dist/esm/barrage.taro-HsivAhbE.js +0 -91
- package/dist/esm/inputnumber.taro-7QptygT3.js +0 -197
package/dist/nutui.react.es.js
CHANGED
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
/*!
|
|
8
|
-
* @nutui/nutui-react-taro v2.3.
|
|
8
|
+
* @nutui/nutui-react-taro v2.3.11 Fri Feb 23 2024 19:40:58 GMT+0800 (China Standard Time)
|
|
9
9
|
* (c) 2023 @jdf2e.
|
|
10
10
|
* Released under the MIT License.
|
|
11
11
|
*/
|
|
@@ -4034,7 +4034,7 @@ const Sticky = (props) => {
|
|
|
4034
4034
|
}
|
|
4035
4035
|
}, []);
|
|
4036
4036
|
usePageScroll((res) => {
|
|
4037
|
-
if (getEnv()
|
|
4037
|
+
if (getEnv() !== "WEB") {
|
|
4038
4038
|
handleScroll(res.scrollTop);
|
|
4039
4039
|
}
|
|
4040
4040
|
});
|
|
@@ -4097,7 +4097,7 @@ const BackTop = (props) => {
|
|
|
4097
4097
|
duration: duration > 0 ? duration : 0
|
|
4098
4098
|
});
|
|
4099
4099
|
};
|
|
4100
|
-
const styles = style ? {
|
|
4100
|
+
const styles = Object.keys(style || {}).length !== 0 ? {
|
|
4101
4101
|
zIndex,
|
|
4102
4102
|
...style
|
|
4103
4103
|
} : {
|
|
@@ -5342,7 +5342,7 @@ const Tabs = (props) => {
|
|
|
5342
5342
|
onClick: (e2) => {
|
|
5343
5343
|
tabChange(item);
|
|
5344
5344
|
},
|
|
5345
|
-
className: classNames(`${classPrefix$k}-titles-item
|
|
5345
|
+
className: classNames(`${classPrefix$k}-titles-item`, {
|
|
5346
5346
|
[`nut-tabs-titles-item-active`]: !item.disabled && String(item.value) === String(value),
|
|
5347
5347
|
[`nut-tabs-titles-item-disabled`]: item.disabled,
|
|
5348
5348
|
[`nut-tabs-titles-item-${align}`]: align
|
|
@@ -9752,6 +9752,7 @@ class FormStore {
|
|
|
9752
9752
|
constructor() {
|
|
9753
9753
|
// 初始化数据
|
|
9754
9754
|
__publicField(this, "initialValues", {});
|
|
9755
|
+
__publicField(this, "updateList", []);
|
|
9755
9756
|
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
9756
9757
|
__publicField(this, "store", {});
|
|
9757
9758
|
// 所有的组件实例
|
|
@@ -9821,6 +9822,15 @@ class FormStore {
|
|
|
9821
9822
|
}
|
|
9822
9823
|
});
|
|
9823
9824
|
});
|
|
9825
|
+
this.updateList.forEach((item) => {
|
|
9826
|
+
let shouldUpdate = item.condition;
|
|
9827
|
+
if (typeof item.condition === "function") {
|
|
9828
|
+
shouldUpdate = item.condition();
|
|
9829
|
+
}
|
|
9830
|
+
if (shouldUpdate) {
|
|
9831
|
+
item.entity.onStoreChange("update");
|
|
9832
|
+
}
|
|
9833
|
+
});
|
|
9824
9834
|
});
|
|
9825
9835
|
__publicField(this, "setCallback", (callback) => {
|
|
9826
9836
|
this.callbacks = {
|
|
@@ -9868,9 +9878,11 @@ class FormStore {
|
|
|
9868
9878
|
);
|
|
9869
9879
|
}
|
|
9870
9880
|
const errs = [];
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9881
|
+
await Promise.all(
|
|
9882
|
+
filterEntities.map(async (entity) => {
|
|
9883
|
+
await this.validateEntities(entity, errs);
|
|
9884
|
+
})
|
|
9885
|
+
);
|
|
9874
9886
|
return errs;
|
|
9875
9887
|
});
|
|
9876
9888
|
__publicField(this, "submit", async () => {
|
|
@@ -9889,6 +9901,16 @@ class FormStore {
|
|
|
9889
9901
|
entity.onStoreChange("reset");
|
|
9890
9902
|
});
|
|
9891
9903
|
});
|
|
9904
|
+
// 监听事件
|
|
9905
|
+
__publicField(this, "registerUpdate", (field, shouldUpdate) => {
|
|
9906
|
+
this.updateList.push({
|
|
9907
|
+
entity: field,
|
|
9908
|
+
condition: shouldUpdate
|
|
9909
|
+
});
|
|
9910
|
+
return () => {
|
|
9911
|
+
this.updateList = this.updateList.filter((i2) => i2.entity !== field);
|
|
9912
|
+
};
|
|
9913
|
+
});
|
|
9892
9914
|
__publicField(this, "dispatch", ({ name }) => {
|
|
9893
9915
|
this.validateFields([name]);
|
|
9894
9916
|
});
|
|
@@ -9900,7 +9922,8 @@ class FormStore {
|
|
|
9900
9922
|
setInitialValues: this.setInitialValues,
|
|
9901
9923
|
dispatch: this.dispatch,
|
|
9902
9924
|
store: this.store,
|
|
9903
|
-
fieldEntities: this.fieldEntities
|
|
9925
|
+
fieldEntities: this.fieldEntities,
|
|
9926
|
+
registerUpdate: this.registerUpdate
|
|
9904
9927
|
};
|
|
9905
9928
|
}
|
|
9906
9929
|
});
|
|
@@ -10031,13 +10054,16 @@ const defaultProps$Y = {
|
|
|
10031
10054
|
label: "",
|
|
10032
10055
|
rules: [{ required: false, message: "" }],
|
|
10033
10056
|
errorMessageAlign: "left",
|
|
10034
|
-
validateTrigger: "onChange"
|
|
10057
|
+
validateTrigger: "onChange",
|
|
10058
|
+
shouldUpdate: false,
|
|
10059
|
+
noStyle: false
|
|
10035
10060
|
};
|
|
10036
10061
|
class FormItem extends React__default.Component {
|
|
10037
10062
|
constructor(props) {
|
|
10038
10063
|
super(props);
|
|
10039
10064
|
__publicField(this, "cancelRegister");
|
|
10040
10065
|
__publicField(this, "componentRef");
|
|
10066
|
+
__publicField(this, "eventOff");
|
|
10041
10067
|
// children添加value属性和onChange事件
|
|
10042
10068
|
__publicField(this, "getControlled", (children) => {
|
|
10043
10069
|
var _a;
|
|
@@ -10111,7 +10137,6 @@ class FormItem extends React__default.Component {
|
|
|
10111
10137
|
}
|
|
10112
10138
|
});
|
|
10113
10139
|
__publicField(this, "renderLayout", (childNode) => {
|
|
10114
|
-
var _a;
|
|
10115
10140
|
const {
|
|
10116
10141
|
label,
|
|
10117
10142
|
name,
|
|
@@ -10137,16 +10162,13 @@ class FormItem extends React__default.Component {
|
|
|
10137
10162
|
onClick: (e2) => this.props.onClick && this.props.onClick(e2, this.componentRef)
|
|
10138
10163
|
},
|
|
10139
10164
|
label ? /* @__PURE__ */ React__default.createElement("div", { className: "nut-cell-title nut-form-item-label" }, renderLabel) : null,
|
|
10140
|
-
/* @__PURE__ */ React__default.createElement("div", { className: "nut-cell-value nut-form-item-body" }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-form-item-body-slots" }, childNode), /* @__PURE__ */ React__default.createElement(
|
|
10165
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "nut-cell-value nut-form-item-body" }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-form-item-body-slots" }, childNode), item && item.length > 0 && /* @__PURE__ */ React__default.createElement(
|
|
10141
10166
|
"div",
|
|
10142
10167
|
{
|
|
10143
10168
|
className: "nut-form-item-body-tips",
|
|
10144
|
-
style: {
|
|
10145
|
-
textAlign: errorMessageAlign,
|
|
10146
|
-
display: (item == null ? void 0 : item.length) ? "initial" : "none"
|
|
10147
|
-
}
|
|
10169
|
+
style: { textAlign: errorMessageAlign }
|
|
10148
10170
|
},
|
|
10149
|
-
|
|
10171
|
+
item[0].message
|
|
10150
10172
|
))
|
|
10151
10173
|
);
|
|
10152
10174
|
});
|
|
@@ -10156,22 +10178,31 @@ class FormItem extends React__default.Component {
|
|
|
10156
10178
|
};
|
|
10157
10179
|
}
|
|
10158
10180
|
componentDidMount() {
|
|
10159
|
-
const { registerField } = this.context.getInternal(SECRET);
|
|
10181
|
+
const { registerField, registerUpdate } = this.context.getInternal(SECRET);
|
|
10160
10182
|
this.cancelRegister = registerField(this);
|
|
10183
|
+
this.eventOff = registerUpdate(this, this.props.shouldUpdate);
|
|
10161
10184
|
}
|
|
10162
10185
|
componentWillUnmount() {
|
|
10163
10186
|
if (this.cancelRegister) {
|
|
10164
10187
|
this.cancelRegister();
|
|
10165
10188
|
}
|
|
10189
|
+
if (this.eventOff) {
|
|
10190
|
+
this.eventOff();
|
|
10191
|
+
}
|
|
10166
10192
|
}
|
|
10167
10193
|
render() {
|
|
10168
10194
|
const { children } = this.props;
|
|
10169
10195
|
const child = Array.isArray(children) ? children[0] : children;
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10196
|
+
let returnChildNode;
|
|
10197
|
+
if (!this.props.shouldUpdate) {
|
|
10198
|
+
returnChildNode = React__default.cloneElement(
|
|
10199
|
+
child,
|
|
10200
|
+
this.getControlled(child)
|
|
10201
|
+
);
|
|
10202
|
+
} else {
|
|
10203
|
+
returnChildNode = child(this.context);
|
|
10204
|
+
}
|
|
10205
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: this.state.resetCount }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode));
|
|
10175
10206
|
}
|
|
10176
10207
|
}
|
|
10177
10208
|
__publicField(FormItem, "defaultProps", defaultProps$Y);
|
|
@@ -10355,7 +10386,10 @@ const Input = forwardRef(
|
|
|
10355
10386
|
name,
|
|
10356
10387
|
className: "nut-input-native",
|
|
10357
10388
|
ref: inputRef,
|
|
10358
|
-
style: {
|
|
10389
|
+
style: {
|
|
10390
|
+
textAlign: `${// eslint-disable-next-line no-nested-ternary
|
|
10391
|
+
align === "right" ? "end" : align === "left" ? "start" : "center"}`
|
|
10392
|
+
},
|
|
10359
10393
|
type: inputType(type4),
|
|
10360
10394
|
password: type4 === "password",
|
|
10361
10395
|
maxlength: maxLength,
|
|
@@ -10396,11 +10430,10 @@ Input.displayName = "NutInput";
|
|
|
10396
10430
|
const defaultProps$W = {
|
|
10397
10431
|
...ComponentDefaults,
|
|
10398
10432
|
disabled: false,
|
|
10399
|
-
min: 1,
|
|
10400
|
-
max: 9999,
|
|
10401
10433
|
readOnly: false,
|
|
10402
10434
|
allowEmpty: false,
|
|
10403
|
-
|
|
10435
|
+
min: 1,
|
|
10436
|
+
max: 9999,
|
|
10404
10437
|
step: 1,
|
|
10405
10438
|
digits: 0,
|
|
10406
10439
|
async: false
|
|
@@ -10433,197 +10466,161 @@ const InputNumber = (props) => {
|
|
|
10433
10466
|
...defaultProps$W,
|
|
10434
10467
|
...props
|
|
10435
10468
|
};
|
|
10436
|
-
const
|
|
10437
|
-
|
|
10438
|
-
value,
|
|
10439
|
-
defaultValue
|
|
10469
|
+
const classes = classNames(classPrefix$h, {
|
|
10470
|
+
[`${classPrefix$h}-disabled`]: disabled
|
|
10440
10471
|
});
|
|
10472
|
+
const [focused, setFocused] = useState(false);
|
|
10473
|
+
const inputRef = useRef(null);
|
|
10441
10474
|
useEffect(() => {
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
setChecked(formatter(_checked));
|
|
10446
|
-
}
|
|
10447
|
-
}
|
|
10448
|
-
}, []);
|
|
10449
|
-
const classes = classNames(
|
|
10450
|
-
{
|
|
10451
|
-
[`${classPrefix$h}`]: true,
|
|
10452
|
-
[`${classPrefix$h}-disabled`]: disabled
|
|
10453
|
-
},
|
|
10454
|
-
className
|
|
10455
|
-
);
|
|
10456
|
-
const styles = {
|
|
10457
|
-
...style
|
|
10458
|
-
};
|
|
10459
|
-
const addAllow = (value2 = _checked) => {
|
|
10460
|
-
if (formatter) {
|
|
10461
|
-
const numValue = String(value2).replace(/[^0-9|.]/gi, "");
|
|
10462
|
-
return Number(numValue) < Number(max) && !disabled;
|
|
10475
|
+
var _a, _b;
|
|
10476
|
+
if (focused) {
|
|
10477
|
+
(_b = (_a = inputRef.current) == null ? void 0 : _a.select) == null ? void 0 : _b.call(_a);
|
|
10463
10478
|
}
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
return Number(numValue) > Number(min) && !disabled;
|
|
10479
|
+
}, [focused]);
|
|
10480
|
+
const [shadowValue, setShadowValue] = usePropsValue({
|
|
10481
|
+
value: typeof value === "string" ? parseFloat(value) : value,
|
|
10482
|
+
defaultValue: typeof defaultValue === "string" ? parseFloat(defaultValue) : defaultValue,
|
|
10483
|
+
onChange: (value2) => {
|
|
10470
10484
|
}
|
|
10471
|
-
return Number(value2) > Number(min) && !disabled;
|
|
10472
|
-
};
|
|
10473
|
-
const iconMinusClasses = classNames("nut-inputnumber-icon icon-minus", {
|
|
10474
|
-
"nut-inputnumber-icon-disabled": !reduceAllow()
|
|
10475
|
-
});
|
|
10476
|
-
const iconAddClasses = classNames("nut-inputnumber-icon icon-plus", {
|
|
10477
|
-
"nut-inputnumber-icon-disabled": !addAllow()
|
|
10478
10485
|
});
|
|
10479
|
-
const
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
const outputValue = fixedDecimalPlaces(value2);
|
|
10484
|
-
onChange && onChange(outputValue, e2);
|
|
10485
|
-
if (!async) {
|
|
10486
|
-
if (Number(outputValue) < Number(min)) {
|
|
10487
|
-
formatter ? setChecked(formatter(Number(min))) : setChecked(Number(min));
|
|
10488
|
-
} else if (Number(outputValue) > Number(max)) {
|
|
10489
|
-
formatter ? setChecked(formatter(Number(max))) : setChecked(Number(max));
|
|
10490
|
-
} else {
|
|
10491
|
-
formatter ? setChecked(formatter(outputValue)) : setChecked(outputValue);
|
|
10492
|
-
}
|
|
10486
|
+
const bound2 = (value2, min2, max2) => {
|
|
10487
|
+
let res = value2;
|
|
10488
|
+
if (min2 !== void 0) {
|
|
10489
|
+
res = Math.max(Number(min2), res);
|
|
10493
10490
|
}
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
onMinus && onMinus(e2);
|
|
10497
|
-
if (reduceAllow()) {
|
|
10498
|
-
if (formatter) {
|
|
10499
|
-
const numValue = String(_checked).replace(/[^0-9|.]/gi, "");
|
|
10500
|
-
const outputValue = Number(numValue) - Number(step);
|
|
10501
|
-
inputRef.current = formatter(outputValue);
|
|
10502
|
-
emitChange(outputValue, e2);
|
|
10503
|
-
} else {
|
|
10504
|
-
const outputValue = Number(_checked) - Number(step);
|
|
10505
|
-
emitChange(outputValue, e2);
|
|
10506
|
-
}
|
|
10507
|
-
} else {
|
|
10508
|
-
onOverlimit && onOverlimit(e2);
|
|
10491
|
+
if (max2 !== void 0) {
|
|
10492
|
+
res = Math.min(Number(max2), res);
|
|
10509
10493
|
}
|
|
10494
|
+
return res;
|
|
10510
10495
|
};
|
|
10511
|
-
const
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
} else {
|
|
10520
|
-
const outputValue = Number(_checked) + Number(step);
|
|
10521
|
-
emitChange(outputValue, e2);
|
|
10522
|
-
}
|
|
10523
|
-
} else {
|
|
10524
|
-
onOverlimit && onOverlimit(e2);
|
|
10496
|
+
const format2 = (value2) => {
|
|
10497
|
+
if (value2 === null)
|
|
10498
|
+
return "";
|
|
10499
|
+
if (typeof value2 === "string")
|
|
10500
|
+
value2 = parseFloat(value2);
|
|
10501
|
+
const fixedValue = bound2(value2, Number(min), Number(max));
|
|
10502
|
+
if (formatter) {
|
|
10503
|
+
return formatter(fixedValue);
|
|
10525
10504
|
}
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
const input = e2.target;
|
|
10529
|
-
onChange && onChange(input.value, e2);
|
|
10530
|
-
if (!async) {
|
|
10531
|
-
setChecked(input.value);
|
|
10505
|
+
if (digits) {
|
|
10506
|
+
return fixedValue.toFixed(digits).toString();
|
|
10532
10507
|
}
|
|
10508
|
+
return fixedValue.toString();
|
|
10533
10509
|
};
|
|
10534
|
-
const
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
if (!numReg.test(input[0]) && numValue) {
|
|
10540
|
-
setChecked(formatter(numValue));
|
|
10541
|
-
} else if (!numReg.test(input[0]) && !numValue) {
|
|
10542
|
-
setChecked(input);
|
|
10543
|
-
} else if (numReg.test(input[0])) {
|
|
10544
|
-
if (formatter(numValue) === inputRef.current) {
|
|
10545
|
-
setChecked(numValue);
|
|
10546
|
-
} else {
|
|
10547
|
-
setChecked(formatter(numValue));
|
|
10548
|
-
inputRef.current = formatter(numValue);
|
|
10549
|
-
}
|
|
10550
|
-
}
|
|
10510
|
+
const [inputValue, setInputValue] = useState(format2(shadowValue));
|
|
10511
|
+
useEffect(() => {
|
|
10512
|
+
if (!focused && !async) {
|
|
10513
|
+
setShadowValue(bound2(Number(shadowValue), Number(min), Number(max)));
|
|
10514
|
+
setInputValue(format2(shadowValue));
|
|
10551
10515
|
}
|
|
10552
|
-
};
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10516
|
+
}, [focused, shadowValue]);
|
|
10517
|
+
useEffect(() => {
|
|
10518
|
+
if (async) {
|
|
10519
|
+
setShadowValue(bound2(Number(value), Number(min), Number(max)));
|
|
10520
|
+
setInputValue(format2(value));
|
|
10521
|
+
}
|
|
10522
|
+
}, [value]);
|
|
10523
|
+
const calcNextValue = (current, step2, symbol) => {
|
|
10524
|
+
const dig = digits + 1;
|
|
10525
|
+
return (parseFloat(current || "0") * dig + parseFloat(step2) * dig * symbol) / dig;
|
|
10526
|
+
};
|
|
10527
|
+
const update = (negative, e2) => {
|
|
10528
|
+
if (step !== void 0) {
|
|
10529
|
+
const shouldOverBoundary = calcNextValue(
|
|
10530
|
+
shadowValue,
|
|
10531
|
+
step,
|
|
10532
|
+
negative ? -1 : 1
|
|
10533
|
+
);
|
|
10534
|
+
const nextValue = bound2(shouldOverBoundary, Number(min), Number(max));
|
|
10535
|
+
setShadowValue(nextValue);
|
|
10536
|
+
if (negative ? shouldOverBoundary < min : shouldOverBoundary > max) {
|
|
10537
|
+
onOverlimit == null ? void 0 : onOverlimit(e2);
|
|
10538
|
+
} else {
|
|
10539
|
+
onChange == null ? void 0 : onChange(nextValue, e2);
|
|
10564
10540
|
}
|
|
10565
10541
|
}
|
|
10566
10542
|
};
|
|
10567
|
-
const
|
|
10543
|
+
const handleReduce = (e2) => {
|
|
10568
10544
|
if (disabled)
|
|
10569
10545
|
return;
|
|
10570
|
-
|
|
10571
|
-
|
|
10572
|
-
onFocus && onFocus(e2);
|
|
10546
|
+
onMinus == null ? void 0 : onMinus(e2);
|
|
10547
|
+
update(true, e2);
|
|
10573
10548
|
};
|
|
10574
|
-
const
|
|
10549
|
+
const handlePlus = (e2) => {
|
|
10575
10550
|
if (disabled)
|
|
10576
10551
|
return;
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
|
|
10580
|
-
|
|
10581
|
-
if (
|
|
10582
|
-
|
|
10552
|
+
onPlus == null ? void 0 : onPlus(e2);
|
|
10553
|
+
update(false, e2);
|
|
10554
|
+
};
|
|
10555
|
+
const parseValue = (text) => {
|
|
10556
|
+
if (text === "")
|
|
10557
|
+
return null;
|
|
10558
|
+
if (text === "-")
|
|
10559
|
+
return null;
|
|
10560
|
+
return text;
|
|
10561
|
+
};
|
|
10562
|
+
const handleInputChange = (e2) => {
|
|
10563
|
+
setInputValue(e2.target.value);
|
|
10564
|
+
const valueStr = parseValue(e2.target.value);
|
|
10565
|
+
if (valueStr === null) {
|
|
10566
|
+
if (allowEmpty) {
|
|
10567
|
+
setShadowValue(null);
|
|
10568
|
+
} else {
|
|
10569
|
+
setShadowValue(defaultValue);
|
|
10570
|
+
}
|
|
10571
|
+
} else {
|
|
10572
|
+
setShadowValue(valueStr);
|
|
10583
10573
|
}
|
|
10584
|
-
if (
|
|
10585
|
-
|
|
10586
|
-
} else if (value2 > Number(max)) {
|
|
10587
|
-
value2 = Number(max);
|
|
10574
|
+
if (!async) {
|
|
10575
|
+
onChange == null ? void 0 : onChange(parseFloat(valueStr || "0").toFixed(digits), e2);
|
|
10588
10576
|
}
|
|
10589
|
-
|
|
10577
|
+
};
|
|
10578
|
+
const handleFocus = (e2) => {
|
|
10579
|
+
setFocused(true);
|
|
10580
|
+
setInputValue(
|
|
10581
|
+
shadowValue !== void 0 && shadowValue !== null ? bound2(Number(shadowValue), Number(min), Number(max)).toString() : ""
|
|
10582
|
+
);
|
|
10583
|
+
onFocus && onFocus(e2);
|
|
10584
|
+
};
|
|
10585
|
+
const handleBlur = (e2) => {
|
|
10586
|
+
setFocused(false);
|
|
10590
10587
|
onBlur && onBlur(e2);
|
|
10588
|
+
if (async) {
|
|
10589
|
+
const valueStr = parseValue(e2.target.value);
|
|
10590
|
+
onChange == null ? void 0 : onChange(parseFloat(valueStr || "0").toFixed(digits), e2);
|
|
10591
|
+
}
|
|
10591
10592
|
};
|
|
10592
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: classes, style
|
|
10593
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: classes, style, ...restProps }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-input-minus" }, /* @__PURE__ */ React__default.createElement(
|
|
10593
10594
|
t,
|
|
10594
10595
|
{
|
|
10595
|
-
className:
|
|
10596
|
-
|
|
10596
|
+
className: classNames("nut-inputnumber-icon icon-minus", {
|
|
10597
|
+
[`${classPrefix$h}-icon-disabled`]: shadowValue === min || disabled
|
|
10598
|
+
}),
|
|
10599
|
+
onClick: handleReduce
|
|
10597
10600
|
}
|
|
10598
|
-
)), /* @__PURE__ */ React__default.createElement(React__default.Fragment, null,
|
|
10601
|
+
)), /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
10599
10602
|
"input",
|
|
10600
10603
|
{
|
|
10601
10604
|
className: "nut-number-input",
|
|
10602
|
-
type: "
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
+
type: "digit",
|
|
10606
|
+
ref: inputRef,
|
|
10607
|
+
inputMode: "decimal",
|
|
10605
10608
|
disabled,
|
|
10606
10609
|
readOnly,
|
|
10607
|
-
value:
|
|
10608
|
-
onInput:
|
|
10609
|
-
onBlur:
|
|
10610
|
-
onFocus:
|
|
10610
|
+
value: inputValue,
|
|
10611
|
+
onInput: handleInputChange,
|
|
10612
|
+
onBlur: handleBlur,
|
|
10613
|
+
onFocus: handleFocus
|
|
10611
10614
|
}
|
|
10612
|
-
) : /* @__PURE__ */ React__default.createElement(
|
|
10613
|
-
|
|
10615
|
+
)), /* @__PURE__ */ React__default.createElement("div", { className: "nut-input-add" }, /* @__PURE__ */ React__default.createElement(
|
|
10616
|
+
i,
|
|
10614
10617
|
{
|
|
10615
|
-
className: "nut-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
disabled,
|
|
10620
|
-
readOnly,
|
|
10621
|
-
value: _checked,
|
|
10622
|
-
onInput: changeValue,
|
|
10623
|
-
onBlur: burValue,
|
|
10624
|
-
onFocus: focusValue
|
|
10618
|
+
className: classNames("nut-inputnumber-icon icon-plus", {
|
|
10619
|
+
[`${classPrefix$h}-icon-disabled`]: shadowValue === max || disabled
|
|
10620
|
+
}),
|
|
10621
|
+
onClick: handlePlus
|
|
10625
10622
|
}
|
|
10626
|
-
))
|
|
10623
|
+
)));
|
|
10627
10624
|
};
|
|
10628
10625
|
InputNumber.defaultProps = defaultProps$W;
|
|
10629
10626
|
InputNumber.displayName = "NutInputNumber";
|
|
@@ -12023,13 +12020,13 @@ const defaultProps$N = {
|
|
|
12023
12020
|
// 1~6
|
|
12024
12021
|
autoFocus: false
|
|
12025
12022
|
};
|
|
12026
|
-
const
|
|
12023
|
+
const InternalShortPassword = (props, ref) => {
|
|
12027
12024
|
const { locale } = useConfig$1();
|
|
12028
12025
|
const {
|
|
12029
12026
|
title,
|
|
12030
12027
|
description,
|
|
12031
12028
|
tips,
|
|
12032
|
-
visible,
|
|
12029
|
+
visible: deleteVisible,
|
|
12033
12030
|
value,
|
|
12034
12031
|
error,
|
|
12035
12032
|
hideFooter,
|
|
@@ -12060,6 +12057,20 @@ const ShortPassword = (props) => {
|
|
|
12060
12057
|
const format2 = (val) => {
|
|
12061
12058
|
return val.slice(0, comLen);
|
|
12062
12059
|
};
|
|
12060
|
+
const [visible, setVisible] = usePropsValue({
|
|
12061
|
+
value: props.visible,
|
|
12062
|
+
defaultValue: false,
|
|
12063
|
+
finalValue: false
|
|
12064
|
+
});
|
|
12065
|
+
const actions = {
|
|
12066
|
+
open: () => {
|
|
12067
|
+
setVisible(true);
|
|
12068
|
+
},
|
|
12069
|
+
close: () => {
|
|
12070
|
+
setVisible(false);
|
|
12071
|
+
}
|
|
12072
|
+
};
|
|
12073
|
+
useImperativeHandle(ref, () => actions);
|
|
12063
12074
|
const [inputValue, setInputValue] = usePropsValue({ value, onChange });
|
|
12064
12075
|
useEffect(() => {
|
|
12065
12076
|
if (visible && autoFocus) {
|
|
@@ -12092,11 +12103,10 @@ const ShortPassword = (props) => {
|
|
|
12092
12103
|
},
|
|
12093
12104
|
/* @__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) => {
|
|
12094
12105
|
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` })));
|
|
12095
|
-
}))), /* @__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(z, { size: 11
|
|
12106
|
+
}))), /* @__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(z, { size: 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)))
|
|
12096
12107
|
);
|
|
12097
12108
|
};
|
|
12098
|
-
ShortPassword
|
|
12099
|
-
ShortPassword.displayName = "NutShortPassword";
|
|
12109
|
+
const ShortPassword = React__default.forwardRef(InternalShortPassword);
|
|
12100
12110
|
const defaultProps$M = {
|
|
12101
12111
|
...ComponentDefaults,
|
|
12102
12112
|
canvasId: "spcanvas",
|
|
@@ -13144,6 +13154,7 @@ const ActionSheet = (props) => {
|
|
|
13144
13154
|
return /* @__PURE__ */ React__default.createElement(
|
|
13145
13155
|
Popup,
|
|
13146
13156
|
{
|
|
13157
|
+
...rest,
|
|
13147
13158
|
round: true,
|
|
13148
13159
|
visible,
|
|
13149
13160
|
position: "bottom",
|
|
@@ -14922,7 +14933,7 @@ const Skeleton = (props) => {
|
|
|
14922
14933
|
const classPrefix2 = "nut-skeleton";
|
|
14923
14934
|
const classes = classNames(classPrefix2, className);
|
|
14924
14935
|
const avatarClass = classNames({
|
|
14925
|
-
avatar: true,
|
|
14936
|
+
[`nut-avatar`]: true,
|
|
14926
14937
|
[`avatar-${avatarShape}`]: avatarShape
|
|
14927
14938
|
});
|
|
14928
14939
|
const repeatLines = (num) => {
|
|
@@ -14940,7 +14951,7 @@ const Skeleton = (props) => {
|
|
|
14940
14951
|
height: "50px"
|
|
14941
14952
|
};
|
|
14942
14953
|
};
|
|
14943
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, visible ? /* @__PURE__ */ React__default.createElement(
|
|
14954
|
+
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 }, animated && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-animation` }), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-content` }, avatar && /* @__PURE__ */ React__default.createElement(
|
|
14944
14955
|
Avatar,
|
|
14945
14956
|
{
|
|
14946
14957
|
className: avatarClass,
|
|
@@ -18080,79 +18091,98 @@ const InternalBarrage = (props, ref) => {
|
|
|
18080
18091
|
...defaultProps$6,
|
|
18081
18092
|
...props
|
|
18082
18093
|
};
|
|
18083
|
-
const [styleList, setStyleList] = useState([]);
|
|
18084
|
-
const [baItemList, setBaItemList] = useState(list);
|
|
18085
|
-
const barrageListSet = useRef(list);
|
|
18086
18094
|
const barrageBody = useRef(null);
|
|
18087
18095
|
const barrageContainer = useRef(null);
|
|
18088
|
-
const
|
|
18096
|
+
const barrageCWidth = useRef(0);
|
|
18089
18097
|
const timer = useRef(0);
|
|
18090
|
-
const
|
|
18091
|
-
|
|
18092
|
-
|
|
18093
|
-
|
|
18094
|
-
},
|
|
18095
|
-
className
|
|
18096
|
-
);
|
|
18098
|
+
const index = useRef(0);
|
|
18099
|
+
const times = useRef([]);
|
|
18100
|
+
const historyIndex = useRef(-1);
|
|
18101
|
+
const classes = classNames(classPrefix$1, className);
|
|
18097
18102
|
useImperativeHandle(ref, () => ({
|
|
18098
18103
|
add: (word) => {
|
|
18099
|
-
|
|
18100
|
-
|
|
18104
|
+
const _index = index.current % list.length;
|
|
18105
|
+
if (!loop && index.current === list.length) {
|
|
18106
|
+
list.splice(list.length, 0, word);
|
|
18107
|
+
} else {
|
|
18108
|
+
list.splice(_index, 0, word);
|
|
18109
|
+
}
|
|
18101
18110
|
}
|
|
18102
18111
|
}));
|
|
18112
|
+
const getNodeWidth = async (node, type4 = "width") => {
|
|
18113
|
+
if (node) {
|
|
18114
|
+
const refe = await getRectByTaro(node);
|
|
18115
|
+
return Math.ceil(type4 === "height" ? refe.height : refe.width);
|
|
18116
|
+
}
|
|
18117
|
+
return 0;
|
|
18118
|
+
};
|
|
18103
18119
|
useEffect(() => {
|
|
18104
|
-
|
|
18105
|
-
|
|
18120
|
+
const init = async () => {
|
|
18121
|
+
if (barrageBody.current) {
|
|
18122
|
+
barrageCWidth.current = await getNodeWidth(barrageBody.current);
|
|
18123
|
+
}
|
|
18124
|
+
};
|
|
18125
|
+
init();
|
|
18126
|
+
setTimeout(() => {
|
|
18127
|
+
var _a;
|
|
18128
|
+
(_a = barrageBody.current) == null ? void 0 : _a.style.setProperty(
|
|
18129
|
+
"--move-distance",
|
|
18130
|
+
`-${barrageCWidth.current}px`
|
|
18131
|
+
);
|
|
18132
|
+
index.current = 0;
|
|
18133
|
+
run();
|
|
18134
|
+
}, 300);
|
|
18106
18135
|
return () => {
|
|
18107
18136
|
clearInterval(timer.current);
|
|
18108
18137
|
};
|
|
18109
18138
|
}, [list]);
|
|
18110
18139
|
const run = () => {
|
|
18111
|
-
|
|
18112
|
-
|
|
18113
|
-
|
|
18114
|
-
|
|
18115
|
-
|
|
18116
|
-
|
|
18117
|
-
|
|
18118
|
-
setTimeout(() => {
|
|
18119
|
-
|
|
18120
|
-
|
|
18121
|
-
width = rec.width || 300;
|
|
18122
|
-
});
|
|
18123
|
-
query.select(`.${classPrefix$1}-item${index}`).boundingClientRect((recs) => {
|
|
18124
|
-
const height = recs.height;
|
|
18125
|
-
const nodeTop = `${index % rows * (height + gapY) + 20}px`;
|
|
18126
|
-
styleInfo(index, nodeTop, width);
|
|
18127
|
-
}).exec();
|
|
18128
|
-
}, 500);
|
|
18140
|
+
clearInterval(timer.current);
|
|
18141
|
+
let intervalCache = interval;
|
|
18142
|
+
const _index = (loop ? index.current % list.length : index.current) % rows;
|
|
18143
|
+
const result = times.current[_index] - rows * interval;
|
|
18144
|
+
if (result > 0) {
|
|
18145
|
+
intervalCache += result;
|
|
18146
|
+
}
|
|
18147
|
+
timer.current = window.setTimeout(() => {
|
|
18148
|
+
play();
|
|
18149
|
+
}, intervalCache);
|
|
18129
18150
|
};
|
|
18130
|
-
const
|
|
18131
|
-
|
|
18132
|
-
|
|
18133
|
-
|
|
18134
|
-
const
|
|
18135
|
-
|
|
18136
|
-
|
|
18137
|
-
|
|
18138
|
-
|
|
18139
|
-
|
|
18140
|
-
|
|
18141
|
-
|
|
18142
|
-
|
|
18143
|
-
|
|
18151
|
+
const play = async () => {
|
|
18152
|
+
if (!loop && index.current >= list.length) {
|
|
18153
|
+
return;
|
|
18154
|
+
}
|
|
18155
|
+
const _index = loop ? index.current % list.length : index.current;
|
|
18156
|
+
const el = document.createElement(`View`);
|
|
18157
|
+
let currentIndex = _index % rows;
|
|
18158
|
+
if (currentIndex <= historyIndex.current || historyIndex.current === 3 && currentIndex !== 0 || Math.abs(currentIndex - historyIndex.current) !== 1) {
|
|
18159
|
+
currentIndex = historyIndex.current + 1 >= rows ? 0 : historyIndex.current + 1;
|
|
18160
|
+
}
|
|
18161
|
+
historyIndex.current = currentIndex;
|
|
18162
|
+
el.innerHTML = list[_index];
|
|
18163
|
+
el.classList.add("barrage-item");
|
|
18164
|
+
barrageContainer.current.appendChild(el);
|
|
18165
|
+
try {
|
|
18166
|
+
const width = await getNodeWidth(el);
|
|
18167
|
+
const height = await getNodeWidth(el, "height");
|
|
18168
|
+
el.classList.add("move");
|
|
18169
|
+
const elScrollDuration = width / barrageCWidth.current * duration;
|
|
18170
|
+
times.current[currentIndex] = Math.ceil(elScrollDuration);
|
|
18171
|
+
el.style.animationDuration = `${(duration + elScrollDuration).toFixed(
|
|
18172
|
+
2
|
|
18173
|
+
)}ms`;
|
|
18174
|
+
el.style.top = `${currentIndex * (height + gapY) + 20}px`;
|
|
18175
|
+
el.style.width = `${width}px`;
|
|
18176
|
+
} catch (error) {
|
|
18177
|
+
console.log("异常自动流转到下一个");
|
|
18178
|
+
}
|
|
18179
|
+
el.addEventListener("animationend", () => {
|
|
18180
|
+
barrageContainer.current.removeChild(el);
|
|
18181
|
+
});
|
|
18182
|
+
index.current++;
|
|
18183
|
+
run();
|
|
18144
18184
|
};
|
|
18145
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
18146
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
18147
|
-
"div",
|
|
18148
|
-
{
|
|
18149
|
-
className: `barrage-item ${classPrefix$1}-item${index} move`,
|
|
18150
|
-
style: styleList[index],
|
|
18151
|
-
key: index
|
|
18152
|
-
},
|
|
18153
|
-
item.length > 8 ? `${item.substr(0, 8)}...` : item
|
|
18154
|
-
);
|
|
18155
|
-
})));
|
|
18185
|
+
return /* @__PURE__ */ React__default.createElement(View, { className: classes, ref: barrageBody, ...restProps }, /* @__PURE__ */ React__default.createElement(View, { ref: barrageContainer, className: "bContainer" }));
|
|
18156
18186
|
};
|
|
18157
18187
|
const Barrage = React__default.forwardRef(
|
|
18158
18188
|
InternalBarrage
|