@nutui/nutui-react 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/Avatar.js +1 -1
- package/dist/esm/AvatarGroup.js +1 -1
- package/dist/esm/Cell.js +5 -3
- package/dist/esm/CellGroup.js +6 -1
- package/dist/esm/Dialog.js +4 -3
- package/dist/esm/Form.js +14 -7
- package/dist/esm/SideNavBar.js +1 -1
- package/dist/esm/Step.js +1 -1
- package/dist/esm/Steps.js +1 -1
- package/dist/esm/SubSideNavBar.js +1 -1
- package/dist/esm/Swiper.js +1 -1
- package/dist/esm/SwiperItem.js +1 -1
- package/dist/esm/context.js +2 -16
- package/dist/esm/context2.js +16 -2
- package/dist/esm/context3.js +2 -2
- package/dist/esm/context5.js +5 -0
- package/dist/esm/overlay2.js +4 -1
- package/dist/esm/popup2.js +3 -0
- 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/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 +135 -91
- package/dist/nutui.react.umd.js +135 -91
- package/dist/style.mjs +1 -1
- package/dist/types/packages/cellgroup/context.d.ts +5 -0
- package/dist/types/packages/dialog/config.d.ts +2 -1
- package/dist/types/packages/form/form.d.ts +4 -8
- package/dist/types/packages/form/index.d.ts +11 -2
- package/dist/types/packages/form/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/nutui.react.umd.js
CHANGED
|
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9
9
|
return value;
|
|
10
10
|
};
|
|
11
11
|
/*!
|
|
12
|
-
* @nutui/nutui-react v2.0.
|
|
12
|
+
* @nutui/nutui-react v2.0.16 Wed Sep 06 2023 15:53:25 GMT+0800 (China Standard Time)
|
|
13
13
|
* (c) 2023 @jdf2e.
|
|
14
14
|
* Released under the MIT License.
|
|
15
15
|
*/
|
|
@@ -2541,6 +2541,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
2541
2541
|
}
|
|
2542
2542
|
);
|
|
2543
2543
|
Button.displayName = "NutButton";
|
|
2544
|
+
const CellGroupContext = React.createContext(null);
|
|
2544
2545
|
const defaultProps$1r = {
|
|
2545
2546
|
...ComponentDefaults,
|
|
2546
2547
|
title: "",
|
|
@@ -2558,7 +2559,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
2558
2559
|
{
|
|
2559
2560
|
className: `${classPrefix$p}__wrap ${divider ? `${classPrefix$p}__wrap--divider` : ""}`
|
|
2560
2561
|
},
|
|
2561
|
-
children
|
|
2562
|
+
/* @__PURE__ */ React.createElement(CellGroupContext.Provider, { value: { divider } }, children)
|
|
2562
2563
|
));
|
|
2563
2564
|
};
|
|
2564
2565
|
CellGroup.defaultProps = defaultProps$1r;
|
|
@@ -2575,6 +2576,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
2575
2576
|
};
|
|
2576
2577
|
const classPrefix$o = "nut-cell";
|
|
2577
2578
|
const Cell = (props) => {
|
|
2579
|
+
const ctx2 = React.useContext(CellGroupContext);
|
|
2578
2580
|
const {
|
|
2579
2581
|
children,
|
|
2580
2582
|
onClick,
|
|
@@ -2616,7 +2618,8 @@ Check the top-level render call using <` + t + ">.");
|
|
|
2616
2618
|
style: styles
|
|
2617
2619
|
},
|
|
2618
2620
|
extra
|
|
2619
|
-
) : null,
|
|
2621
|
+
) : null),
|
|
2622
|
+
(ctx2 == null ? void 0 : ctx2.divider) ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$o}__divider` }) : null
|
|
2620
2623
|
);
|
|
2621
2624
|
};
|
|
2622
2625
|
Cell.defaultProps = defaultProps$1q;
|
|
@@ -5689,6 +5692,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
5689
5692
|
};
|
|
5690
5693
|
const [innerVisible, setInnerVisible] = React.useState(visible);
|
|
5691
5694
|
const classPrefix2 = `nut-overlay`;
|
|
5695
|
+
const nodeRef = React.useRef(null);
|
|
5692
5696
|
React.useEffect(() => {
|
|
5693
5697
|
if (visible) {
|
|
5694
5698
|
setInnerVisible(true);
|
|
@@ -5727,6 +5731,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
5727
5731
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
5728
5732
|
CSSTransition$1,
|
|
5729
5733
|
{
|
|
5734
|
+
nodeRef,
|
|
5730
5735
|
classNames: `${classPrefix2}-slide`,
|
|
5731
5736
|
unmountOnExit: true,
|
|
5732
5737
|
timeout: duration,
|
|
@@ -5734,7 +5739,17 @@ Check the top-level render call using <` + t + ">.");
|
|
|
5734
5739
|
onEntered: onHandleOpened,
|
|
5735
5740
|
onExited: onHandleClosed
|
|
5736
5741
|
},
|
|
5737
|
-
/* @__PURE__ */ React.createElement(
|
|
5742
|
+
/* @__PURE__ */ React.createElement(
|
|
5743
|
+
"div",
|
|
5744
|
+
{
|
|
5745
|
+
ref: nodeRef,
|
|
5746
|
+
className: classes,
|
|
5747
|
+
style: styles,
|
|
5748
|
+
...rest,
|
|
5749
|
+
onClick: handleClick2
|
|
5750
|
+
},
|
|
5751
|
+
children
|
|
5752
|
+
)
|
|
5738
5753
|
));
|
|
5739
5754
|
};
|
|
5740
5755
|
Overlay.defaultProps = defaultOverlayProps;
|
|
@@ -11881,6 +11896,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11881
11896
|
afterClose,
|
|
11882
11897
|
onClick
|
|
11883
11898
|
} = { ...defaultProps$1c, ...props };
|
|
11899
|
+
const nodeRef = React.useRef(null);
|
|
11884
11900
|
const [index, setIndex] = React.useState(zIndex || _zIndex);
|
|
11885
11901
|
const [innerVisible, setInnerVisible] = React.useState(visible);
|
|
11886
11902
|
const [showChildren, setShowChildren] = React.useState(true);
|
|
@@ -11972,6 +11988,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11972
11988
|
return /* @__PURE__ */ React.createElement(
|
|
11973
11989
|
CSSTransition$1,
|
|
11974
11990
|
{
|
|
11991
|
+
nodeRef,
|
|
11975
11992
|
classNames: transitionName,
|
|
11976
11993
|
unmountOnExit: true,
|
|
11977
11994
|
timeout: duration,
|
|
@@ -11979,7 +11996,18 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11979
11996
|
onEntered: onHandleOpened,
|
|
11980
11997
|
onExited: onHandleClosed
|
|
11981
11998
|
},
|
|
11982
|
-
/* @__PURE__ */ React.createElement(
|
|
11999
|
+
/* @__PURE__ */ React.createElement(
|
|
12000
|
+
"div",
|
|
12001
|
+
{
|
|
12002
|
+
ref: nodeRef,
|
|
12003
|
+
style: popStyles,
|
|
12004
|
+
className: popClassName,
|
|
12005
|
+
onClick: onHandleClick
|
|
12006
|
+
},
|
|
12007
|
+
renderTitle(),
|
|
12008
|
+
renderIcon(),
|
|
12009
|
+
showChildren ? children : ""
|
|
12010
|
+
)
|
|
11983
12011
|
);
|
|
11984
12012
|
};
|
|
11985
12013
|
const renderNode = () => {
|
|
@@ -12642,6 +12670,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12642
12670
|
constructor(nodes, config2) {
|
|
12643
12671
|
__publicField(this, "nodes");
|
|
12644
12672
|
__publicField(this, "config");
|
|
12673
|
+
// eslint-disable-next-line class-methods-use-this
|
|
12645
12674
|
__publicField(this, "isLeaf", (node, lazy) => {
|
|
12646
12675
|
const { leaf, children } = node;
|
|
12647
12676
|
const hasChildren = Array.isArray(children) && Boolean(children.length);
|
|
@@ -16530,6 +16559,84 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16530
16559
|
}
|
|
16531
16560
|
return [formRef.current];
|
|
16532
16561
|
};
|
|
16562
|
+
const defaultProps$W = {
|
|
16563
|
+
...ComponentDefaults,
|
|
16564
|
+
labelPosition: "right",
|
|
16565
|
+
starPosition: "left",
|
|
16566
|
+
divider: false,
|
|
16567
|
+
onFinish: (values) => {
|
|
16568
|
+
},
|
|
16569
|
+
onFinishFailed: (values, errorFields) => {
|
|
16570
|
+
}
|
|
16571
|
+
};
|
|
16572
|
+
const PositionInfo = {
|
|
16573
|
+
top: "form-layout-top",
|
|
16574
|
+
left: "form-layout-left",
|
|
16575
|
+
right: "form-layout-right"
|
|
16576
|
+
};
|
|
16577
|
+
const Form = React.forwardRef(
|
|
16578
|
+
(props, ref) => {
|
|
16579
|
+
const classPrefix2 = "nut-form";
|
|
16580
|
+
const {
|
|
16581
|
+
className,
|
|
16582
|
+
style,
|
|
16583
|
+
footer,
|
|
16584
|
+
children,
|
|
16585
|
+
initialValues,
|
|
16586
|
+
divider,
|
|
16587
|
+
onFinish,
|
|
16588
|
+
onFinishFailed,
|
|
16589
|
+
labelPosition,
|
|
16590
|
+
starPosition,
|
|
16591
|
+
form
|
|
16592
|
+
} = {
|
|
16593
|
+
...defaultProps$W,
|
|
16594
|
+
...props
|
|
16595
|
+
};
|
|
16596
|
+
let formInstance;
|
|
16597
|
+
if (form !== void 0) {
|
|
16598
|
+
formInstance = form;
|
|
16599
|
+
} else {
|
|
16600
|
+
[formInstance] = useForm();
|
|
16601
|
+
}
|
|
16602
|
+
React.useImperativeHandle(ref, () => formInstance);
|
|
16603
|
+
formInstance.starPosition = starPosition;
|
|
16604
|
+
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
16605
|
+
setCallback({
|
|
16606
|
+
onFinish,
|
|
16607
|
+
onFinishFailed
|
|
16608
|
+
});
|
|
16609
|
+
const mountRef = React.useRef(false);
|
|
16610
|
+
setInitialValues(initialValues, !mountRef.current);
|
|
16611
|
+
if (!mountRef.current) {
|
|
16612
|
+
mountRef.current = true;
|
|
16613
|
+
}
|
|
16614
|
+
return /* @__PURE__ */ React.createElement(
|
|
16615
|
+
"form",
|
|
16616
|
+
{
|
|
16617
|
+
className: classNames(
|
|
16618
|
+
classPrefix2,
|
|
16619
|
+
className,
|
|
16620
|
+
PositionInfo[labelPosition]
|
|
16621
|
+
),
|
|
16622
|
+
style,
|
|
16623
|
+
onSubmit: (e) => {
|
|
16624
|
+
e.preventDefault();
|
|
16625
|
+
e.stopPropagation();
|
|
16626
|
+
submit();
|
|
16627
|
+
},
|
|
16628
|
+
onReset: (e) => {
|
|
16629
|
+
e.preventDefault();
|
|
16630
|
+
e.stopPropagation();
|
|
16631
|
+
resetFields();
|
|
16632
|
+
}
|
|
16633
|
+
},
|
|
16634
|
+
/* @__PURE__ */ React.createElement(Cell.Group, { divider }, /* @__PURE__ */ React.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React.createElement(Cell, null, footer) : null)
|
|
16635
|
+
);
|
|
16636
|
+
}
|
|
16637
|
+
);
|
|
16638
|
+
Form.defaultProps = defaultProps$W;
|
|
16639
|
+
Form.displayName = "NutForm";
|
|
16533
16640
|
function isForwardRefComponent(component) {
|
|
16534
16641
|
return component.type && component.type.$$typeof && // eslint-disable-next-line react/display-name
|
|
16535
16642
|
React.forwardRef(
|
|
@@ -16539,7 +16646,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16539
16646
|
}
|
|
16540
16647
|
).$$typeof === component.type.$$typeof;
|
|
16541
16648
|
}
|
|
16542
|
-
const defaultProps$
|
|
16649
|
+
const defaultProps$V = {
|
|
16543
16650
|
...ComponentDefaults,
|
|
16544
16651
|
required: false,
|
|
16545
16652
|
name: "",
|
|
@@ -16607,7 +16714,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16607
16714
|
__publicField(this, "renderLayout", (childNode) => {
|
|
16608
16715
|
var _a2, _b;
|
|
16609
16716
|
const { label, name, required: required2, className, style, errorMessageAlign } = {
|
|
16610
|
-
...defaultProps$
|
|
16717
|
+
...defaultProps$V,
|
|
16611
16718
|
...this.props
|
|
16612
16719
|
};
|
|
16613
16720
|
const item = ((_a2 = this.context.errors) == null ? void 0 : _a2.length) > 0 && ((_b = this.context.errors) == null ? void 0 : _b.filter((item2) => {
|
|
@@ -16657,83 +16764,11 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16657
16764
|
return /* @__PURE__ */ React.createElement(React.Fragment, { key: this.state.resetCount }, this.renderLayout(returnChildNode));
|
|
16658
16765
|
}
|
|
16659
16766
|
}
|
|
16660
|
-
__publicField(FormItem, "defaultProps", defaultProps$
|
|
16767
|
+
__publicField(FormItem, "defaultProps", defaultProps$V);
|
|
16661
16768
|
__publicField(FormItem, "contextType", Context);
|
|
16662
|
-
const
|
|
16663
|
-
|
|
16664
|
-
|
|
16665
|
-
starPosition: "left",
|
|
16666
|
-
onFinish: (values) => {
|
|
16667
|
-
},
|
|
16668
|
-
onFinishFailed: (values, errorFields) => {
|
|
16669
|
-
}
|
|
16670
|
-
};
|
|
16671
|
-
const PositionInfo = {
|
|
16672
|
-
top: "form-layout-top",
|
|
16673
|
-
left: "form-layout-left",
|
|
16674
|
-
right: "form-layout-right"
|
|
16675
|
-
};
|
|
16676
|
-
const Form = (props) => {
|
|
16677
|
-
const classPrefix2 = "nut-form";
|
|
16678
|
-
const {
|
|
16679
|
-
className,
|
|
16680
|
-
style,
|
|
16681
|
-
footer,
|
|
16682
|
-
children,
|
|
16683
|
-
initialValues,
|
|
16684
|
-
onFinish,
|
|
16685
|
-
onFinishFailed,
|
|
16686
|
-
labelPosition,
|
|
16687
|
-
starPosition,
|
|
16688
|
-
form
|
|
16689
|
-
} = {
|
|
16690
|
-
...defaultProps$V,
|
|
16691
|
-
...props
|
|
16692
|
-
};
|
|
16693
|
-
let formInstance;
|
|
16694
|
-
if (form !== void 0) {
|
|
16695
|
-
formInstance = form;
|
|
16696
|
-
} else {
|
|
16697
|
-
[formInstance] = useForm();
|
|
16698
|
-
}
|
|
16699
|
-
formInstance.starPosition = starPosition;
|
|
16700
|
-
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
16701
|
-
setCallback({
|
|
16702
|
-
onFinish,
|
|
16703
|
-
onFinishFailed
|
|
16704
|
-
});
|
|
16705
|
-
const mountRef = React.useRef(false);
|
|
16706
|
-
setInitialValues(initialValues, !mountRef.current);
|
|
16707
|
-
if (!mountRef.current) {
|
|
16708
|
-
mountRef.current = true;
|
|
16709
|
-
}
|
|
16710
|
-
return /* @__PURE__ */ React.createElement(
|
|
16711
|
-
"form",
|
|
16712
|
-
{
|
|
16713
|
-
className: classNames(
|
|
16714
|
-
classPrefix2,
|
|
16715
|
-
className,
|
|
16716
|
-
PositionInfo[labelPosition]
|
|
16717
|
-
),
|
|
16718
|
-
style,
|
|
16719
|
-
onSubmit: (e) => {
|
|
16720
|
-
e.preventDefault();
|
|
16721
|
-
e.stopPropagation();
|
|
16722
|
-
submit();
|
|
16723
|
-
},
|
|
16724
|
-
onReset: (e) => {
|
|
16725
|
-
e.preventDefault();
|
|
16726
|
-
e.stopPropagation();
|
|
16727
|
-
resetFields();
|
|
16728
|
-
}
|
|
16729
|
-
},
|
|
16730
|
-
/* @__PURE__ */ React.createElement(Cell.Group, null, /* @__PURE__ */ React.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React.createElement(Cell, null, footer) : null)
|
|
16731
|
-
);
|
|
16732
|
-
};
|
|
16733
|
-
Form.defaultProps = defaultProps$V;
|
|
16734
|
-
Form.displayName = "NutForm";
|
|
16735
|
-
Form.Item = FormItem;
|
|
16736
|
-
Form.useForm = useForm;
|
|
16769
|
+
const InnerForm = Form;
|
|
16770
|
+
InnerForm.Item = FormItem;
|
|
16771
|
+
InnerForm.useForm = useForm;
|
|
16737
16772
|
function trimExtraChar(value, char, regExp) {
|
|
16738
16773
|
const index = value.indexOf(char);
|
|
16739
16774
|
if (index === -1) {
|
|
@@ -19727,16 +19762,24 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19727
19762
|
const handleClick2 = (e) => {
|
|
19728
19763
|
onClick && onClick(e);
|
|
19729
19764
|
};
|
|
19730
|
-
return /* @__PURE__ */ React.createElement(
|
|
19765
|
+
return /* @__PURE__ */ React.createElement(
|
|
19731
19766
|
"div",
|
|
19732
19767
|
{
|
|
19733
|
-
className: classPrefix2,
|
|
19734
|
-
style:
|
|
19768
|
+
className: classNames(`${classPrefix2}__outer`, props.className),
|
|
19769
|
+
style: props.style,
|
|
19770
|
+
onClick: (e) => handleClick2(e)
|
|
19735
19771
|
},
|
|
19736
|
-
|
|
19737
|
-
|
|
19738
|
-
|
|
19739
|
-
|
|
19772
|
+
/* @__PURE__ */ React.createElement(
|
|
19773
|
+
"div",
|
|
19774
|
+
{
|
|
19775
|
+
className: classPrefix2,
|
|
19776
|
+
style: { display: visible ? "flex" : "none" }
|
|
19777
|
+
},
|
|
19778
|
+
renderHeader(),
|
|
19779
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__content` }, /* @__PURE__ */ React.createElement(React.Fragment, null, children)),
|
|
19780
|
+
renderFooter()
|
|
19781
|
+
)
|
|
19782
|
+
);
|
|
19740
19783
|
};
|
|
19741
19784
|
Content.displayName = "NutContent";
|
|
19742
19785
|
const defaultDialogProps = {
|
|
@@ -19795,6 +19838,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19795
19838
|
DialogWrap.defaultProps = defaultDialogProps;
|
|
19796
19839
|
DialogWrap.displayName = "NutDialogWrap";
|
|
19797
19840
|
const defaultProps$D = {
|
|
19841
|
+
...ComponentDefaults,
|
|
19798
19842
|
confirmText: "",
|
|
19799
19843
|
cancelText: "",
|
|
19800
19844
|
overlay: true,
|
|
@@ -25229,7 +25273,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
25229
25273
|
exports2.Ellipsis = Ellipsis;
|
|
25230
25274
|
exports2.Empty = Empty;
|
|
25231
25275
|
exports2.FixedNav = FixedNav;
|
|
25232
|
-
exports2.Form =
|
|
25276
|
+
exports2.Form = InnerForm;
|
|
25233
25277
|
exports2.FormItem = FormItem;
|
|
25234
25278
|
exports2.Grid = Grid;
|
|
25235
25279
|
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,7 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { useForm } from './useform';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
3
2
|
import { BasicComponent } from '../../utils/typings';
|
|
4
|
-
import {
|
|
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 right
|
|
@@ -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';
|
|
3
|
+
import { FormItem } from '../formitem/formitem';
|
|
4
|
+
import { FormInstance } from './types';
|
|
5
|
+
import { useForm } from '../../packages/form/useform';
|
|
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;
|