@nutui/nutui-react-taro 2.0.15 → 2.0.16
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/Address.js +2 -2
- package/dist/esm/Cascader.js +1 -1
- package/dist/esm/Cell.js +2 -2
- package/dist/esm/CellGroup.js +1 -1
- package/dist/esm/Dialog.js +2 -2
- package/dist/esm/Form.js +1274 -8
- package/dist/esm/FormItem.js +3 -3
- package/dist/esm/Notify.js +2 -2
- package/dist/esm/PullToRefresh.js +1 -1
- package/dist/esm/Swipe.js +2 -1
- package/dist/esm/Toast.js +2 -2
- package/dist/esm/{address.taro-b58603a5.js → address.taro-6d420871.js} +1 -1
- package/dist/esm/{cascader.taro-ec5179d6.js → cascader.taro-01ffbfb1.js} +1 -0
- package/dist/esm/cell.taro-010b73ed.js +55 -0
- package/dist/esm/{cellgroup.taro-d2fad5e7.js → cellgroup.taro-9dc59f11.js} +9 -3
- package/dist/esm/{dialog.taro-a1309ced.js → dialog.taro-1426fb49.js} +4 -4
- package/dist/esm/{formitem.taro-9e2d3898.js → formitem.taro-bb63ac0a.js} +1 -1
- package/dist/esm/{notify.taro-07e9ead7.js → notify.taro-6798c31f.js} +1 -1
- package/dist/esm/nutui-react.es.js +18 -18
- package/dist/esm/{pulltorefresh.taro-f3ab76c2.js → pulltorefresh.taro-d35571e8.js} +6 -4
- package/dist/esm/{swipe.taro-36f8782e.js → swipe.taro-2fa2479c.js} +4 -3
- package/dist/esm/{toast.taro-a907b5f5.js → toast.taro-44ebc833.js} +1 -1
- package/dist/esm/types/src/packages/cellgroup/context.d.ts +5 -0
- package/dist/esm/types/src/packages/dialog/config.d.ts +2 -1
- package/dist/esm/types/src/packages/dialog/content.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/form/form.d.ts +4 -8
- package/dist/esm/types/src/packages/form/form.taro.d.ts +4 -8
- package/dist/esm/types/src/packages/form/index.d.ts +11 -2
- package/dist/esm/types/src/packages/form/index.taro.d.ts +11 -2
- package/dist/esm/types/src/packages/form/types.d.ts +1 -0
- package/dist/esm/types/src/packages/swipe/swipe.taro.d.ts +5 -4
- package/dist/esm/types/src/utils/use-custom-event.d.ts +1 -1
- package/dist/esm/{use-custom-event-e1689884.js → use-custom-event-bb9c7f2e.js} +1 -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 +125 -101
- package/dist/nutui.react.umd.js +125 -101
- package/dist/style.mjs +1 -1
- package/dist/types/packages/cellgroup/context.d.ts +4 -0
- package/dist/types/packages/dialog/config.d.ts +2 -1
- package/dist/types/packages/dialog/content.taro.d.ts +2 -1
- package/dist/types/packages/form/form.taro.d.ts +4 -8
- package/dist/types/packages/form/index.taro.d.ts +11 -2
- package/dist/types/packages/form/types.d.ts +1 -0
- package/dist/types/packages/swipe/swipe.taro.d.ts +5 -4
- package/dist/types/utils/use-custom-event.d.ts +1 -1
- package/package.json +1 -1
- package/dist/esm/cell.taro-0a9f80bc.js +0 -50
- package/dist/esm/form.taro-6166be06.js +0 -1273
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.0.
|
|
8
|
+
* @nutui/nutui-react-taro v2.0.16 Wed Sep 06 2023 15:51:52 GMT+0800 (China Standard Time)
|
|
9
9
|
* (c) 2023 @jdf2e.
|
|
10
10
|
* Released under the MIT License.
|
|
11
11
|
*/
|
|
@@ -2003,6 +2003,7 @@ const Button = React__default.forwardRef(
|
|
|
2003
2003
|
}
|
|
2004
2004
|
);
|
|
2005
2005
|
Button.displayName = "NutButton";
|
|
2006
|
+
const CellGroupContext = createContext(null);
|
|
2006
2007
|
const defaultProps$1t = {
|
|
2007
2008
|
...ComponentDefaults,
|
|
2008
2009
|
title: "",
|
|
@@ -2020,7 +2021,7 @@ const CellGroup = (props) => {
|
|
|
2020
2021
|
{
|
|
2021
2022
|
className: `${classPrefix$p}__wrap ${divider ? `${classPrefix$p}__wrap--divider` : ""}`
|
|
2022
2023
|
},
|
|
2023
|
-
children
|
|
2024
|
+
/* @__PURE__ */ React__default.createElement(CellGroupContext.Provider, { value: { divider } }, children)
|
|
2024
2025
|
));
|
|
2025
2026
|
};
|
|
2026
2027
|
CellGroup.defaultProps = defaultProps$1t;
|
|
@@ -2037,6 +2038,7 @@ const defaultProps$1s = {
|
|
|
2037
2038
|
};
|
|
2038
2039
|
const classPrefix$o = "nut-cell";
|
|
2039
2040
|
const Cell = (props) => {
|
|
2041
|
+
const ctx = useContext(CellGroupContext);
|
|
2040
2042
|
const {
|
|
2041
2043
|
children,
|
|
2042
2044
|
onClick,
|
|
@@ -2078,7 +2080,8 @@ const Cell = (props) => {
|
|
|
2078
2080
|
style: styles
|
|
2079
2081
|
},
|
|
2080
2082
|
extra
|
|
2081
|
-
) : null,
|
|
2083
|
+
) : null),
|
|
2084
|
+
(ctx == null ? void 0 : ctx.divider) ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix$o}__divider` }) : null
|
|
2082
2085
|
);
|
|
2083
2086
|
};
|
|
2084
2087
|
Cell.defaultProps = defaultProps$1s;
|
|
@@ -7016,6 +7019,7 @@ class Tree {
|
|
|
7016
7019
|
constructor(nodes, config2) {
|
|
7017
7020
|
__publicField(this, "nodes");
|
|
7018
7021
|
__publicField(this, "config");
|
|
7022
|
+
// eslint-disable-next-line class-methods-use-this
|
|
7019
7023
|
__publicField(this, "isLeaf", (node, lazy) => {
|
|
7020
7024
|
const { leaf, children } = node;
|
|
7021
7025
|
const hasChildren = Array.isArray(children) && Boolean(children.length);
|
|
@@ -10985,6 +10989,83 @@ const useForm = (form) => {
|
|
|
10985
10989
|
}
|
|
10986
10990
|
return [formRef.current];
|
|
10987
10991
|
};
|
|
10992
|
+
const defaultProps$Y = {
|
|
10993
|
+
...ComponentDefaults,
|
|
10994
|
+
labelPosition: "right",
|
|
10995
|
+
starPosition: "left",
|
|
10996
|
+
divider: false,
|
|
10997
|
+
onFinish: (values) => {
|
|
10998
|
+
},
|
|
10999
|
+
onFinishFailed: (values, errorFields) => {
|
|
11000
|
+
}
|
|
11001
|
+
};
|
|
11002
|
+
const PositionInfo = {
|
|
11003
|
+
top: "form-layout-top",
|
|
11004
|
+
left: "form-layout-left",
|
|
11005
|
+
right: "form-layout-right"
|
|
11006
|
+
};
|
|
11007
|
+
const Form = React__default.forwardRef(
|
|
11008
|
+
(props, ref) => {
|
|
11009
|
+
const classPrefix2 = "nut-form";
|
|
11010
|
+
const {
|
|
11011
|
+
className,
|
|
11012
|
+
style,
|
|
11013
|
+
footer,
|
|
11014
|
+
children,
|
|
11015
|
+
initialValues,
|
|
11016
|
+
divider,
|
|
11017
|
+
onFinish,
|
|
11018
|
+
onFinishFailed,
|
|
11019
|
+
labelPosition,
|
|
11020
|
+
starPosition,
|
|
11021
|
+
form
|
|
11022
|
+
} = {
|
|
11023
|
+
...defaultProps$Y,
|
|
11024
|
+
...props
|
|
11025
|
+
};
|
|
11026
|
+
let formInstance;
|
|
11027
|
+
if (form !== void 0) {
|
|
11028
|
+
formInstance = form;
|
|
11029
|
+
} else {
|
|
11030
|
+
[formInstance] = useForm();
|
|
11031
|
+
}
|
|
11032
|
+
formInstance.starPosition = starPosition;
|
|
11033
|
+
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
11034
|
+
setCallback({
|
|
11035
|
+
onFinish,
|
|
11036
|
+
onFinishFailed
|
|
11037
|
+
});
|
|
11038
|
+
const mountRef = React__default.useRef(false);
|
|
11039
|
+
setInitialValues(initialValues, !mountRef.current);
|
|
11040
|
+
if (!mountRef.current) {
|
|
11041
|
+
mountRef.current = true;
|
|
11042
|
+
}
|
|
11043
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
11044
|
+
"form",
|
|
11045
|
+
{
|
|
11046
|
+
className: classNames(
|
|
11047
|
+
classPrefix2,
|
|
11048
|
+
className,
|
|
11049
|
+
PositionInfo[labelPosition]
|
|
11050
|
+
),
|
|
11051
|
+
style,
|
|
11052
|
+
onSubmit: (e) => {
|
|
11053
|
+
e.preventDefault();
|
|
11054
|
+
e.stopPropagation();
|
|
11055
|
+
submit();
|
|
11056
|
+
},
|
|
11057
|
+
onReset: (e) => {
|
|
11058
|
+
e.preventDefault();
|
|
11059
|
+
e.stopPropagation();
|
|
11060
|
+
resetFields();
|
|
11061
|
+
}
|
|
11062
|
+
},
|
|
11063
|
+
/* @__PURE__ */ React__default.createElement(Cell.Group, { divider }, /* @__PURE__ */ React__default.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React__default.createElement(Cell, null, footer) : null)
|
|
11064
|
+
);
|
|
11065
|
+
}
|
|
11066
|
+
);
|
|
11067
|
+
Form.defaultProps = defaultProps$Y;
|
|
11068
|
+
Form.displayName = "NutForm";
|
|
10988
11069
|
function isForwardRefComponent(component) {
|
|
10989
11070
|
return component.type && component.type.$$typeof && // eslint-disable-next-line react/display-name
|
|
10990
11071
|
React__default.forwardRef(
|
|
@@ -10994,7 +11075,7 @@ function isForwardRefComponent(component) {
|
|
|
10994
11075
|
}
|
|
10995
11076
|
).$$typeof === component.type.$$typeof;
|
|
10996
11077
|
}
|
|
10997
|
-
const defaultProps$
|
|
11078
|
+
const defaultProps$X = {
|
|
10998
11079
|
...ComponentDefaults,
|
|
10999
11080
|
required: false,
|
|
11000
11081
|
name: "",
|
|
@@ -11061,7 +11142,7 @@ class FormItem extends React__default.Component {
|
|
|
11061
11142
|
__publicField(this, "renderLayout", (childNode) => {
|
|
11062
11143
|
var _a, _b;
|
|
11063
11144
|
const { label, name, required: required4, className, style, errorMessageAlign } = {
|
|
11064
|
-
...defaultProps$
|
|
11145
|
+
...defaultProps$X,
|
|
11065
11146
|
...this.props
|
|
11066
11147
|
};
|
|
11067
11148
|
const item = ((_a = this.context.errors) == null ? void 0 : _a.length) > 0 && ((_b = this.context.errors) == null ? void 0 : _b.filter((item2) => {
|
|
@@ -11111,83 +11192,11 @@ class FormItem extends React__default.Component {
|
|
|
11111
11192
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: this.state.resetCount }, this.renderLayout(returnChildNode));
|
|
11112
11193
|
}
|
|
11113
11194
|
}
|
|
11114
|
-
__publicField(FormItem, "defaultProps", defaultProps$
|
|
11195
|
+
__publicField(FormItem, "defaultProps", defaultProps$X);
|
|
11115
11196
|
__publicField(FormItem, "contextType", Context);
|
|
11116
|
-
const
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
starPosition: "left",
|
|
11120
|
-
onFinish: (values) => {
|
|
11121
|
-
},
|
|
11122
|
-
onFinishFailed: (values, errorFields) => {
|
|
11123
|
-
}
|
|
11124
|
-
};
|
|
11125
|
-
const PositionInfo = {
|
|
11126
|
-
top: "form-layout-top",
|
|
11127
|
-
left: "form-layout-left",
|
|
11128
|
-
right: "form-layout-right"
|
|
11129
|
-
};
|
|
11130
|
-
const Form = (props) => {
|
|
11131
|
-
const classPrefix2 = "nut-form";
|
|
11132
|
-
const {
|
|
11133
|
-
className,
|
|
11134
|
-
style,
|
|
11135
|
-
footer,
|
|
11136
|
-
children,
|
|
11137
|
-
initialValues,
|
|
11138
|
-
onFinish,
|
|
11139
|
-
onFinishFailed,
|
|
11140
|
-
labelPosition,
|
|
11141
|
-
starPosition,
|
|
11142
|
-
form
|
|
11143
|
-
} = {
|
|
11144
|
-
...defaultProps$X,
|
|
11145
|
-
...props
|
|
11146
|
-
};
|
|
11147
|
-
let formInstance;
|
|
11148
|
-
if (form !== void 0) {
|
|
11149
|
-
formInstance = form;
|
|
11150
|
-
} else {
|
|
11151
|
-
[formInstance] = useForm();
|
|
11152
|
-
}
|
|
11153
|
-
formInstance.starPosition = starPosition;
|
|
11154
|
-
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
11155
|
-
setCallback({
|
|
11156
|
-
onFinish,
|
|
11157
|
-
onFinishFailed
|
|
11158
|
-
});
|
|
11159
|
-
const mountRef = React__default.useRef(false);
|
|
11160
|
-
setInitialValues(initialValues, !mountRef.current);
|
|
11161
|
-
if (!mountRef.current) {
|
|
11162
|
-
mountRef.current = true;
|
|
11163
|
-
}
|
|
11164
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
11165
|
-
"form",
|
|
11166
|
-
{
|
|
11167
|
-
className: classNames(
|
|
11168
|
-
classPrefix2,
|
|
11169
|
-
className,
|
|
11170
|
-
PositionInfo[labelPosition]
|
|
11171
|
-
),
|
|
11172
|
-
style,
|
|
11173
|
-
onSubmit: (e) => {
|
|
11174
|
-
e.preventDefault();
|
|
11175
|
-
e.stopPropagation();
|
|
11176
|
-
submit();
|
|
11177
|
-
},
|
|
11178
|
-
onReset: (e) => {
|
|
11179
|
-
e.preventDefault();
|
|
11180
|
-
e.stopPropagation();
|
|
11181
|
-
resetFields();
|
|
11182
|
-
}
|
|
11183
|
-
},
|
|
11184
|
-
/* @__PURE__ */ React__default.createElement(Cell.Group, null, /* @__PURE__ */ React__default.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React__default.createElement(Cell, null, footer) : null)
|
|
11185
|
-
);
|
|
11186
|
-
};
|
|
11187
|
-
Form.defaultProps = defaultProps$X;
|
|
11188
|
-
Form.displayName = "NutForm";
|
|
11189
|
-
Form.Item = FormItem;
|
|
11190
|
-
Form.useForm = useForm;
|
|
11197
|
+
const InnerForm = Form;
|
|
11198
|
+
InnerForm.Item = FormItem;
|
|
11199
|
+
InnerForm.useForm = useForm;
|
|
11191
11200
|
function trimExtraChar(value, char, regExp) {
|
|
11192
11201
|
const index = value.indexOf(char);
|
|
11193
11202
|
if (index === -1) {
|
|
@@ -14040,21 +14049,30 @@ const Content = (props) => {
|
|
|
14040
14049
|
const handleClick = (e) => {
|
|
14041
14050
|
onClick && onClick(e);
|
|
14042
14051
|
};
|
|
14043
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
14052
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14044
14053
|
"div",
|
|
14045
14054
|
{
|
|
14046
|
-
className: classPrefix2,
|
|
14047
|
-
style:
|
|
14055
|
+
className: classNames(`${classPrefix2}__outer`, props.className),
|
|
14056
|
+
style: props.style,
|
|
14057
|
+
onClick: (e) => handleClick(e)
|
|
14048
14058
|
},
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14059
|
+
/* @__PURE__ */ React__default.createElement(
|
|
14060
|
+
"div",
|
|
14061
|
+
{
|
|
14062
|
+
className: classPrefix2,
|
|
14063
|
+
style: { display: visible ? "flex" : "none" }
|
|
14064
|
+
},
|
|
14065
|
+
renderHeader(),
|
|
14066
|
+
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__content` }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children)),
|
|
14067
|
+
renderFooter()
|
|
14068
|
+
)
|
|
14069
|
+
);
|
|
14053
14070
|
};
|
|
14054
14071
|
Content.displayName = "NutContent";
|
|
14055
14072
|
const customEvents = new Events();
|
|
14056
14073
|
function useCustomEventsPath(selector) {
|
|
14057
14074
|
var _a;
|
|
14075
|
+
selector = selector || "";
|
|
14058
14076
|
const path = (_a = getCurrentInstance().router) == null ? void 0 : _a.path;
|
|
14059
14077
|
return path ? `${path}__${selector}` : selector;
|
|
14060
14078
|
}
|
|
@@ -14114,6 +14132,8 @@ const BaseDialog = (props) => {
|
|
|
14114
14132
|
const {
|
|
14115
14133
|
params: {
|
|
14116
14134
|
id,
|
|
14135
|
+
className,
|
|
14136
|
+
style,
|
|
14117
14137
|
visible,
|
|
14118
14138
|
footer,
|
|
14119
14139
|
title,
|
|
@@ -14221,6 +14241,8 @@ const BaseDialog = (props) => {
|
|
|
14221
14241
|
/* @__PURE__ */ React__default.createElement(
|
|
14222
14242
|
Content,
|
|
14223
14243
|
{
|
|
14244
|
+
className,
|
|
14245
|
+
style,
|
|
14224
14246
|
title,
|
|
14225
14247
|
footer: renderFooter(),
|
|
14226
14248
|
footerDirection,
|
|
@@ -15416,6 +15438,7 @@ const PullToRefresh = (p) => {
|
|
|
15416
15438
|
};
|
|
15417
15439
|
const handleTouchStart = (e) => {
|
|
15418
15440
|
touch.start(e);
|
|
15441
|
+
pullingRef.current = true;
|
|
15419
15442
|
};
|
|
15420
15443
|
const handleTouchMove = (e) => {
|
|
15421
15444
|
if (props.scrollTop > 0) {
|
|
@@ -15424,16 +15447,17 @@ const PullToRefresh = (p) => {
|
|
|
15424
15447
|
if (status === "refreshing" || status === "complete")
|
|
15425
15448
|
return;
|
|
15426
15449
|
touch.move(e);
|
|
15427
|
-
if (
|
|
15428
|
-
|
|
15429
|
-
setHeight(
|
|
15430
|
-
Math.max(
|
|
15431
|
-
rubberbandIfOutOfBounds(touch.deltaY, 0, 0, headHeight * 5, 0.5),
|
|
15432
|
-
0
|
|
15433
|
-
)
|
|
15434
|
-
);
|
|
15435
|
-
setStatus(height > threshold ? "canRelease" : "pulling");
|
|
15450
|
+
if (e.cancelable) {
|
|
15451
|
+
e.preventDefault();
|
|
15436
15452
|
}
|
|
15453
|
+
e.stopPropagation();
|
|
15454
|
+
setHeight(
|
|
15455
|
+
Math.max(
|
|
15456
|
+
rubberbandIfOutOfBounds(touch.deltaY, 0, 0, headHeight * 5, 0.5),
|
|
15457
|
+
0
|
|
15458
|
+
)
|
|
15459
|
+
);
|
|
15460
|
+
setStatus(height > threshold ? "canRelease" : "pulling");
|
|
15437
15461
|
};
|
|
15438
15462
|
async function doRefresh() {
|
|
15439
15463
|
setHeight(headHeight);
|
|
@@ -15827,7 +15851,6 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
15827
15851
|
return /* @__PURE__ */ React__default.createElement(
|
|
15828
15852
|
"div",
|
|
15829
15853
|
{
|
|
15830
|
-
id: "left",
|
|
15831
15854
|
ref: side === "left" ? leftWrapper : rightWrapper,
|
|
15832
15855
|
className: `${classPrefix2}__${side}`,
|
|
15833
15856
|
onClick: (e) => handleOperate(e, side)
|
|
@@ -15866,14 +15889,15 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
15866
15889
|
};
|
|
15867
15890
|
}, []);
|
|
15868
15891
|
return /* @__PURE__ */ React__default.createElement(
|
|
15869
|
-
|
|
15892
|
+
View,
|
|
15870
15893
|
{
|
|
15871
15894
|
ref: root2,
|
|
15872
15895
|
className: classNames(classPrefix2, className),
|
|
15873
15896
|
onTouchStart: (e) => onTouchStart(e),
|
|
15874
15897
|
onTouchMove: (e) => onTouchMove(e),
|
|
15875
15898
|
onTouchEnd: (e) => onTouchEnd(e),
|
|
15876
|
-
style
|
|
15899
|
+
style,
|
|
15900
|
+
catchMove: true
|
|
15877
15901
|
},
|
|
15878
15902
|
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__wrapper`, style: wrapperStyle }, renderActionContent("left"), children, renderActionContent("right"))
|
|
15879
15903
|
);
|
|
@@ -19256,7 +19280,7 @@ export {
|
|
|
19256
19280
|
Ellipsis,
|
|
19257
19281
|
Empty,
|
|
19258
19282
|
FixedNav,
|
|
19259
|
-
Form,
|
|
19283
|
+
InnerForm as Form,
|
|
19260
19284
|
FormItem,
|
|
19261
19285
|
Grid,
|
|
19262
19286
|
GridItem,
|