@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.umd.js
CHANGED
|
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8
8
|
return value;
|
|
9
9
|
};
|
|
10
10
|
/*!
|
|
11
|
-
* @nutui/nutui-react-taro v2.0.
|
|
11
|
+
* @nutui/nutui-react-taro v2.0.16 Wed Sep 06 2023 15:51:52 GMT+0800 (China Standard Time)
|
|
12
12
|
* (c) 2023 @jdf2e.
|
|
13
13
|
* Released under the MIT License.
|
|
14
14
|
*/
|
|
@@ -2019,6 +2019,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2019
2019
|
}
|
|
2020
2020
|
);
|
|
2021
2021
|
Button.displayName = "NutButton";
|
|
2022
|
+
const CellGroupContext = React.createContext(null);
|
|
2022
2023
|
const defaultProps$1t = {
|
|
2023
2024
|
...ComponentDefaults,
|
|
2024
2025
|
title: "",
|
|
@@ -2036,7 +2037,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2036
2037
|
{
|
|
2037
2038
|
className: `${classPrefix$p}__wrap ${divider ? `${classPrefix$p}__wrap--divider` : ""}`
|
|
2038
2039
|
},
|
|
2039
|
-
children
|
|
2040
|
+
/* @__PURE__ */ React.createElement(CellGroupContext.Provider, { value: { divider } }, children)
|
|
2040
2041
|
));
|
|
2041
2042
|
};
|
|
2042
2043
|
CellGroup.defaultProps = defaultProps$1t;
|
|
@@ -2053,6 +2054,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2053
2054
|
};
|
|
2054
2055
|
const classPrefix$o = "nut-cell";
|
|
2055
2056
|
const Cell = (props) => {
|
|
2057
|
+
const ctx = React.useContext(CellGroupContext);
|
|
2056
2058
|
const {
|
|
2057
2059
|
children,
|
|
2058
2060
|
onClick,
|
|
@@ -2094,7 +2096,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2094
2096
|
style: styles
|
|
2095
2097
|
},
|
|
2096
2098
|
extra
|
|
2097
|
-
) : null,
|
|
2099
|
+
) : null),
|
|
2100
|
+
(ctx == null ? void 0 : ctx.divider) ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$o}__divider` }) : null
|
|
2098
2101
|
);
|
|
2099
2102
|
};
|
|
2100
2103
|
Cell.defaultProps = defaultProps$1s;
|
|
@@ -7032,6 +7035,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7032
7035
|
constructor(nodes, config2) {
|
|
7033
7036
|
__publicField(this, "nodes");
|
|
7034
7037
|
__publicField(this, "config");
|
|
7038
|
+
// eslint-disable-next-line class-methods-use-this
|
|
7035
7039
|
__publicField(this, "isLeaf", (node, lazy) => {
|
|
7036
7040
|
const { leaf, children } = node;
|
|
7037
7041
|
const hasChildren = Array.isArray(children) && Boolean(children.length);
|
|
@@ -11001,6 +11005,83 @@ var __publicField = (obj, key, value) => {
|
|
|
11001
11005
|
}
|
|
11002
11006
|
return [formRef.current];
|
|
11003
11007
|
};
|
|
11008
|
+
const defaultProps$Y = {
|
|
11009
|
+
...ComponentDefaults,
|
|
11010
|
+
labelPosition: "right",
|
|
11011
|
+
starPosition: "left",
|
|
11012
|
+
divider: false,
|
|
11013
|
+
onFinish: (values) => {
|
|
11014
|
+
},
|
|
11015
|
+
onFinishFailed: (values, errorFields) => {
|
|
11016
|
+
}
|
|
11017
|
+
};
|
|
11018
|
+
const PositionInfo = {
|
|
11019
|
+
top: "form-layout-top",
|
|
11020
|
+
left: "form-layout-left",
|
|
11021
|
+
right: "form-layout-right"
|
|
11022
|
+
};
|
|
11023
|
+
const Form = React.forwardRef(
|
|
11024
|
+
(props, ref) => {
|
|
11025
|
+
const classPrefix2 = "nut-form";
|
|
11026
|
+
const {
|
|
11027
|
+
className,
|
|
11028
|
+
style,
|
|
11029
|
+
footer,
|
|
11030
|
+
children,
|
|
11031
|
+
initialValues,
|
|
11032
|
+
divider,
|
|
11033
|
+
onFinish,
|
|
11034
|
+
onFinishFailed,
|
|
11035
|
+
labelPosition,
|
|
11036
|
+
starPosition,
|
|
11037
|
+
form
|
|
11038
|
+
} = {
|
|
11039
|
+
...defaultProps$Y,
|
|
11040
|
+
...props
|
|
11041
|
+
};
|
|
11042
|
+
let formInstance;
|
|
11043
|
+
if (form !== void 0) {
|
|
11044
|
+
formInstance = form;
|
|
11045
|
+
} else {
|
|
11046
|
+
[formInstance] = useForm();
|
|
11047
|
+
}
|
|
11048
|
+
formInstance.starPosition = starPosition;
|
|
11049
|
+
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
11050
|
+
setCallback({
|
|
11051
|
+
onFinish,
|
|
11052
|
+
onFinishFailed
|
|
11053
|
+
});
|
|
11054
|
+
const mountRef = React.useRef(false);
|
|
11055
|
+
setInitialValues(initialValues, !mountRef.current);
|
|
11056
|
+
if (!mountRef.current) {
|
|
11057
|
+
mountRef.current = true;
|
|
11058
|
+
}
|
|
11059
|
+
return /* @__PURE__ */ React.createElement(
|
|
11060
|
+
"form",
|
|
11061
|
+
{
|
|
11062
|
+
className: classNames(
|
|
11063
|
+
classPrefix2,
|
|
11064
|
+
className,
|
|
11065
|
+
PositionInfo[labelPosition]
|
|
11066
|
+
),
|
|
11067
|
+
style,
|
|
11068
|
+
onSubmit: (e) => {
|
|
11069
|
+
e.preventDefault();
|
|
11070
|
+
e.stopPropagation();
|
|
11071
|
+
submit();
|
|
11072
|
+
},
|
|
11073
|
+
onReset: (e) => {
|
|
11074
|
+
e.preventDefault();
|
|
11075
|
+
e.stopPropagation();
|
|
11076
|
+
resetFields();
|
|
11077
|
+
}
|
|
11078
|
+
},
|
|
11079
|
+
/* @__PURE__ */ React.createElement(Cell.Group, { divider }, /* @__PURE__ */ React.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React.createElement(Cell, null, footer) : null)
|
|
11080
|
+
);
|
|
11081
|
+
}
|
|
11082
|
+
);
|
|
11083
|
+
Form.defaultProps = defaultProps$Y;
|
|
11084
|
+
Form.displayName = "NutForm";
|
|
11004
11085
|
function isForwardRefComponent(component) {
|
|
11005
11086
|
return component.type && component.type.$$typeof && // eslint-disable-next-line react/display-name
|
|
11006
11087
|
React.forwardRef(
|
|
@@ -11010,7 +11091,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11010
11091
|
}
|
|
11011
11092
|
).$$typeof === component.type.$$typeof;
|
|
11012
11093
|
}
|
|
11013
|
-
const defaultProps$
|
|
11094
|
+
const defaultProps$X = {
|
|
11014
11095
|
...ComponentDefaults,
|
|
11015
11096
|
required: false,
|
|
11016
11097
|
name: "",
|
|
@@ -11077,7 +11158,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11077
11158
|
__publicField(this, "renderLayout", (childNode) => {
|
|
11078
11159
|
var _a, _b;
|
|
11079
11160
|
const { label, name, required: required2, className, style, errorMessageAlign } = {
|
|
11080
|
-
...defaultProps$
|
|
11161
|
+
...defaultProps$X,
|
|
11081
11162
|
...this.props
|
|
11082
11163
|
};
|
|
11083
11164
|
const item = ((_a = this.context.errors) == null ? void 0 : _a.length) > 0 && ((_b = this.context.errors) == null ? void 0 : _b.filter((item2) => {
|
|
@@ -11127,83 +11208,11 @@ var __publicField = (obj, key, value) => {
|
|
|
11127
11208
|
return /* @__PURE__ */ React.createElement(React.Fragment, { key: this.state.resetCount }, this.renderLayout(returnChildNode));
|
|
11128
11209
|
}
|
|
11129
11210
|
}
|
|
11130
|
-
__publicField(FormItem, "defaultProps", defaultProps$
|
|
11211
|
+
__publicField(FormItem, "defaultProps", defaultProps$X);
|
|
11131
11212
|
__publicField(FormItem, "contextType", Context);
|
|
11132
|
-
const
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
starPosition: "left",
|
|
11136
|
-
onFinish: (values) => {
|
|
11137
|
-
},
|
|
11138
|
-
onFinishFailed: (values, errorFields) => {
|
|
11139
|
-
}
|
|
11140
|
-
};
|
|
11141
|
-
const PositionInfo = {
|
|
11142
|
-
top: "form-layout-top",
|
|
11143
|
-
left: "form-layout-left",
|
|
11144
|
-
right: "form-layout-right"
|
|
11145
|
-
};
|
|
11146
|
-
const Form = (props) => {
|
|
11147
|
-
const classPrefix2 = "nut-form";
|
|
11148
|
-
const {
|
|
11149
|
-
className,
|
|
11150
|
-
style,
|
|
11151
|
-
footer,
|
|
11152
|
-
children,
|
|
11153
|
-
initialValues,
|
|
11154
|
-
onFinish,
|
|
11155
|
-
onFinishFailed,
|
|
11156
|
-
labelPosition,
|
|
11157
|
-
starPosition,
|
|
11158
|
-
form
|
|
11159
|
-
} = {
|
|
11160
|
-
...defaultProps$X,
|
|
11161
|
-
...props
|
|
11162
|
-
};
|
|
11163
|
-
let formInstance;
|
|
11164
|
-
if (form !== void 0) {
|
|
11165
|
-
formInstance = form;
|
|
11166
|
-
} else {
|
|
11167
|
-
[formInstance] = useForm();
|
|
11168
|
-
}
|
|
11169
|
-
formInstance.starPosition = starPosition;
|
|
11170
|
-
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
11171
|
-
setCallback({
|
|
11172
|
-
onFinish,
|
|
11173
|
-
onFinishFailed
|
|
11174
|
-
});
|
|
11175
|
-
const mountRef = React.useRef(false);
|
|
11176
|
-
setInitialValues(initialValues, !mountRef.current);
|
|
11177
|
-
if (!mountRef.current) {
|
|
11178
|
-
mountRef.current = true;
|
|
11179
|
-
}
|
|
11180
|
-
return /* @__PURE__ */ React.createElement(
|
|
11181
|
-
"form",
|
|
11182
|
-
{
|
|
11183
|
-
className: classNames(
|
|
11184
|
-
classPrefix2,
|
|
11185
|
-
className,
|
|
11186
|
-
PositionInfo[labelPosition]
|
|
11187
|
-
),
|
|
11188
|
-
style,
|
|
11189
|
-
onSubmit: (e) => {
|
|
11190
|
-
e.preventDefault();
|
|
11191
|
-
e.stopPropagation();
|
|
11192
|
-
submit();
|
|
11193
|
-
},
|
|
11194
|
-
onReset: (e) => {
|
|
11195
|
-
e.preventDefault();
|
|
11196
|
-
e.stopPropagation();
|
|
11197
|
-
resetFields();
|
|
11198
|
-
}
|
|
11199
|
-
},
|
|
11200
|
-
/* @__PURE__ */ React.createElement(Cell.Group, null, /* @__PURE__ */ React.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React.createElement(Cell, null, footer) : null)
|
|
11201
|
-
);
|
|
11202
|
-
};
|
|
11203
|
-
Form.defaultProps = defaultProps$X;
|
|
11204
|
-
Form.displayName = "NutForm";
|
|
11205
|
-
Form.Item = FormItem;
|
|
11206
|
-
Form.useForm = useForm;
|
|
11213
|
+
const InnerForm = Form;
|
|
11214
|
+
InnerForm.Item = FormItem;
|
|
11215
|
+
InnerForm.useForm = useForm;
|
|
11207
11216
|
function trimExtraChar(value, char, regExp) {
|
|
11208
11217
|
const index = value.indexOf(char);
|
|
11209
11218
|
if (index === -1) {
|
|
@@ -14056,21 +14065,30 @@ var __publicField = (obj, key, value) => {
|
|
|
14056
14065
|
const handleClick = (e) => {
|
|
14057
14066
|
onClick && onClick(e);
|
|
14058
14067
|
};
|
|
14059
|
-
return /* @__PURE__ */ React.createElement(
|
|
14068
|
+
return /* @__PURE__ */ React.createElement(
|
|
14060
14069
|
"div",
|
|
14061
14070
|
{
|
|
14062
|
-
className: classPrefix2,
|
|
14063
|
-
style:
|
|
14071
|
+
className: classNames(`${classPrefix2}__outer`, props.className),
|
|
14072
|
+
style: props.style,
|
|
14073
|
+
onClick: (e) => handleClick(e)
|
|
14064
14074
|
},
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14075
|
+
/* @__PURE__ */ React.createElement(
|
|
14076
|
+
"div",
|
|
14077
|
+
{
|
|
14078
|
+
className: classPrefix2,
|
|
14079
|
+
style: { display: visible ? "flex" : "none" }
|
|
14080
|
+
},
|
|
14081
|
+
renderHeader(),
|
|
14082
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__content` }, /* @__PURE__ */ React.createElement(React.Fragment, null, children)),
|
|
14083
|
+
renderFooter()
|
|
14084
|
+
)
|
|
14085
|
+
);
|
|
14069
14086
|
};
|
|
14070
14087
|
Content.displayName = "NutContent";
|
|
14071
14088
|
const customEvents = new Taro.Events();
|
|
14072
14089
|
function useCustomEventsPath(selector) {
|
|
14073
14090
|
var _a;
|
|
14091
|
+
selector = selector || "";
|
|
14074
14092
|
const path = (_a = Taro.getCurrentInstance().router) == null ? void 0 : _a.path;
|
|
14075
14093
|
return path ? `${path}__${selector}` : selector;
|
|
14076
14094
|
}
|
|
@@ -14130,6 +14148,8 @@ var __publicField = (obj, key, value) => {
|
|
|
14130
14148
|
const {
|
|
14131
14149
|
params: {
|
|
14132
14150
|
id,
|
|
14151
|
+
className,
|
|
14152
|
+
style,
|
|
14133
14153
|
visible,
|
|
14134
14154
|
footer,
|
|
14135
14155
|
title,
|
|
@@ -14237,6 +14257,8 @@ var __publicField = (obj, key, value) => {
|
|
|
14237
14257
|
/* @__PURE__ */ React.createElement(
|
|
14238
14258
|
Content,
|
|
14239
14259
|
{
|
|
14260
|
+
className,
|
|
14261
|
+
style,
|
|
14240
14262
|
title,
|
|
14241
14263
|
footer: renderFooter(),
|
|
14242
14264
|
footerDirection,
|
|
@@ -15432,6 +15454,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15432
15454
|
};
|
|
15433
15455
|
const handleTouchStart = (e) => {
|
|
15434
15456
|
touch.start(e);
|
|
15457
|
+
pullingRef.current = true;
|
|
15435
15458
|
};
|
|
15436
15459
|
const handleTouchMove = (e) => {
|
|
15437
15460
|
if (props.scrollTop > 0) {
|
|
@@ -15440,16 +15463,17 @@ var __publicField = (obj, key, value) => {
|
|
|
15440
15463
|
if (status === "refreshing" || status === "complete")
|
|
15441
15464
|
return;
|
|
15442
15465
|
touch.move(e);
|
|
15443
|
-
if (
|
|
15444
|
-
|
|
15445
|
-
setHeight(
|
|
15446
|
-
Math.max(
|
|
15447
|
-
rubberbandIfOutOfBounds(touch.deltaY, 0, 0, headHeight * 5, 0.5),
|
|
15448
|
-
0
|
|
15449
|
-
)
|
|
15450
|
-
);
|
|
15451
|
-
setStatus(height > threshold ? "canRelease" : "pulling");
|
|
15466
|
+
if (e.cancelable) {
|
|
15467
|
+
e.preventDefault();
|
|
15452
15468
|
}
|
|
15469
|
+
e.stopPropagation();
|
|
15470
|
+
setHeight(
|
|
15471
|
+
Math.max(
|
|
15472
|
+
rubberbandIfOutOfBounds(touch.deltaY, 0, 0, headHeight * 5, 0.5),
|
|
15473
|
+
0
|
|
15474
|
+
)
|
|
15475
|
+
);
|
|
15476
|
+
setStatus(height > threshold ? "canRelease" : "pulling");
|
|
15453
15477
|
};
|
|
15454
15478
|
async function doRefresh() {
|
|
15455
15479
|
setHeight(headHeight);
|
|
@@ -15843,7 +15867,6 @@ var __publicField = (obj, key, value) => {
|
|
|
15843
15867
|
return /* @__PURE__ */ React.createElement(
|
|
15844
15868
|
"div",
|
|
15845
15869
|
{
|
|
15846
|
-
id: "left",
|
|
15847
15870
|
ref: side === "left" ? leftWrapper : rightWrapper,
|
|
15848
15871
|
className: `${classPrefix2}__${side}`,
|
|
15849
15872
|
onClick: (e) => handleOperate(e, side)
|
|
@@ -15882,14 +15905,15 @@ var __publicField = (obj, key, value) => {
|
|
|
15882
15905
|
};
|
|
15883
15906
|
}, []);
|
|
15884
15907
|
return /* @__PURE__ */ React.createElement(
|
|
15885
|
-
|
|
15908
|
+
components.View,
|
|
15886
15909
|
{
|
|
15887
15910
|
ref: root2,
|
|
15888
15911
|
className: classNames(classPrefix2, className),
|
|
15889
15912
|
onTouchStart: (e) => onTouchStart(e),
|
|
15890
15913
|
onTouchMove: (e) => onTouchMove(e),
|
|
15891
15914
|
onTouchEnd: (e) => onTouchEnd(e),
|
|
15892
|
-
style
|
|
15915
|
+
style,
|
|
15916
|
+
catchMove: true
|
|
15893
15917
|
},
|
|
15894
15918
|
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__wrapper`, style: wrapperStyle }, renderActionContent("left"), children, renderActionContent("right"))
|
|
15895
15919
|
);
|
|
@@ -19271,7 +19295,7 @@ var __publicField = (obj, key, value) => {
|
|
|
19271
19295
|
exports2.Ellipsis = Ellipsis;
|
|
19272
19296
|
exports2.Empty = Empty;
|
|
19273
19297
|
exports2.FixedNav = FixedNav;
|
|
19274
|
-
exports2.Form =
|
|
19298
|
+
exports2.Form = InnerForm;
|
|
19275
19299
|
exports2.FormItem = FormItem;
|
|
19276
19300
|
exports2.Grid = Grid;
|
|
19277
19301
|
exports2.GridItem = GridItem;
|
package/dist/style.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ReactNode, ForwardRefExoticComponent, PropsWithChildren } from 'react';
|
|
2
2
|
import type { MouseEvent } from 'react';
|
|
3
|
+
import { BasicComponent } from '../../utils/typings';
|
|
3
4
|
export type DialogConfigType = {
|
|
4
5
|
prefixCls?: string;
|
|
5
6
|
simple?: boolean;
|
|
6
7
|
};
|
|
7
|
-
export interface BasicDialogProps {
|
|
8
|
+
export interface BasicDialogProps extends BasicComponent {
|
|
8
9
|
visible?: boolean;
|
|
9
10
|
title?: ReactNode;
|
|
10
11
|
content?: ReactNode;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode, HTMLAttributes } from 'react';
|
|
2
2
|
import { ITouchEvent } from '@tarojs/components';
|
|
3
|
-
|
|
3
|
+
import { BasicComponent } from '../../utils/typings';
|
|
4
|
+
interface ContentProps extends BasicComponent {
|
|
4
5
|
visible: boolean;
|
|
5
6
|
title: ReactNode;
|
|
6
7
|
footer: ReactNode;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { BasicComponent } from '../../utils/typings';
|
|
3
|
-
import {
|
|
4
|
-
import { FormItem } from '../formitem/formitem.taro';
|
|
3
|
+
import { FormInstance } from '../../packages/form/types';
|
|
5
4
|
export interface FormProps extends BasicComponent {
|
|
6
5
|
/**
|
|
7
6
|
* 表单底部区域,一般放置确认和重置按钮
|
|
@@ -23,6 +22,7 @@ export interface FormProps extends BasicComponent {
|
|
|
23
22
|
* @default -
|
|
24
23
|
*/
|
|
25
24
|
form: any
|
|
25
|
+
divider: boolean;
|
|
26
26
|
/**
|
|
27
27
|
* 表单项 label 的位置
|
|
28
28
|
* @default 'left'\
|
|
@@ -44,8 +44,4 @@ export interface FormProps extends BasicComponent {
|
|
|
44
44
|
*/
|
|
45
45
|
onFinishFailed: (values: any, errorFields: any) => void
|
|
46
46
|
}
|
|
47
|
-
export declare const Form:
|
|
48
|
-
Item: typeof FormItem;
|
|
49
|
-
} & {
|
|
50
|
-
useForm: typeof useForm;
|
|
51
|
-
};
|
|
47
|
+
export declare const Form: React.ForwardRefExoticComponent<Partial<FormProps> & React.RefAttributes<FormInstance<any>>>;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormProps } from './form.taro';
|
|
3
|
+
import { FormItem } from '../formitem/formitem.taro';
|
|
4
|
+
import { FormInstance } from './types';
|
|
5
|
+
import { useForm } from '../../packages/form/useform.taro';
|
|
2
6
|
export type { FormItemRuleWithoutValidator, StoreValue, NamePath, FormInstance, FieldEntity, } from './types';
|
|
3
|
-
|
|
7
|
+
type CompoundedComponent = React.ForwardRefExoticComponent<Partial<FormProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> & React.RefAttributes<FormInstance>> & {
|
|
8
|
+
Item: typeof FormItem;
|
|
9
|
+
useForm: typeof useForm;
|
|
10
|
+
};
|
|
11
|
+
declare const InnerForm: CompoundedComponent;
|
|
12
|
+
export default InnerForm;
|
|
@@ -17,6 +17,7 @@ export interface Store {
|
|
|
17
17
|
export interface FormInstance<Values = any> {
|
|
18
18
|
registerField: (entity: FieldEntity) => () => void;
|
|
19
19
|
getFieldValue: (name: NamePath) => StoreValue;
|
|
20
|
+
setInitialValues: (values: any, init: boolean) => void;
|
|
20
21
|
setFieldsValue: (value: any) => void;
|
|
21
22
|
resetFields: (fields?: NamePath[]) => void;
|
|
22
23
|
submit: () => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MouseEvent } from 'react';
|
|
3
|
+
import { BaseEventOrig } from '@tarojs/components/types/common';
|
|
3
4
|
import { BasicComponent } from '../../utils/typings';
|
|
4
5
|
export type SwipeSide = 'left' | 'right';
|
|
5
6
|
export interface SwipeInstance {
|
|
@@ -57,16 +58,16 @@ export interface SwipeProps extends BasicComponent {
|
|
|
57
58
|
* onTouchStart
|
|
58
59
|
* @default -
|
|
59
60
|
*/
|
|
60
|
-
onTouchStart?: (event:
|
|
61
|
+
onTouchStart?: (event: BaseEventOrig<HTMLDivElement>) => void
|
|
61
62
|
/**
|
|
62
63
|
* onTouchEnd
|
|
63
64
|
* @default -
|
|
64
65
|
*/
|
|
65
|
-
onTouchEnd?: (event:
|
|
66
|
+
onTouchEnd?: (event: BaseEventOrig<HTMLDivElement>) => void
|
|
66
67
|
/**
|
|
67
68
|
* onTouchMove
|
|
68
69
|
* @default -
|
|
69
70
|
*/
|
|
70
|
-
onTouchMove?: (event:
|
|
71
|
+
onTouchMove?: (event: BaseEventOrig<HTMLDivElement>) => void
|
|
71
72
|
}
|
|
72
73
|
export declare const Swipe: React.ForwardRefExoticComponent<Partial<SwipeProps> & Omit<React.HTMLAttributes<HTMLDivElement>, "onTouchStart" | "onTouchMove" | "onTouchEnd"> & React.RefAttributes<SwipeInstance>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const customEvents: TaroGeneral.Events;
|
|
2
|
-
export declare function useCustomEventsPath(selector
|
|
2
|
+
export declare function useCustomEventsPath(selector?: string): string;
|
|
3
3
|
export declare function useCustomEvent(selector: string, cb: any): (<T = any>(args: T) => void)[];
|
|
4
4
|
export declare function useParams<T = any>(args: T): {
|
|
5
5
|
params: T;
|
package/package.json
CHANGED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React__default from "react";
|
|
2
|
-
import classNames from "classnames";
|
|
3
|
-
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
4
|
-
import { C as CellGroup } from "./cellgroup.taro-d2fad5e7.js";
|
|
5
|
-
const defaultProps = {
|
|
6
|
-
...ComponentDefaults,
|
|
7
|
-
title: null,
|
|
8
|
-
description: null,
|
|
9
|
-
extra: null,
|
|
10
|
-
radius: "6px",
|
|
11
|
-
align: "flex-start",
|
|
12
|
-
onClick: (event) => {
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const classPrefix = "nut-cell";
|
|
16
|
-
const Cell = (props) => {
|
|
17
|
-
const { children, onClick, title, description, extra, radius, align, className, style, ...rest } = {
|
|
18
|
-
...defaultProps,
|
|
19
|
-
...props
|
|
20
|
-
};
|
|
21
|
-
const handleClick = (event) => {
|
|
22
|
-
onClick(event);
|
|
23
|
-
};
|
|
24
|
-
const baseStyle = {
|
|
25
|
-
...style,
|
|
26
|
-
borderRadius: Number.isNaN(Number(radius)) ? String(radius) : `${radius}px`,
|
|
27
|
-
alignItems: align
|
|
28
|
-
};
|
|
29
|
-
const styles = title || description ? {} : {
|
|
30
|
-
flex: 1
|
|
31
|
-
};
|
|
32
|
-
return React__default.createElement("div", { className: classNames(classPrefix, className), onClick: (event) => handleClick(event), style: baseStyle, ...rest }, children || React__default.createElement(
|
|
33
|
-
React__default.Fragment,
|
|
34
|
-
null,
|
|
35
|
-
title || description ? React__default.createElement(
|
|
36
|
-
"div",
|
|
37
|
-
{ className: `${classPrefix}__left` },
|
|
38
|
-
title ? React__default.createElement("div", { className: `${classPrefix}__title` }, title) : null,
|
|
39
|
-
description ? React__default.createElement("div", { className: `${classPrefix}__description` }, description) : null
|
|
40
|
-
) : null,
|
|
41
|
-
extra ? React__default.createElement("div", { className: `${classPrefix}__extra`, style: styles }, extra) : null,
|
|
42
|
-
React__default.createElement("div", { className: `${classPrefix}__divider` })
|
|
43
|
-
));
|
|
44
|
-
};
|
|
45
|
-
Cell.defaultProps = defaultProps;
|
|
46
|
-
Cell.displayName = "NutCell";
|
|
47
|
-
Cell.Group = CellGroup;
|
|
48
|
-
export {
|
|
49
|
-
Cell as C
|
|
50
|
-
};
|