@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.
- package/CHANGELOG.md +13 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/Address/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/Cascader/style/style.css +1 -1
- package/dist/esm/DatePicker/style/style.css +1 -1
- package/dist/esm/ImagePreview/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/ShortPassword/style/style.css +1 -1
- package/dist/esm/ShortPassword.js +27 -8
- package/dist/esm/SideNavBar/style/style.css +1 -1
- package/dist/esm/Tabs/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/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/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 +85 -18
- package/dist/nutui.react.umd.js +85 -18
- package/dist/packages/barrage/barrage.scss +1 -1
- package/dist/packages/popup/popup.scss +1 -0
- package/dist/packages/tabs/tabs.scss +14 -14
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- 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/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 +1 -1
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.10 Tue Feb 06 2024 16:12:46 GMT+0800 (China Standard Time)
|
|
12
12
|
* (c) 2023 @jdf2e.
|
|
13
13
|
* Released under the MIT License.
|
|
14
14
|
*/
|
|
@@ -15804,6 +15804,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15804
15804
|
constructor() {
|
|
15805
15805
|
// 初始化数据
|
|
15806
15806
|
__publicField(this, "initialValues", {});
|
|
15807
|
+
__publicField(this, "updateList", []);
|
|
15807
15808
|
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
15808
15809
|
__publicField(this, "store", {});
|
|
15809
15810
|
// 所有的组件实例
|
|
@@ -15873,6 +15874,15 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15873
15874
|
}
|
|
15874
15875
|
});
|
|
15875
15876
|
});
|
|
15877
|
+
this.updateList.forEach((item) => {
|
|
15878
|
+
let shouldUpdate = item.condition;
|
|
15879
|
+
if (typeof item.condition === "function") {
|
|
15880
|
+
shouldUpdate = item.condition();
|
|
15881
|
+
}
|
|
15882
|
+
if (shouldUpdate) {
|
|
15883
|
+
item.entity.onStoreChange("update");
|
|
15884
|
+
}
|
|
15885
|
+
});
|
|
15876
15886
|
});
|
|
15877
15887
|
__publicField(this, "setCallback", (callback) => {
|
|
15878
15888
|
this.callbacks = {
|
|
@@ -15938,6 +15948,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15938
15948
|
entity.onStoreChange("reset");
|
|
15939
15949
|
});
|
|
15940
15950
|
});
|
|
15951
|
+
// 监听事件
|
|
15952
|
+
__publicField(this, "registerUpdate", (field, shouldUpdate) => {
|
|
15953
|
+
this.updateList.push({
|
|
15954
|
+
entity: field,
|
|
15955
|
+
condition: shouldUpdate
|
|
15956
|
+
});
|
|
15957
|
+
return () => {
|
|
15958
|
+
this.updateList = this.updateList.filter((i) => i.entity !== field);
|
|
15959
|
+
};
|
|
15960
|
+
});
|
|
15941
15961
|
__publicField(this, "dispatch", ({ name }) => {
|
|
15942
15962
|
this.validateFields([name]);
|
|
15943
15963
|
});
|
|
@@ -15949,7 +15969,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15949
15969
|
setInitialValues: this.setInitialValues,
|
|
15950
15970
|
dispatch: this.dispatch,
|
|
15951
15971
|
store: this.store,
|
|
15952
|
-
fieldEntities: this.fieldEntities
|
|
15972
|
+
fieldEntities: this.fieldEntities,
|
|
15973
|
+
registerUpdate: this.registerUpdate
|
|
15953
15974
|
};
|
|
15954
15975
|
}
|
|
15955
15976
|
});
|
|
@@ -16080,13 +16101,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16080
16101
|
label: "",
|
|
16081
16102
|
rules: [{ required: false, message: "" }],
|
|
16082
16103
|
errorMessageAlign: "left",
|
|
16083
|
-
validateTrigger: "onChange"
|
|
16104
|
+
validateTrigger: "onChange",
|
|
16105
|
+
shouldUpdate: false,
|
|
16106
|
+
noStyle: false
|
|
16084
16107
|
};
|
|
16085
16108
|
class FormItem extends React.Component {
|
|
16086
16109
|
constructor(props) {
|
|
16087
16110
|
super(props);
|
|
16088
16111
|
__publicField(this, "cancelRegister");
|
|
16089
16112
|
__publicField(this, "componentRef");
|
|
16113
|
+
__publicField(this, "eventOff");
|
|
16090
16114
|
// children添加value属性和onChange事件
|
|
16091
16115
|
__publicField(this, "getControlled", (children) => {
|
|
16092
16116
|
var _a2;
|
|
@@ -16201,22 +16225,31 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16201
16225
|
};
|
|
16202
16226
|
}
|
|
16203
16227
|
componentDidMount() {
|
|
16204
|
-
const { registerField } = this.context.getInternal(SECRET);
|
|
16228
|
+
const { registerField, registerUpdate } = this.context.getInternal(SECRET);
|
|
16205
16229
|
this.cancelRegister = registerField(this);
|
|
16230
|
+
this.eventOff = registerUpdate(this, this.props.shouldUpdate);
|
|
16206
16231
|
}
|
|
16207
16232
|
componentWillUnmount() {
|
|
16208
16233
|
if (this.cancelRegister) {
|
|
16209
16234
|
this.cancelRegister();
|
|
16210
16235
|
}
|
|
16236
|
+
if (this.eventOff) {
|
|
16237
|
+
this.eventOff();
|
|
16238
|
+
}
|
|
16211
16239
|
}
|
|
16212
16240
|
render() {
|
|
16213
16241
|
const { children } = this.props;
|
|
16214
16242
|
const child = Array.isArray(children) ? children[0] : children;
|
|
16215
|
-
|
|
16216
|
-
|
|
16217
|
-
|
|
16218
|
-
|
|
16219
|
-
|
|
16243
|
+
let returnChildNode;
|
|
16244
|
+
if (!this.props.shouldUpdate) {
|
|
16245
|
+
returnChildNode = React.cloneElement(
|
|
16246
|
+
child,
|
|
16247
|
+
this.getControlled(child)
|
|
16248
|
+
);
|
|
16249
|
+
} else {
|
|
16250
|
+
returnChildNode = child(this.context);
|
|
16251
|
+
}
|
|
16252
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, { key: this.state.resetCount }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode));
|
|
16220
16253
|
}
|
|
16221
16254
|
}
|
|
16222
16255
|
__publicField(FormItem, "defaultProps", defaultProps$W);
|
|
@@ -18127,13 +18160,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18127
18160
|
// 1~6
|
|
18128
18161
|
autoFocus: false
|
|
18129
18162
|
};
|
|
18130
|
-
const
|
|
18163
|
+
const InternalShortPassword = (props, ref) => {
|
|
18131
18164
|
const { locale } = useConfig();
|
|
18132
18165
|
const {
|
|
18133
18166
|
title,
|
|
18134
18167
|
description,
|
|
18135
18168
|
tips,
|
|
18136
|
-
visible,
|
|
18169
|
+
visible: deleteVisible,
|
|
18137
18170
|
value,
|
|
18138
18171
|
error,
|
|
18139
18172
|
hideFooter,
|
|
@@ -18164,6 +18197,24 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18164
18197
|
const format2 = (val) => {
|
|
18165
18198
|
return val.slice(0, comLen);
|
|
18166
18199
|
};
|
|
18200
|
+
const [visible, setVisible] = usePropsValue({
|
|
18201
|
+
value: props.visible,
|
|
18202
|
+
defaultValue: false,
|
|
18203
|
+
finalValue: false
|
|
18204
|
+
});
|
|
18205
|
+
const handleClose = () => {
|
|
18206
|
+
onClose == null ? void 0 : onClose();
|
|
18207
|
+
setVisible(false);
|
|
18208
|
+
};
|
|
18209
|
+
const actions = {
|
|
18210
|
+
open: () => {
|
|
18211
|
+
setVisible(true);
|
|
18212
|
+
},
|
|
18213
|
+
close: () => {
|
|
18214
|
+
setVisible(false);
|
|
18215
|
+
}
|
|
18216
|
+
};
|
|
18217
|
+
React.useImperativeHandle(ref, () => actions);
|
|
18167
18218
|
const [inputValue, setInputValue] = usePropsValue({ value, onChange });
|
|
18168
18219
|
React.useEffect(() => {
|
|
18169
18220
|
if (visible && autoFocus) {
|
|
@@ -18190,8 +18241,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18190
18241
|
},
|
|
18191
18242
|
visible,
|
|
18192
18243
|
closeable: true,
|
|
18193
|
-
onOverlayClick:
|
|
18194
|
-
onCloseIconClick:
|
|
18244
|
+
onOverlayClick: handleClose,
|
|
18245
|
+
onCloseIconClick: handleClose,
|
|
18195
18246
|
...rest
|
|
18196
18247
|
},
|
|
18197
18248
|
/* @__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) => {
|
|
@@ -18199,8 +18250,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18199
18250
|
}))), /* @__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, style: { marginRight: "3px" } }), 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
18251
|
);
|
|
18201
18252
|
};
|
|
18202
|
-
ShortPassword
|
|
18203
|
-
ShortPassword.displayName = "NutShortPassword";
|
|
18253
|
+
const ShortPassword = React.forwardRef(InternalShortPassword);
|
|
18204
18254
|
const defaultProps$K = {
|
|
18205
18255
|
...ComponentDefaults,
|
|
18206
18256
|
type: "png",
|
|
@@ -24505,6 +24555,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
24505
24555
|
const barrageCWidth = React.useRef(0);
|
|
24506
24556
|
const timer = React.useRef(0);
|
|
24507
24557
|
const index = React.useRef(0);
|
|
24558
|
+
const times = React.useRef([]);
|
|
24559
|
+
const historyIndex = React.useRef(-1);
|
|
24508
24560
|
const classes = classNames(classPrefix$1, className);
|
|
24509
24561
|
React.useImperativeHandle(ref, () => ({
|
|
24510
24562
|
add: (word) => {
|
|
@@ -24535,9 +24587,15 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
24535
24587
|
}, [list]);
|
|
24536
24588
|
const run = () => {
|
|
24537
24589
|
clearInterval(timer.current);
|
|
24590
|
+
let intervalCache = interval;
|
|
24591
|
+
const _index = (loop2 ? index.current % list.length : index.current) % rows;
|
|
24592
|
+
const result = times.current[_index] - rows * interval;
|
|
24593
|
+
if (result > 0) {
|
|
24594
|
+
intervalCache += result;
|
|
24595
|
+
}
|
|
24538
24596
|
timer.current = window.setTimeout(() => {
|
|
24539
24597
|
play();
|
|
24540
|
-
},
|
|
24598
|
+
}, intervalCache);
|
|
24541
24599
|
};
|
|
24542
24600
|
const play = () => {
|
|
24543
24601
|
if (!loop2 && index.current >= list.length) {
|
|
@@ -24545,14 +24603,23 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
24545
24603
|
}
|
|
24546
24604
|
const _index = loop2 ? index.current % list.length : index.current;
|
|
24547
24605
|
const el = document.createElement(`div`);
|
|
24606
|
+
let currentIndex = _index % rows;
|
|
24607
|
+
if (currentIndex <= historyIndex.current || historyIndex.current === 3 && currentIndex !== 0 || Math.abs(currentIndex - historyIndex.current) !== 1) {
|
|
24608
|
+
currentIndex = historyIndex.current + 1 >= rows ? 0 : historyIndex.current + 1;
|
|
24609
|
+
}
|
|
24610
|
+
historyIndex.current = currentIndex;
|
|
24548
24611
|
el.innerHTML = list[_index];
|
|
24549
24612
|
el.classList.add("barrage-item");
|
|
24550
24613
|
barrageContainer.current.appendChild(el);
|
|
24551
24614
|
const width = el.offsetWidth;
|
|
24552
24615
|
const height = el.offsetHeight;
|
|
24553
24616
|
el.classList.add("move");
|
|
24554
|
-
|
|
24555
|
-
|
|
24617
|
+
const elScrollDuration = Math.ceil(
|
|
24618
|
+
width / barrageCWidth.current * duration
|
|
24619
|
+
);
|
|
24620
|
+
times.current[currentIndex] = elScrollDuration;
|
|
24621
|
+
el.style.animationDuration = `${duration + elScrollDuration}ms`;
|
|
24622
|
+
el.style.top = `${currentIndex * (height + gapY) + 20}px`;
|
|
24556
24623
|
el.style.width = `${width}px`;
|
|
24557
24624
|
el.addEventListener("animationend", () => {
|
|
24558
24625
|
barrageContainer.current.removeChild(el);
|
|
@@ -28,10 +28,16 @@
|
|
|
28
28
|
|
|
29
29
|
&-left {
|
|
30
30
|
justify-content: flex-start;
|
|
31
|
+
.nut-tabs-titles-item {
|
|
32
|
+
padding: 0 10px;
|
|
33
|
+
}
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
&-right {
|
|
34
37
|
justify-content: flex-end;
|
|
38
|
+
.nut-tabs-titles-item {
|
|
39
|
+
padding: 0 10px;
|
|
40
|
+
}
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
&-scrollable {
|
|
@@ -45,19 +51,15 @@
|
|
|
45
51
|
align-items: center;
|
|
46
52
|
justify-content: center;
|
|
47
53
|
flex: 1 0 auto;
|
|
48
|
-
padding: 0 10px;
|
|
49
54
|
margin: 0 $tabs-titles-gap;
|
|
55
|
+
height: $tabs-titles-height;
|
|
56
|
+
line-height: $tabs-titles-height;
|
|
50
57
|
min-width: $tabs-titles-item-min-width;
|
|
51
58
|
font-size: $tabs-titles-font-size;
|
|
52
59
|
color: $tabs-titles-item-color;
|
|
53
60
|
text-overflow: ellipsis;
|
|
54
61
|
white-space: nowrap;
|
|
55
62
|
|
|
56
|
-
&.taro {
|
|
57
|
-
height: 44px;
|
|
58
|
-
line-height: 44px;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
63
|
&-left,
|
|
62
64
|
&-right {
|
|
63
65
|
flex: none;
|
|
@@ -120,6 +122,10 @@
|
|
|
120
122
|
&:first-child {
|
|
121
123
|
margin-left: 0;
|
|
122
124
|
}
|
|
125
|
+
|
|
126
|
+
&:last-child {
|
|
127
|
+
margin-right: 0;
|
|
128
|
+
}
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
&-simple {
|
|
@@ -147,10 +153,7 @@
|
|
|
147
153
|
&-button {
|
|
148
154
|
.nut-tabs-titles-item {
|
|
149
155
|
&-active {
|
|
150
|
-
|
|
151
|
-
height: 28px;
|
|
152
|
-
}
|
|
153
|
-
|
|
156
|
+
height: 28px;
|
|
154
157
|
margin: 8px 9px;
|
|
155
158
|
background: $color-default-light;
|
|
156
159
|
color: $color-text;
|
|
@@ -261,6 +264,7 @@
|
|
|
261
264
|
|
|
262
265
|
.nut-tabs-titles-item {
|
|
263
266
|
height: $tabs-vertical-titles-item-height;
|
|
267
|
+
margin: 0;
|
|
264
268
|
flex: none;
|
|
265
269
|
|
|
266
270
|
&-smile {
|
|
@@ -300,10 +304,6 @@
|
|
|
300
304
|
transform: rotate(320deg);
|
|
301
305
|
}
|
|
302
306
|
}
|
|
303
|
-
|
|
304
|
-
&:first-child {
|
|
305
|
-
margin: 0 $tabs-titles-gap;
|
|
306
|
-
}
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
.nut-tabs-horizontal {
|