@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.
- package/CHANGELOG.md +22 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/ActionSheet.js +3 -3
- package/dist/esm/Address/style/style.css +1 -1
- 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 +18 -3
- 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/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/FormItem/style/style.css +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 +4 -1
- package/dist/esm/InputNumber.js +107 -161
- 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 +28 -12
- package/dist/esm/SideNavBar/style/style.css +1 -1
- package/dist/esm/Skeleton/style/style.css +1 -1
- package/dist/esm/Skeleton.js +2 -4
- package/dist/esm/Step/style/style.css +1 -1
- package/dist/esm/Steps/style/style.css +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/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/formitem2.js +39 -5
- 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 +219 -202
- package/dist/nutui.react.umd.js +219 -202
- 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 +14 -2
- package/dist/types/packages/formitem/formitem.taro.d.ts +6 -2
- package/dist/types/packages/inputnumber/inputnumber.d.ts +28 -28
- package/dist/types/packages/inputnumber/inputnumber.taro.d.ts +15 -17
- 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/nutui.react.umd.js
CHANGED
|
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8
8
|
return value;
|
|
9
9
|
};
|
|
10
10
|
/*!
|
|
11
|
-
* @nutui/nutui-react v2.3.
|
|
11
|
+
* @nutui/nutui-react v2.3.11 Fri Feb 23 2024 19:38:03 GMT+0800 (China Standard Time)
|
|
12
12
|
* (c) 2023 @jdf2e.
|
|
13
13
|
* Released under the MIT License.
|
|
14
14
|
*/
|
|
@@ -4448,19 +4448,6 @@ Check the top-level render call using <` + t2 + ">.");
|
|
|
4448
4448
|
}
|
|
4449
4449
|
return getAllScrollableParents(element.parentElement, scrollableParents);
|
|
4450
4450
|
}
|
|
4451
|
-
let passiveSupported = false;
|
|
4452
|
-
if (canUseDom) {
|
|
4453
|
-
try {
|
|
4454
|
-
const opts = Object.defineProperty({}, "passive", {
|
|
4455
|
-
get() {
|
|
4456
|
-
passiveSupported = true;
|
|
4457
|
-
}
|
|
4458
|
-
});
|
|
4459
|
-
window.addEventListener("test-passive-supported", null, opts);
|
|
4460
|
-
} catch (e2) {
|
|
4461
|
-
console.log(e2);
|
|
4462
|
-
}
|
|
4463
|
-
}
|
|
4464
4451
|
let totalLockCount = 0;
|
|
4465
4452
|
const BODY_LOCK_CLASS = "nut-overflow-hidden";
|
|
4466
4453
|
function getScrollableElement(el) {
|
|
@@ -4509,7 +4496,7 @@ Check the top-level render call using <` + t2 + ">.");
|
|
|
4509
4496
|
document.addEventListener(
|
|
4510
4497
|
"touchmove",
|
|
4511
4498
|
onTouchMove,
|
|
4512
|
-
|
|
4499
|
+
false
|
|
4513
4500
|
);
|
|
4514
4501
|
if (!totalLockCount) {
|
|
4515
4502
|
document.body.classList.add(BODY_LOCK_CLASS);
|
|
@@ -5218,7 +5205,7 @@ Check the top-level render call using <` + t2 + ">.");
|
|
|
5218
5205
|
startTime = otime;
|
|
5219
5206
|
duration > 0 ? scrollAnimation() : scroll();
|
|
5220
5207
|
};
|
|
5221
|
-
const styles = style ? {
|
|
5208
|
+
const styles = Object.keys(style || {}).length !== 0 ? {
|
|
5222
5209
|
zIndex,
|
|
5223
5210
|
...style
|
|
5224
5211
|
} : {
|
|
@@ -14112,7 +14099,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14112
14099
|
}));
|
|
14113
14100
|
React.useEffect(() => {
|
|
14114
14101
|
var _a2, _b, _c;
|
|
14115
|
-
const options22 =
|
|
14102
|
+
const options22 = false;
|
|
14116
14103
|
(_a2 = PickerPanelRef.current) == null ? void 0 : _a2.addEventListener("touchstart", touchStart, options22);
|
|
14117
14104
|
(_b = PickerPanelRef.current) == null ? void 0 : _b.addEventListener("touchmove", touchMove, options22);
|
|
14118
14105
|
(_c = PickerPanelRef.current) == null ? void 0 : _c.addEventListener("touchend", touchEnd, options22);
|
|
@@ -15804,6 +15791,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15804
15791
|
constructor() {
|
|
15805
15792
|
// 初始化数据
|
|
15806
15793
|
__publicField(this, "initialValues", {});
|
|
15794
|
+
__publicField(this, "updateList", []);
|
|
15807
15795
|
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
15808
15796
|
__publicField(this, "store", {});
|
|
15809
15797
|
// 所有的组件实例
|
|
@@ -15873,6 +15861,15 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15873
15861
|
}
|
|
15874
15862
|
});
|
|
15875
15863
|
});
|
|
15864
|
+
this.updateList.forEach((item) => {
|
|
15865
|
+
let shouldUpdate = item.condition;
|
|
15866
|
+
if (typeof item.condition === "function") {
|
|
15867
|
+
shouldUpdate = item.condition();
|
|
15868
|
+
}
|
|
15869
|
+
if (shouldUpdate) {
|
|
15870
|
+
item.entity.onStoreChange("update");
|
|
15871
|
+
}
|
|
15872
|
+
});
|
|
15876
15873
|
});
|
|
15877
15874
|
__publicField(this, "setCallback", (callback) => {
|
|
15878
15875
|
this.callbacks = {
|
|
@@ -15938,6 +15935,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15938
15935
|
entity.onStoreChange("reset");
|
|
15939
15936
|
});
|
|
15940
15937
|
});
|
|
15938
|
+
// 监听事件
|
|
15939
|
+
__publicField(this, "registerUpdate", (field, shouldUpdate) => {
|
|
15940
|
+
this.updateList.push({
|
|
15941
|
+
entity: field,
|
|
15942
|
+
condition: shouldUpdate
|
|
15943
|
+
});
|
|
15944
|
+
return () => {
|
|
15945
|
+
this.updateList = this.updateList.filter((i) => i.entity !== field);
|
|
15946
|
+
};
|
|
15947
|
+
});
|
|
15941
15948
|
__publicField(this, "dispatch", ({ name }) => {
|
|
15942
15949
|
this.validateFields([name]);
|
|
15943
15950
|
});
|
|
@@ -15949,7 +15956,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15949
15956
|
setInitialValues: this.setInitialValues,
|
|
15950
15957
|
dispatch: this.dispatch,
|
|
15951
15958
|
store: this.store,
|
|
15952
|
-
fieldEntities: this.fieldEntities
|
|
15959
|
+
fieldEntities: this.fieldEntities,
|
|
15960
|
+
registerUpdate: this.registerUpdate
|
|
15953
15961
|
};
|
|
15954
15962
|
}
|
|
15955
15963
|
});
|
|
@@ -16080,13 +16088,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16080
16088
|
label: "",
|
|
16081
16089
|
rules: [{ required: false, message: "" }],
|
|
16082
16090
|
errorMessageAlign: "left",
|
|
16083
|
-
validateTrigger: "onChange"
|
|
16091
|
+
validateTrigger: "onChange",
|
|
16092
|
+
shouldUpdate: false,
|
|
16093
|
+
noStyle: false
|
|
16084
16094
|
};
|
|
16085
16095
|
class FormItem extends React.Component {
|
|
16086
16096
|
constructor(props) {
|
|
16087
16097
|
super(props);
|
|
16088
16098
|
__publicField(this, "cancelRegister");
|
|
16089
16099
|
__publicField(this, "componentRef");
|
|
16100
|
+
__publicField(this, "eventOff");
|
|
16090
16101
|
// children添加value属性和onChange事件
|
|
16091
16102
|
__publicField(this, "getControlled", (children) => {
|
|
16092
16103
|
var _a2;
|
|
@@ -16201,22 +16212,31 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16201
16212
|
};
|
|
16202
16213
|
}
|
|
16203
16214
|
componentDidMount() {
|
|
16204
|
-
const { registerField } = this.context.getInternal(SECRET);
|
|
16215
|
+
const { registerField, registerUpdate } = this.context.getInternal(SECRET);
|
|
16205
16216
|
this.cancelRegister = registerField(this);
|
|
16217
|
+
this.eventOff = registerUpdate(this, this.props.shouldUpdate);
|
|
16206
16218
|
}
|
|
16207
16219
|
componentWillUnmount() {
|
|
16208
16220
|
if (this.cancelRegister) {
|
|
16209
16221
|
this.cancelRegister();
|
|
16210
16222
|
}
|
|
16223
|
+
if (this.eventOff) {
|
|
16224
|
+
this.eventOff();
|
|
16225
|
+
}
|
|
16211
16226
|
}
|
|
16212
16227
|
render() {
|
|
16213
16228
|
const { children } = this.props;
|
|
16214
16229
|
const child = Array.isArray(children) ? children[0] : children;
|
|
16215
|
-
|
|
16216
|
-
|
|
16217
|
-
|
|
16218
|
-
|
|
16219
|
-
|
|
16230
|
+
let returnChildNode;
|
|
16231
|
+
if (!this.props.shouldUpdate) {
|
|
16232
|
+
returnChildNode = React.cloneElement(
|
|
16233
|
+
child,
|
|
16234
|
+
this.getControlled(child)
|
|
16235
|
+
);
|
|
16236
|
+
} else {
|
|
16237
|
+
returnChildNode = child(this.context);
|
|
16238
|
+
}
|
|
16239
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, { key: this.state.resetCount }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode));
|
|
16220
16240
|
}
|
|
16221
16241
|
}
|
|
16222
16242
|
__publicField(FormItem, "defaultProps", defaultProps$W);
|
|
@@ -16382,7 +16402,10 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16382
16402
|
name,
|
|
16383
16403
|
className: "nut-input-native",
|
|
16384
16404
|
ref: inputRef,
|
|
16385
|
-
style: {
|
|
16405
|
+
style: {
|
|
16406
|
+
textAlign: `${// eslint-disable-next-line no-nested-ternary
|
|
16407
|
+
align === "right" ? "end" : align === "left" ? "start" : "center"}`
|
|
16408
|
+
},
|
|
16386
16409
|
type: inputType(type2),
|
|
16387
16410
|
maxLength,
|
|
16388
16411
|
placeholder: placeholder || locale.placeholder,
|
|
@@ -16433,11 +16456,10 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16433
16456
|
const defaultProps$U = {
|
|
16434
16457
|
...ComponentDefaults,
|
|
16435
16458
|
disabled: false,
|
|
16436
|
-
min: 1,
|
|
16437
|
-
max: 9999,
|
|
16438
16459
|
readOnly: false,
|
|
16439
16460
|
allowEmpty: false,
|
|
16440
|
-
|
|
16461
|
+
min: 1,
|
|
16462
|
+
max: 9999,
|
|
16441
16463
|
step: 1,
|
|
16442
16464
|
digits: 0,
|
|
16443
16465
|
async: false
|
|
@@ -16470,199 +16492,159 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16470
16492
|
...defaultProps$U,
|
|
16471
16493
|
...props
|
|
16472
16494
|
};
|
|
16473
|
-
const
|
|
16474
|
-
|
|
16475
|
-
value,
|
|
16476
|
-
defaultValue
|
|
16495
|
+
const classes = classNames(classPrefix$g, {
|
|
16496
|
+
[`${classPrefix$g}-disabled`]: disabled
|
|
16477
16497
|
});
|
|
16498
|
+
const [focused, setFocused] = React.useState(false);
|
|
16499
|
+
const inputRef = React.useRef(null);
|
|
16478
16500
|
React.useEffect(() => {
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
|
|
16482
|
-
setChecked(formatter(_checked));
|
|
16483
|
-
}
|
|
16484
|
-
}
|
|
16485
|
-
}, []);
|
|
16486
|
-
const classes = classNames(
|
|
16487
|
-
{
|
|
16488
|
-
[`${classPrefix$g}`]: true,
|
|
16489
|
-
[`${classPrefix$g}-disabled`]: disabled
|
|
16490
|
-
},
|
|
16491
|
-
className
|
|
16492
|
-
);
|
|
16493
|
-
const styles = {
|
|
16494
|
-
...style
|
|
16495
|
-
};
|
|
16496
|
-
const addAllow = (value2 = _checked) => {
|
|
16497
|
-
if (formatter) {
|
|
16498
|
-
const numValue = String(value2).replace(/[^0-9|.]/gi, "");
|
|
16499
|
-
return Number(numValue) < Number(max) && !disabled;
|
|
16501
|
+
var _a2, _b;
|
|
16502
|
+
if (focused) {
|
|
16503
|
+
(_b = (_a2 = inputRef.current) == null ? void 0 : _a2.select) == null ? void 0 : _b.call(_a2);
|
|
16500
16504
|
}
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16506
|
-
return Number(numValue) > Number(min) && !disabled;
|
|
16505
|
+
}, [focused]);
|
|
16506
|
+
const [shadowValue, setShadowValue] = usePropsValue({
|
|
16507
|
+
value: typeof value === "string" ? parseFloat(value) : value,
|
|
16508
|
+
defaultValue: typeof defaultValue === "string" ? parseFloat(defaultValue) : defaultValue,
|
|
16509
|
+
onChange: (value2) => {
|
|
16507
16510
|
}
|
|
16508
|
-
return Number(value2) > Number(min) && !disabled;
|
|
16509
|
-
};
|
|
16510
|
-
const iconMinusClasses = classNames("nut-inputnumber-icon icon-minus", {
|
|
16511
|
-
"nut-inputnumber-icon-disabled": !reduceAllow()
|
|
16512
16511
|
});
|
|
16513
|
-
const
|
|
16514
|
-
|
|
16515
|
-
|
|
16516
|
-
|
|
16517
|
-
return Number(v).toFixed(Number(digits));
|
|
16518
|
-
};
|
|
16519
|
-
const emitChange = (value2, e2) => {
|
|
16520
|
-
const outputValue = fixedDecimalPlaces(value2);
|
|
16521
|
-
onChange && onChange(outputValue, e2);
|
|
16522
|
-
if (!async) {
|
|
16523
|
-
if (Number(outputValue) < Number(min)) {
|
|
16524
|
-
formatter ? setChecked(formatter(Number(min))) : setChecked(Number(min));
|
|
16525
|
-
} else if (Number(outputValue) > Number(max)) {
|
|
16526
|
-
formatter ? setChecked(formatter(Number(max))) : setChecked(Number(max));
|
|
16527
|
-
} else {
|
|
16528
|
-
formatter ? setChecked(formatter(outputValue)) : setChecked(outputValue);
|
|
16529
|
-
}
|
|
16512
|
+
const bound2 = (value2, min2, max2) => {
|
|
16513
|
+
let res = value2;
|
|
16514
|
+
if (min2 !== void 0) {
|
|
16515
|
+
res = Math.max(Number(min2), res);
|
|
16530
16516
|
}
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
onMinus && onMinus(e2);
|
|
16534
|
-
if (reduceAllow()) {
|
|
16535
|
-
if (formatter) {
|
|
16536
|
-
const numValue = String(_checked).replace(/[^0-9|.]/gi, "");
|
|
16537
|
-
const outputValue = Number(numValue) - Number(step);
|
|
16538
|
-
inputRef.current = formatter(outputValue);
|
|
16539
|
-
emitChange(outputValue, e2);
|
|
16540
|
-
} else {
|
|
16541
|
-
const outputValue = Number(_checked) - Number(step);
|
|
16542
|
-
emitChange(outputValue, e2);
|
|
16543
|
-
}
|
|
16544
|
-
} else {
|
|
16545
|
-
onOverlimit && onOverlimit(e2);
|
|
16517
|
+
if (max2 !== void 0) {
|
|
16518
|
+
res = Math.min(Number(max2), res);
|
|
16546
16519
|
}
|
|
16520
|
+
return res;
|
|
16547
16521
|
};
|
|
16548
|
-
const
|
|
16549
|
-
|
|
16550
|
-
|
|
16551
|
-
|
|
16552
|
-
|
|
16553
|
-
|
|
16554
|
-
|
|
16555
|
-
|
|
16556
|
-
} else {
|
|
16557
|
-
const outputValue = Number(_checked) + Number(step);
|
|
16558
|
-
emitChange(outputValue, e2);
|
|
16559
|
-
}
|
|
16560
|
-
} else {
|
|
16561
|
-
onOverlimit && onOverlimit(e2);
|
|
16522
|
+
const format2 = (value2) => {
|
|
16523
|
+
if (value2 === null)
|
|
16524
|
+
return "";
|
|
16525
|
+
if (typeof value2 === "string")
|
|
16526
|
+
value2 = parseFloat(value2);
|
|
16527
|
+
const fixedValue = bound2(value2, Number(min), Number(max));
|
|
16528
|
+
if (formatter) {
|
|
16529
|
+
return formatter(fixedValue);
|
|
16562
16530
|
}
|
|
16563
|
-
|
|
16564
|
-
|
|
16565
|
-
const input = e2.target;
|
|
16566
|
-
onChange && onChange(input.valueAsNumber, e2);
|
|
16567
|
-
if (!async) {
|
|
16568
|
-
if (Number.isNaN(input.valueAsNumber)) {
|
|
16569
|
-
setChecked("");
|
|
16570
|
-
} else {
|
|
16571
|
-
setChecked(input.valueAsNumber);
|
|
16572
|
-
}
|
|
16531
|
+
if (digits) {
|
|
16532
|
+
return fixedValue.toFixed(digits).toString();
|
|
16573
16533
|
}
|
|
16534
|
+
return fixedValue.toString();
|
|
16574
16535
|
};
|
|
16575
|
-
const
|
|
16576
|
-
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
if (!numReg.test(input[0]) && numValue) {
|
|
16581
|
-
setChecked(formatter(numValue));
|
|
16582
|
-
} else if (!numReg.test(input[0]) && !numValue) {
|
|
16583
|
-
setChecked(input);
|
|
16584
|
-
} else if (numReg.test(input[0])) {
|
|
16585
|
-
if (formatter(numValue) === inputRef.current) {
|
|
16586
|
-
setChecked(numValue);
|
|
16587
|
-
} else {
|
|
16588
|
-
setChecked(formatter(numValue));
|
|
16589
|
-
inputRef.current = formatter(numValue);
|
|
16590
|
-
}
|
|
16591
|
-
}
|
|
16536
|
+
const [inputValue, setInputValue] = React.useState(format2(shadowValue));
|
|
16537
|
+
React.useEffect(() => {
|
|
16538
|
+
if (!focused && !async) {
|
|
16539
|
+
setShadowValue(bound2(Number(shadowValue), Number(min), Number(max)));
|
|
16540
|
+
setInputValue(format2(shadowValue));
|
|
16592
16541
|
}
|
|
16593
|
-
};
|
|
16594
|
-
|
|
16595
|
-
|
|
16596
|
-
|
|
16597
|
-
|
|
16598
|
-
|
|
16599
|
-
|
|
16600
|
-
|
|
16601
|
-
|
|
16602
|
-
|
|
16603
|
-
|
|
16604
|
-
|
|
16542
|
+
}, [focused, shadowValue]);
|
|
16543
|
+
React.useEffect(() => {
|
|
16544
|
+
if (async) {
|
|
16545
|
+
setShadowValue(bound2(Number(value), Number(min), Number(max)));
|
|
16546
|
+
setInputValue(format2(value));
|
|
16547
|
+
}
|
|
16548
|
+
}, [value]);
|
|
16549
|
+
const calcNextValue = (current, step2, symbol) => {
|
|
16550
|
+
const dig = digits + 1;
|
|
16551
|
+
return (parseFloat(current || "0") * dig + parseFloat(step2) * dig * symbol) / dig;
|
|
16552
|
+
};
|
|
16553
|
+
const update2 = (negative, e2) => {
|
|
16554
|
+
if (step !== void 0) {
|
|
16555
|
+
const shouldOverBoundary = calcNextValue(
|
|
16556
|
+
shadowValue,
|
|
16557
|
+
step,
|
|
16558
|
+
negative ? -1 : 1
|
|
16559
|
+
);
|
|
16560
|
+
const nextValue = bound2(shouldOverBoundary, Number(min), Number(max));
|
|
16561
|
+
setShadowValue(nextValue);
|
|
16562
|
+
if (negative ? shouldOverBoundary < min : shouldOverBoundary > max) {
|
|
16563
|
+
onOverlimit == null ? void 0 : onOverlimit(e2);
|
|
16564
|
+
} else {
|
|
16565
|
+
onChange == null ? void 0 : onChange(nextValue, e2);
|
|
16605
16566
|
}
|
|
16606
16567
|
}
|
|
16607
16568
|
};
|
|
16608
|
-
const
|
|
16569
|
+
const handleReduce = (e2) => {
|
|
16609
16570
|
if (disabled)
|
|
16610
16571
|
return;
|
|
16611
|
-
|
|
16612
|
-
|
|
16613
|
-
onFocus && onFocus(e2);
|
|
16572
|
+
onMinus == null ? void 0 : onMinus(e2);
|
|
16573
|
+
update2(true, e2);
|
|
16614
16574
|
};
|
|
16615
|
-
const
|
|
16575
|
+
const handlePlus = (e2) => {
|
|
16616
16576
|
if (disabled)
|
|
16617
16577
|
return;
|
|
16618
|
-
|
|
16619
|
-
|
|
16620
|
-
|
|
16621
|
-
|
|
16622
|
-
if (
|
|
16623
|
-
|
|
16578
|
+
onPlus == null ? void 0 : onPlus(e2);
|
|
16579
|
+
update2(false, e2);
|
|
16580
|
+
};
|
|
16581
|
+
const parseValue = (text) => {
|
|
16582
|
+
if (text === "")
|
|
16583
|
+
return null;
|
|
16584
|
+
if (text === "-")
|
|
16585
|
+
return null;
|
|
16586
|
+
return text;
|
|
16587
|
+
};
|
|
16588
|
+
const handleInputChange = (e2) => {
|
|
16589
|
+
setInputValue(e2.target.value);
|
|
16590
|
+
const valueStr = parseValue(e2.target.value);
|
|
16591
|
+
if (valueStr === null) {
|
|
16592
|
+
if (allowEmpty) {
|
|
16593
|
+
setShadowValue(null);
|
|
16594
|
+
} else {
|
|
16595
|
+
setShadowValue(defaultValue);
|
|
16596
|
+
}
|
|
16597
|
+
} else {
|
|
16598
|
+
setShadowValue(valueStr);
|
|
16624
16599
|
}
|
|
16625
|
-
if (
|
|
16626
|
-
|
|
16627
|
-
} else if (value2 > Number(max)) {
|
|
16628
|
-
value2 = Number(max);
|
|
16600
|
+
if (!async) {
|
|
16601
|
+
onChange == null ? void 0 : onChange(parseFloat(valueStr || "0").toFixed(digits), e2);
|
|
16629
16602
|
}
|
|
16630
|
-
|
|
16603
|
+
};
|
|
16604
|
+
const handleFocus = (e2) => {
|
|
16605
|
+
setFocused(true);
|
|
16606
|
+
setInputValue(
|
|
16607
|
+
shadowValue !== void 0 && shadowValue !== null ? bound2(Number(shadowValue), Number(min), Number(max)).toString() : ""
|
|
16608
|
+
);
|
|
16609
|
+
onFocus && onFocus(e2);
|
|
16610
|
+
};
|
|
16611
|
+
const handleBlur = (e2) => {
|
|
16612
|
+
setFocused(false);
|
|
16631
16613
|
onBlur && onBlur(e2);
|
|
16614
|
+
if (async) {
|
|
16615
|
+
const valueStr = parseValue(e2.target.value);
|
|
16616
|
+
onChange == null ? void 0 : onChange(parseFloat(valueStr || "0").toFixed(digits), e2);
|
|
16617
|
+
}
|
|
16632
16618
|
};
|
|
16633
|
-
return /* @__PURE__ */ React.createElement("div", { className: classes, style
|
|
16619
|
+
return /* @__PURE__ */ React.createElement("div", { className: classes, style, ...restProps }, /* @__PURE__ */ React.createElement("div", { className: "nut-input-minus" }, /* @__PURE__ */ React.createElement(
|
|
16634
16620
|
o,
|
|
16635
16621
|
{
|
|
16636
|
-
className:
|
|
16637
|
-
|
|
16622
|
+
className: classNames("nut-inputnumber-icon icon-minus", {
|
|
16623
|
+
[`${classPrefix$g}-icon-disabled`]: shadowValue === min || disabled
|
|
16624
|
+
}),
|
|
16625
|
+
onClick: handleReduce
|
|
16638
16626
|
}
|
|
16639
|
-
)), /* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
16627
|
+
)), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
16640
16628
|
"input",
|
|
16641
16629
|
{
|
|
16642
|
-
|
|
16643
|
-
|
|
16644
|
-
max,
|
|
16630
|
+
ref: inputRef,
|
|
16631
|
+
inputMode: "decimal",
|
|
16645
16632
|
disabled,
|
|
16646
16633
|
readOnly,
|
|
16647
|
-
value:
|
|
16648
|
-
onInput:
|
|
16649
|
-
onBlur:
|
|
16650
|
-
onFocus:
|
|
16634
|
+
value: inputValue,
|
|
16635
|
+
onInput: handleInputChange,
|
|
16636
|
+
onBlur: handleBlur,
|
|
16637
|
+
onFocus: handleFocus
|
|
16651
16638
|
}
|
|
16652
|
-
) : /* @__PURE__ */ React.createElement(
|
|
16653
|
-
|
|
16639
|
+
)), /* @__PURE__ */ React.createElement("div", { className: "nut-input-add" }, /* @__PURE__ */ React.createElement(
|
|
16640
|
+
l$2,
|
|
16654
16641
|
{
|
|
16655
|
-
|
|
16656
|
-
|
|
16657
|
-
|
|
16658
|
-
|
|
16659
|
-
readOnly,
|
|
16660
|
-
value: _checked,
|
|
16661
|
-
onInput: changeValue,
|
|
16662
|
-
onBlur: burValue,
|
|
16663
|
-
onFocus: focusValue
|
|
16642
|
+
className: classNames("nut-inputnumber-icon icon-plus", {
|
|
16643
|
+
[`${classPrefix$g}-icon-disabled`]: shadowValue === max || disabled
|
|
16644
|
+
}),
|
|
16645
|
+
onClick: handlePlus
|
|
16664
16646
|
}
|
|
16665
|
-
))
|
|
16647
|
+
)));
|
|
16666
16648
|
};
|
|
16667
16649
|
InputNumber.defaultProps = defaultProps$U;
|
|
16668
16650
|
InputNumber.displayName = "NutInputNumber";
|
|
@@ -18127,13 +18109,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18127
18109
|
// 1~6
|
|
18128
18110
|
autoFocus: false
|
|
18129
18111
|
};
|
|
18130
|
-
const
|
|
18112
|
+
const InternalShortPassword = (props, ref) => {
|
|
18131
18113
|
const { locale } = useConfig();
|
|
18132
18114
|
const {
|
|
18133
18115
|
title,
|
|
18134
18116
|
description,
|
|
18135
18117
|
tips,
|
|
18136
|
-
visible,
|
|
18118
|
+
visible: deleteVisible,
|
|
18137
18119
|
value,
|
|
18138
18120
|
error,
|
|
18139
18121
|
hideFooter,
|
|
@@ -18164,6 +18146,24 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18164
18146
|
const format2 = (val) => {
|
|
18165
18147
|
return val.slice(0, comLen);
|
|
18166
18148
|
};
|
|
18149
|
+
const [visible, setVisible] = usePropsValue({
|
|
18150
|
+
value: props.visible,
|
|
18151
|
+
defaultValue: false,
|
|
18152
|
+
finalValue: false
|
|
18153
|
+
});
|
|
18154
|
+
const handleClose = () => {
|
|
18155
|
+
onClose == null ? void 0 : onClose();
|
|
18156
|
+
setVisible(false);
|
|
18157
|
+
};
|
|
18158
|
+
const actions = {
|
|
18159
|
+
open: () => {
|
|
18160
|
+
setVisible(true);
|
|
18161
|
+
},
|
|
18162
|
+
close: () => {
|
|
18163
|
+
setVisible(false);
|
|
18164
|
+
}
|
|
18165
|
+
};
|
|
18166
|
+
React.useImperativeHandle(ref, () => actions);
|
|
18167
18167
|
const [inputValue, setInputValue] = usePropsValue({ value, onChange });
|
|
18168
18168
|
React.useEffect(() => {
|
|
18169
18169
|
if (visible && autoFocus) {
|
|
@@ -18190,17 +18190,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18190
18190
|
},
|
|
18191
18191
|
visible,
|
|
18192
18192
|
closeable: true,
|
|
18193
|
-
onOverlayClick:
|
|
18194
|
-
onCloseIconClick:
|
|
18193
|
+
onOverlayClick: handleClose,
|
|
18194
|
+
onCloseIconClick: handleClose,
|
|
18195
18195
|
...rest
|
|
18196
18196
|
},
|
|
18197
18197
|
/* @__PURE__ */ React.createElement("div", { className: classNames(classPrefix2, className), style }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-title` }, title || locale.shortpassword.title), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-description` }, description || locale.shortpassword.description), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-input`, onClick: onFocus }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-input-site` }), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-input-fake` }, [...new Array(comLen).keys()].map((item, index) => {
|
|
18198
18198
|
return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-input-fake-li`, key: index }, inputValue.length > index && /* @__PURE__ */ React.createElement(React.Fragment, null, plain ? inputValue[index] : /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-input-fake-li-icon` })));
|
|
18199
|
-
}))), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-message` }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-message-error` }, error), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-message-forget`, onClick: onTips }, tips || /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(s, { width: 11, height: 11
|
|
18199
|
+
}))), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-message` }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-message-error` }, error), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-message-forget`, onClick: onTips }, tips || /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(s, { width: 11, height: 11 }), locale.shortpassword.tips))), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-footer` }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-footer-cancel`, onClick: onCancel }, locale.cancel), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-footer-sure`, onClick: sure }, locale.confirm)))
|
|
18200
18200
|
);
|
|
18201
18201
|
};
|
|
18202
|
-
ShortPassword
|
|
18203
|
-
ShortPassword.displayName = "NutShortPassword";
|
|
18202
|
+
const ShortPassword = React.forwardRef(InternalShortPassword);
|
|
18204
18203
|
const defaultProps$K = {
|
|
18205
18204
|
...ComponentDefaults,
|
|
18206
18205
|
type: "png",
|
|
@@ -19176,6 +19175,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19176
19175
|
return /* @__PURE__ */ React.createElement(
|
|
19177
19176
|
Popup,
|
|
19178
19177
|
{
|
|
19178
|
+
...rest,
|
|
19179
19179
|
round: true,
|
|
19180
19180
|
visible,
|
|
19181
19181
|
position: "bottom",
|
|
@@ -19186,7 +19186,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19186
19186
|
onCancel && onCancel();
|
|
19187
19187
|
}
|
|
19188
19188
|
},
|
|
19189
|
-
/* @__PURE__ */ React.createElement("div", { className: `${className}`, style
|
|
19189
|
+
/* @__PURE__ */ React.createElement("div", { className: `${className}`, style }, options2.length ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-list` }, options2.map((item, index) => {
|
|
19190
19190
|
return /* @__PURE__ */ React.createElement(
|
|
19191
19191
|
"div",
|
|
19192
19192
|
{
|
|
@@ -20919,7 +20919,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20919
20919
|
axis: "y",
|
|
20920
20920
|
target: elementRef,
|
|
20921
20921
|
enabled: !props.disabled,
|
|
20922
|
-
eventOptions:
|
|
20922
|
+
eventOptions: false
|
|
20923
20923
|
}
|
|
20924
20924
|
);
|
|
20925
20925
|
const renderIcons = (status2) => {
|
|
@@ -21136,7 +21136,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
21136
21136
|
const classPrefix2 = "nut-skeleton";
|
|
21137
21137
|
const classes = classNames(classPrefix2, className);
|
|
21138
21138
|
const avatarClass = classNames({
|
|
21139
|
-
avatar: true,
|
|
21139
|
+
[`nut-avatar`]: true,
|
|
21140
21140
|
[`avatar-${avatarShape}`]: avatarShape
|
|
21141
21141
|
});
|
|
21142
21142
|
const repeatLines = (num) => {
|
|
@@ -21154,7 +21154,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
21154
21154
|
height: "50px"
|
|
21155
21155
|
};
|
|
21156
21156
|
};
|
|
21157
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, visible ? /* @__PURE__ */ React.createElement(
|
|
21157
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, visible ? /* @__PURE__ */ React.createElement(React.Fragment, null, children) : /* @__PURE__ */ React.createElement("div", { className: classes, ...rest }, animated2 && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-animation` }), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-content` }, avatar && /* @__PURE__ */ React.createElement(
|
|
21158
21158
|
Avatar,
|
|
21159
21159
|
{
|
|
21160
21160
|
className: avatarClass,
|
|
@@ -24505,6 +24505,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
24505
24505
|
const barrageCWidth = React.useRef(0);
|
|
24506
24506
|
const timer = React.useRef(0);
|
|
24507
24507
|
const index = React.useRef(0);
|
|
24508
|
+
const times = React.useRef([]);
|
|
24509
|
+
const historyIndex = React.useRef(-1);
|
|
24508
24510
|
const classes = classNames(classPrefix$1, className);
|
|
24509
24511
|
React.useImperativeHandle(ref, () => ({
|
|
24510
24512
|
add: (word) => {
|
|
@@ -24535,9 +24537,15 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
24535
24537
|
}, [list]);
|
|
24536
24538
|
const run = () => {
|
|
24537
24539
|
clearInterval(timer.current);
|
|
24540
|
+
let intervalCache = interval;
|
|
24541
|
+
const _index = (loop2 ? index.current % list.length : index.current) % rows;
|
|
24542
|
+
const result = times.current[_index] - rows * interval;
|
|
24543
|
+
if (result > 0) {
|
|
24544
|
+
intervalCache += result;
|
|
24545
|
+
}
|
|
24538
24546
|
timer.current = window.setTimeout(() => {
|
|
24539
24547
|
play();
|
|
24540
|
-
},
|
|
24548
|
+
}, intervalCache);
|
|
24541
24549
|
};
|
|
24542
24550
|
const play = () => {
|
|
24543
24551
|
if (!loop2 && index.current >= list.length) {
|
|
@@ -24545,14 +24553,23 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
24545
24553
|
}
|
|
24546
24554
|
const _index = loop2 ? index.current % list.length : index.current;
|
|
24547
24555
|
const el = document.createElement(`div`);
|
|
24556
|
+
let currentIndex = _index % rows;
|
|
24557
|
+
if (currentIndex <= historyIndex.current || historyIndex.current === 3 && currentIndex !== 0 || Math.abs(currentIndex - historyIndex.current) !== 1) {
|
|
24558
|
+
currentIndex = historyIndex.current + 1 >= rows ? 0 : historyIndex.current + 1;
|
|
24559
|
+
}
|
|
24560
|
+
historyIndex.current = currentIndex;
|
|
24548
24561
|
el.innerHTML = list[_index];
|
|
24549
24562
|
el.classList.add("barrage-item");
|
|
24550
24563
|
barrageContainer.current.appendChild(el);
|
|
24551
24564
|
const width = el.offsetWidth;
|
|
24552
24565
|
const height = el.offsetHeight;
|
|
24553
24566
|
el.classList.add("move");
|
|
24554
|
-
|
|
24555
|
-
|
|
24567
|
+
const elScrollDuration = Math.ceil(
|
|
24568
|
+
width / barrageCWidth.current * duration
|
|
24569
|
+
);
|
|
24570
|
+
times.current[currentIndex] = elScrollDuration;
|
|
24571
|
+
el.style.animationDuration = `${duration + elScrollDuration}ms`;
|
|
24572
|
+
el.style.top = `${currentIndex * (height + gapY) + 20}px`;
|
|
24556
24573
|
el.style.width = `${width}px`;
|
|
24557
24574
|
el.addEventListener("animationend", () => {
|
|
24558
24575
|
barrageContainer.current.removeChild(el);
|