@nutui/nutui-react 2.0.15-beta.0 → 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.es.js
CHANGED
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
var _a;
|
|
8
8
|
/*!
|
|
9
|
-
* @nutui/nutui-react v2.0.
|
|
9
|
+
* @nutui/nutui-react v2.0.16 Wed Sep 06 2023 15:53:25 GMT+0800 (China Standard Time)
|
|
10
10
|
* (c) 2023 @jdf2e.
|
|
11
11
|
* Released under the MIT License.
|
|
12
12
|
*/
|
|
@@ -2523,6 +2523,7 @@ const Button = React__default.forwardRef(
|
|
|
2523
2523
|
}
|
|
2524
2524
|
);
|
|
2525
2525
|
Button.displayName = "NutButton";
|
|
2526
|
+
const CellGroupContext = createContext(null);
|
|
2526
2527
|
const defaultProps$1r = {
|
|
2527
2528
|
...ComponentDefaults,
|
|
2528
2529
|
title: "",
|
|
@@ -2540,7 +2541,7 @@ const CellGroup = (props) => {
|
|
|
2540
2541
|
{
|
|
2541
2542
|
className: `${classPrefix$p}__wrap ${divider ? `${classPrefix$p}__wrap--divider` : ""}`
|
|
2542
2543
|
},
|
|
2543
|
-
children
|
|
2544
|
+
/* @__PURE__ */ React__default.createElement(CellGroupContext.Provider, { value: { divider } }, children)
|
|
2544
2545
|
));
|
|
2545
2546
|
};
|
|
2546
2547
|
CellGroup.defaultProps = defaultProps$1r;
|
|
@@ -2557,6 +2558,7 @@ const defaultProps$1q = {
|
|
|
2557
2558
|
};
|
|
2558
2559
|
const classPrefix$o = "nut-cell";
|
|
2559
2560
|
const Cell = (props) => {
|
|
2561
|
+
const ctx2 = useContext(CellGroupContext);
|
|
2560
2562
|
const {
|
|
2561
2563
|
children,
|
|
2562
2564
|
onClick,
|
|
@@ -2598,7 +2600,8 @@ const Cell = (props) => {
|
|
|
2598
2600
|
style: styles
|
|
2599
2601
|
},
|
|
2600
2602
|
extra
|
|
2601
|
-
) : null,
|
|
2603
|
+
) : null),
|
|
2604
|
+
(ctx2 == null ? void 0 : ctx2.divider) ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix$o}__divider` }) : null
|
|
2602
2605
|
);
|
|
2603
2606
|
};
|
|
2604
2607
|
Cell.defaultProps = defaultProps$1q;
|
|
@@ -5671,6 +5674,7 @@ const Overlay = (props) => {
|
|
|
5671
5674
|
};
|
|
5672
5675
|
const [innerVisible, setInnerVisible] = useState(visible);
|
|
5673
5676
|
const classPrefix2 = `nut-overlay`;
|
|
5677
|
+
const nodeRef = useRef(null);
|
|
5674
5678
|
useEffect(() => {
|
|
5675
5679
|
if (visible) {
|
|
5676
5680
|
setInnerVisible(true);
|
|
@@ -5709,6 +5713,7 @@ const Overlay = (props) => {
|
|
|
5709
5713
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
5710
5714
|
CSSTransition$1,
|
|
5711
5715
|
{
|
|
5716
|
+
nodeRef,
|
|
5712
5717
|
classNames: `${classPrefix2}-slide`,
|
|
5713
5718
|
unmountOnExit: true,
|
|
5714
5719
|
timeout: duration,
|
|
@@ -5716,7 +5721,17 @@ const Overlay = (props) => {
|
|
|
5716
5721
|
onEntered: onHandleOpened,
|
|
5717
5722
|
onExited: onHandleClosed
|
|
5718
5723
|
},
|
|
5719
|
-
/* @__PURE__ */ React__default.createElement(
|
|
5724
|
+
/* @__PURE__ */ React__default.createElement(
|
|
5725
|
+
"div",
|
|
5726
|
+
{
|
|
5727
|
+
ref: nodeRef,
|
|
5728
|
+
className: classes,
|
|
5729
|
+
style: styles,
|
|
5730
|
+
...rest,
|
|
5731
|
+
onClick: handleClick2
|
|
5732
|
+
},
|
|
5733
|
+
children
|
|
5734
|
+
)
|
|
5720
5735
|
));
|
|
5721
5736
|
};
|
|
5722
5737
|
Overlay.defaultProps = defaultOverlayProps;
|
|
@@ -11863,6 +11878,7 @@ const Popup = (props) => {
|
|
|
11863
11878
|
afterClose,
|
|
11864
11879
|
onClick
|
|
11865
11880
|
} = { ...defaultProps$1c, ...props };
|
|
11881
|
+
const nodeRef = React__default.useRef(null);
|
|
11866
11882
|
const [index, setIndex] = useState(zIndex || _zIndex);
|
|
11867
11883
|
const [innerVisible, setInnerVisible] = useState(visible);
|
|
11868
11884
|
const [showChildren, setShowChildren] = useState(true);
|
|
@@ -11954,6 +11970,7 @@ const Popup = (props) => {
|
|
|
11954
11970
|
return /* @__PURE__ */ React__default.createElement(
|
|
11955
11971
|
CSSTransition$1,
|
|
11956
11972
|
{
|
|
11973
|
+
nodeRef,
|
|
11957
11974
|
classNames: transitionName,
|
|
11958
11975
|
unmountOnExit: true,
|
|
11959
11976
|
timeout: duration,
|
|
@@ -11961,7 +11978,18 @@ const Popup = (props) => {
|
|
|
11961
11978
|
onEntered: onHandleOpened,
|
|
11962
11979
|
onExited: onHandleClosed
|
|
11963
11980
|
},
|
|
11964
|
-
/* @__PURE__ */ React__default.createElement(
|
|
11981
|
+
/* @__PURE__ */ React__default.createElement(
|
|
11982
|
+
"div",
|
|
11983
|
+
{
|
|
11984
|
+
ref: nodeRef,
|
|
11985
|
+
style: popStyles,
|
|
11986
|
+
className: popClassName,
|
|
11987
|
+
onClick: onHandleClick
|
|
11988
|
+
},
|
|
11989
|
+
renderTitle(),
|
|
11990
|
+
renderIcon(),
|
|
11991
|
+
showChildren ? children : ""
|
|
11992
|
+
)
|
|
11965
11993
|
);
|
|
11966
11994
|
};
|
|
11967
11995
|
const renderNode = () => {
|
|
@@ -12624,6 +12652,7 @@ class Tree {
|
|
|
12624
12652
|
constructor(nodes, config2) {
|
|
12625
12653
|
__publicField(this, "nodes");
|
|
12626
12654
|
__publicField(this, "config");
|
|
12655
|
+
// eslint-disable-next-line class-methods-use-this
|
|
12627
12656
|
__publicField(this, "isLeaf", (node, lazy) => {
|
|
12628
12657
|
const { leaf, children } = node;
|
|
12629
12658
|
const hasChildren = Array.isArray(children) && Boolean(children.length);
|
|
@@ -16512,6 +16541,84 @@ const useForm = (form) => {
|
|
|
16512
16541
|
}
|
|
16513
16542
|
return [formRef.current];
|
|
16514
16543
|
};
|
|
16544
|
+
const defaultProps$W = {
|
|
16545
|
+
...ComponentDefaults,
|
|
16546
|
+
labelPosition: "right",
|
|
16547
|
+
starPosition: "left",
|
|
16548
|
+
divider: false,
|
|
16549
|
+
onFinish: (values) => {
|
|
16550
|
+
},
|
|
16551
|
+
onFinishFailed: (values, errorFields) => {
|
|
16552
|
+
}
|
|
16553
|
+
};
|
|
16554
|
+
const PositionInfo = {
|
|
16555
|
+
top: "form-layout-top",
|
|
16556
|
+
left: "form-layout-left",
|
|
16557
|
+
right: "form-layout-right"
|
|
16558
|
+
};
|
|
16559
|
+
const Form = React__default.forwardRef(
|
|
16560
|
+
(props, ref) => {
|
|
16561
|
+
const classPrefix2 = "nut-form";
|
|
16562
|
+
const {
|
|
16563
|
+
className,
|
|
16564
|
+
style,
|
|
16565
|
+
footer,
|
|
16566
|
+
children,
|
|
16567
|
+
initialValues,
|
|
16568
|
+
divider,
|
|
16569
|
+
onFinish,
|
|
16570
|
+
onFinishFailed,
|
|
16571
|
+
labelPosition,
|
|
16572
|
+
starPosition,
|
|
16573
|
+
form
|
|
16574
|
+
} = {
|
|
16575
|
+
...defaultProps$W,
|
|
16576
|
+
...props
|
|
16577
|
+
};
|
|
16578
|
+
let formInstance;
|
|
16579
|
+
if (form !== void 0) {
|
|
16580
|
+
formInstance = form;
|
|
16581
|
+
} else {
|
|
16582
|
+
[formInstance] = useForm();
|
|
16583
|
+
}
|
|
16584
|
+
React__default.useImperativeHandle(ref, () => formInstance);
|
|
16585
|
+
formInstance.starPosition = starPosition;
|
|
16586
|
+
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
16587
|
+
setCallback({
|
|
16588
|
+
onFinish,
|
|
16589
|
+
onFinishFailed
|
|
16590
|
+
});
|
|
16591
|
+
const mountRef = React__default.useRef(false);
|
|
16592
|
+
setInitialValues(initialValues, !mountRef.current);
|
|
16593
|
+
if (!mountRef.current) {
|
|
16594
|
+
mountRef.current = true;
|
|
16595
|
+
}
|
|
16596
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
16597
|
+
"form",
|
|
16598
|
+
{
|
|
16599
|
+
className: classNames(
|
|
16600
|
+
classPrefix2,
|
|
16601
|
+
className,
|
|
16602
|
+
PositionInfo[labelPosition]
|
|
16603
|
+
),
|
|
16604
|
+
style,
|
|
16605
|
+
onSubmit: (e) => {
|
|
16606
|
+
e.preventDefault();
|
|
16607
|
+
e.stopPropagation();
|
|
16608
|
+
submit();
|
|
16609
|
+
},
|
|
16610
|
+
onReset: (e) => {
|
|
16611
|
+
e.preventDefault();
|
|
16612
|
+
e.stopPropagation();
|
|
16613
|
+
resetFields();
|
|
16614
|
+
}
|
|
16615
|
+
},
|
|
16616
|
+
/* @__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)
|
|
16617
|
+
);
|
|
16618
|
+
}
|
|
16619
|
+
);
|
|
16620
|
+
Form.defaultProps = defaultProps$W;
|
|
16621
|
+
Form.displayName = "NutForm";
|
|
16515
16622
|
function isForwardRefComponent(component) {
|
|
16516
16623
|
return component.type && component.type.$$typeof && // eslint-disable-next-line react/display-name
|
|
16517
16624
|
React__default.forwardRef(
|
|
@@ -16521,7 +16628,7 @@ function isForwardRefComponent(component) {
|
|
|
16521
16628
|
}
|
|
16522
16629
|
).$$typeof === component.type.$$typeof;
|
|
16523
16630
|
}
|
|
16524
|
-
const defaultProps$
|
|
16631
|
+
const defaultProps$V = {
|
|
16525
16632
|
...ComponentDefaults,
|
|
16526
16633
|
required: false,
|
|
16527
16634
|
name: "",
|
|
@@ -16589,7 +16696,7 @@ class FormItem extends React__default.Component {
|
|
|
16589
16696
|
__publicField(this, "renderLayout", (childNode) => {
|
|
16590
16697
|
var _a2, _b;
|
|
16591
16698
|
const { label, name, required: required4, className, style, errorMessageAlign } = {
|
|
16592
|
-
...defaultProps$
|
|
16699
|
+
...defaultProps$V,
|
|
16593
16700
|
...this.props
|
|
16594
16701
|
};
|
|
16595
16702
|
const item = ((_a2 = this.context.errors) == null ? void 0 : _a2.length) > 0 && ((_b = this.context.errors) == null ? void 0 : _b.filter((item2) => {
|
|
@@ -16639,83 +16746,11 @@ class FormItem extends React__default.Component {
|
|
|
16639
16746
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: this.state.resetCount }, this.renderLayout(returnChildNode));
|
|
16640
16747
|
}
|
|
16641
16748
|
}
|
|
16642
|
-
__publicField(FormItem, "defaultProps", defaultProps$
|
|
16749
|
+
__publicField(FormItem, "defaultProps", defaultProps$V);
|
|
16643
16750
|
__publicField(FormItem, "contextType", Context);
|
|
16644
|
-
const
|
|
16645
|
-
|
|
16646
|
-
|
|
16647
|
-
starPosition: "left",
|
|
16648
|
-
onFinish: (values) => {
|
|
16649
|
-
},
|
|
16650
|
-
onFinishFailed: (values, errorFields) => {
|
|
16651
|
-
}
|
|
16652
|
-
};
|
|
16653
|
-
const PositionInfo = {
|
|
16654
|
-
top: "form-layout-top",
|
|
16655
|
-
left: "form-layout-left",
|
|
16656
|
-
right: "form-layout-right"
|
|
16657
|
-
};
|
|
16658
|
-
const Form = (props) => {
|
|
16659
|
-
const classPrefix2 = "nut-form";
|
|
16660
|
-
const {
|
|
16661
|
-
className,
|
|
16662
|
-
style,
|
|
16663
|
-
footer,
|
|
16664
|
-
children,
|
|
16665
|
-
initialValues,
|
|
16666
|
-
onFinish,
|
|
16667
|
-
onFinishFailed,
|
|
16668
|
-
labelPosition,
|
|
16669
|
-
starPosition,
|
|
16670
|
-
form
|
|
16671
|
-
} = {
|
|
16672
|
-
...defaultProps$V,
|
|
16673
|
-
...props
|
|
16674
|
-
};
|
|
16675
|
-
let formInstance;
|
|
16676
|
-
if (form !== void 0) {
|
|
16677
|
-
formInstance = form;
|
|
16678
|
-
} else {
|
|
16679
|
-
[formInstance] = useForm();
|
|
16680
|
-
}
|
|
16681
|
-
formInstance.starPosition = starPosition;
|
|
16682
|
-
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
16683
|
-
setCallback({
|
|
16684
|
-
onFinish,
|
|
16685
|
-
onFinishFailed
|
|
16686
|
-
});
|
|
16687
|
-
const mountRef = React__default.useRef(false);
|
|
16688
|
-
setInitialValues(initialValues, !mountRef.current);
|
|
16689
|
-
if (!mountRef.current) {
|
|
16690
|
-
mountRef.current = true;
|
|
16691
|
-
}
|
|
16692
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
16693
|
-
"form",
|
|
16694
|
-
{
|
|
16695
|
-
className: classNames(
|
|
16696
|
-
classPrefix2,
|
|
16697
|
-
className,
|
|
16698
|
-
PositionInfo[labelPosition]
|
|
16699
|
-
),
|
|
16700
|
-
style,
|
|
16701
|
-
onSubmit: (e) => {
|
|
16702
|
-
e.preventDefault();
|
|
16703
|
-
e.stopPropagation();
|
|
16704
|
-
submit();
|
|
16705
|
-
},
|
|
16706
|
-
onReset: (e) => {
|
|
16707
|
-
e.preventDefault();
|
|
16708
|
-
e.stopPropagation();
|
|
16709
|
-
resetFields();
|
|
16710
|
-
}
|
|
16711
|
-
},
|
|
16712
|
-
/* @__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)
|
|
16713
|
-
);
|
|
16714
|
-
};
|
|
16715
|
-
Form.defaultProps = defaultProps$V;
|
|
16716
|
-
Form.displayName = "NutForm";
|
|
16717
|
-
Form.Item = FormItem;
|
|
16718
|
-
Form.useForm = useForm;
|
|
16751
|
+
const InnerForm = Form;
|
|
16752
|
+
InnerForm.Item = FormItem;
|
|
16753
|
+
InnerForm.useForm = useForm;
|
|
16719
16754
|
function trimExtraChar(value, char, regExp) {
|
|
16720
16755
|
const index = value.indexOf(char);
|
|
16721
16756
|
if (index === -1) {
|
|
@@ -19709,16 +19744,24 @@ const Content = (props) => {
|
|
|
19709
19744
|
const handleClick2 = (e) => {
|
|
19710
19745
|
onClick && onClick(e);
|
|
19711
19746
|
};
|
|
19712
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
19747
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
19713
19748
|
"div",
|
|
19714
19749
|
{
|
|
19715
|
-
className: classPrefix2,
|
|
19716
|
-
style:
|
|
19750
|
+
className: classNames(`${classPrefix2}__outer`, props.className),
|
|
19751
|
+
style: props.style,
|
|
19752
|
+
onClick: (e) => handleClick2(e)
|
|
19717
19753
|
},
|
|
19718
|
-
|
|
19719
|
-
|
|
19720
|
-
|
|
19721
|
-
|
|
19754
|
+
/* @__PURE__ */ React__default.createElement(
|
|
19755
|
+
"div",
|
|
19756
|
+
{
|
|
19757
|
+
className: classPrefix2,
|
|
19758
|
+
style: { display: visible ? "flex" : "none" }
|
|
19759
|
+
},
|
|
19760
|
+
renderHeader(),
|
|
19761
|
+
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__content` }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children)),
|
|
19762
|
+
renderFooter()
|
|
19763
|
+
)
|
|
19764
|
+
);
|
|
19722
19765
|
};
|
|
19723
19766
|
Content.displayName = "NutContent";
|
|
19724
19767
|
const defaultDialogProps = {
|
|
@@ -19777,6 +19820,7 @@ const DialogWrap = (props) => {
|
|
|
19777
19820
|
DialogWrap.defaultProps = defaultDialogProps;
|
|
19778
19821
|
DialogWrap.displayName = "NutDialogWrap";
|
|
19779
19822
|
const defaultProps$D = {
|
|
19823
|
+
...ComponentDefaults,
|
|
19780
19824
|
confirmText: "",
|
|
19781
19825
|
cancelText: "",
|
|
19782
19826
|
overlay: true,
|
|
@@ -25212,7 +25256,7 @@ export {
|
|
|
25212
25256
|
Ellipsis,
|
|
25213
25257
|
Empty,
|
|
25214
25258
|
FixedNav,
|
|
25215
|
-
Form,
|
|
25259
|
+
InnerForm as Form,
|
|
25216
25260
|
FormItem,
|
|
25217
25261
|
Grid,
|
|
25218
25262
|
GridItem,
|