@nutui/nutui-react-taro 2.0.12 → 2.0.14
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 +21 -0
- package/dist/esm/Address.js +7 -5
- package/dist/esm/Audio.js +6 -4
- package/dist/esm/Calendar.js +6 -4
- package/dist/esm/CalendarItem.js +5 -3
- package/dist/esm/Cascader.js +4 -3
- package/dist/esm/Checkbox.js +3 -2
- package/dist/esm/CheckboxGroup.js +3 -2
- package/dist/esm/Collapse.js +3 -2
- package/dist/esm/ConfigProvider.js +3 -2
- package/dist/esm/CountDown.js +3 -2
- package/dist/esm/DatePicker.js +6 -4
- package/dist/esm/Dialog.js +6 -3
- package/dist/esm/Empty.js +3 -2
- package/dist/esm/FixedNav.js +3 -2
- package/dist/esm/Form.js +2 -2
- package/dist/esm/FormItem.js +1 -1
- package/dist/esm/Grid.js +4 -3
- package/dist/esm/GridItem.js +3 -2
- package/dist/esm/ImagePreview.js +3 -2
- package/dist/esm/InfiniteLoading.js +3 -2
- package/dist/esm/Input.js +5 -3
- package/dist/esm/InputNumber.js +3 -2
- package/dist/esm/Notify.js +4 -1
- package/dist/esm/NumberKeyboard.js +3 -2
- package/dist/esm/Pagination.js +5 -3
- package/dist/esm/Picker.js +5 -3
- package/dist/esm/PullToRefresh.js +3 -2
- package/dist/esm/Radio.js +3 -2
- package/dist/esm/RadioGroup.js +3 -2
- package/dist/esm/Range.js +3 -2
- package/dist/esm/Rate.js +3 -2
- package/dist/esm/SearchBar.js +3 -2
- package/dist/esm/ShortPassword.js +5 -3
- package/dist/esm/Skeleton/style/style.css +1 -1
- package/dist/esm/Switch.js +3 -2
- package/dist/esm/Tabbar.js +3 -2
- package/dist/esm/Table.js +3 -2
- package/dist/esm/Tabs.js +3 -2
- package/dist/esm/TextArea.js +5 -3
- package/dist/esm/TimeSelect.js +3 -2
- package/dist/esm/Toast.js +5 -1
- package/dist/esm/Uploader.js +3 -2
- package/dist/esm/WaterMark.js +3 -2
- package/dist/esm/{address.taro-fe8a0601.js → address.taro-b58603a5.js} +3 -3
- package/dist/esm/{audio.taro-e85bb3b8.js → audio.taro-ef39c1d9.js} +2 -2
- package/dist/esm/{calendar.taro-29726d55.js → calendar.taro-c8ddf452.js} +2 -2
- package/dist/esm/{calendaritem.taro-9b37d00c.js → calendaritem.taro-0bd17638.js} +2 -2
- package/dist/esm/{cascader.taro-e05fd966.js → cascader.taro-ec5179d6.js} +2 -2
- package/dist/esm/{checkbox.taro-07d5c9d5.js → checkbox.taro-22cd35c4.js} +1 -1
- package/dist/esm/{collapse.taro-bd6b2bb3.js → collapse.taro-4a3e417c.js} +1 -1
- package/dist/esm/configprovider.taro-c5ff4877.js +483 -0
- package/dist/esm/{countdown.taro-80f2110b.js → countdown.taro-7caa9578.js} +1 -1
- package/dist/esm/{datepicker.taro-b894c285.js → datepicker.taro-288d64bb.js} +3 -3
- package/dist/esm/{dialog.taro-51697911.js → dialog.taro-519e45af.js} +50 -46
- package/dist/esm/{empty.taro-cef66b01.js → empty.taro-05f15f93.js} +1 -1
- package/dist/esm/{fixednav.taro-04cf5ffb.js → fixednav.taro-0d998d65.js} +1 -1
- package/dist/esm/{form.taro-16cb71e2.js → form.taro-6166be06.js} +1 -1
- package/dist/esm/{formitem.taro-34af0204.js → formitem.taro-9e2d3898.js} +1 -1
- package/dist/esm/{grid.taro-6f1b764c.js → grid.taro-f72acab8.js} +1 -1
- package/dist/esm/{griditem.taro-0d03a061.js → griditem.taro-b7abc653.js} +1 -1
- package/dist/esm/{imagepreview.taro-167d1380.js → imagepreview.taro-bc96904b.js} +1 -1
- package/dist/esm/{configprovider.taro-3a23ea84.js → index-21e61675.js} +26 -504
- package/dist/esm/{infiniteloading.taro-590cfd4f.js → infiniteloading.taro-cb3b949e.js} +1 -1
- package/dist/esm/{input.taro-abe6d65e.js → input.taro-fbcb7090.js} +2 -2
- package/dist/esm/{inputnumber.taro-9c74cc1c.js → inputnumber.taro-2f6f30d7.js} +1 -1
- package/dist/esm/{notify.taro-687d6f8c.js → notify.taro-07e9ead7.js} +2 -24
- package/dist/esm/{numberkeyboard.taro-42950800.js → numberkeyboard.taro-f19c44a8.js} +1 -1
- package/dist/esm/nutui-react.es.js +44 -41
- package/dist/esm/{pagination.taro-c2521fdf.js → pagination.taro-47fad28d.js} +2 -2
- package/dist/esm/{picker.taro-bd10e4e7.js → picker.taro-0770a67f.js} +2 -2
- package/dist/esm/{pulltorefresh.taro-2b4a48be.js → pulltorefresh.taro-f3ab76c2.js} +1 -1
- package/dist/esm/{radio.taro-802db0e9.js → radio.taro-d1d370be.js} +1 -1
- package/dist/esm/{range.taro-70101605.js → range.taro-fbbf5522.js} +1 -1
- package/dist/esm/{rate.taro-f090e140.js → rate.taro-61bbf5a7.js} +1 -1
- package/dist/esm/{searchbar.taro-75cf9937.js → searchbar.taro-7daf43fc.js} +1 -1
- package/dist/esm/{shortpassword.taro-d400cd45.js → shortpassword.taro-86563915.js} +2 -2
- package/dist/esm/{switch.taro-9c344336.js → switch.taro-74b2bd0a.js} +1 -1
- package/dist/esm/{tabbar.taro-ac4f72b9.js → tabbar.taro-4397646a.js} +1 -1
- package/dist/esm/{table.taro-48e8265e.js → table.taro-072907bf.js} +1 -1
- package/dist/esm/{tabs.taro-eceaf324.js → tabs.taro-3ece2221.js} +2 -1
- package/dist/esm/{textarea.taro-115dc986.js → textarea.taro-6ebe789c.js} +2 -2
- package/dist/esm/{timeselect.taro-e115bfd7.js → timeselect.taro-6e9fc4d4.js} +1 -1
- package/dist/esm/{toast.taro-b6ecbca7.js → toast.taro-a907b5f5.js} +28 -9
- package/dist/esm/types/src/packages/dialog/config.d.ts +1 -0
- package/dist/esm/types/src/packages/dialog/content.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/dialog/dialog.taro.d.ts +11 -3
- package/dist/esm/types/src/packages/toast/index.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/toast/toast.taro.d.ts +12 -1
- package/dist/esm/types/src/utils/use-custom-event.d.ts +4 -0
- package/dist/esm/{uploader.taro-cdb38c18.js → uploader.taro-c0bcca89.js} +1 -1
- package/dist/esm/use-custom-event-e1689884.js +49 -0
- package/dist/esm/use-force-update-9cd7c164.js +8 -0
- package/dist/esm/{use-props-value-e8331e19.js → use-props-value-c78cbf9b.js} +2 -6
- package/dist/esm/{watermark.taro-cea2fceb.js → watermark.taro-311b59d2.js} +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 +216 -179
- package/dist/nutui.react.umd.js +216 -179
- package/dist/packages/skeleton/skeleton.scss +3 -4
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/packages/dialog/config.d.ts +1 -0
- package/dist/types/packages/dialog/content.taro.d.ts +1 -1
- package/dist/types/packages/dialog/dialog.taro.d.ts +11 -3
- package/dist/types/packages/loading/loading.taro.d.ts +15 -3
- package/dist/types/packages/space/space.taro.d.ts +20 -4
- package/dist/types/packages/toast/index.taro.d.ts +1 -1
- package/dist/types/packages/toast/toast.taro.d.ts +12 -1
- package/dist/types/utils/use-custom-event.d.ts +4 -0
- package/package.json +5 -4
- package/dist/types/packages/dialog/dialogwrap.taro.d.ts +0 -14
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React__default
|
|
1
|
+
import React__default from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
|
+
import { CSSTransition } from "react-transition-group";
|
|
3
4
|
import { View } from "@tarojs/components";
|
|
4
5
|
import { B as Button } from "./button.taro-25f559e1.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { u as useConfig } from "./configprovider.taro-3a23ea84.js";
|
|
6
|
+
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
7
|
+
import { O as Overlay } from "./overlay.taro-626840fc.js";
|
|
8
|
+
import { u as useParams, a as useCustomEvent, b as useCustomEventsPath, c as customEvents } from "./use-custom-event-e1689884.js";
|
|
9
9
|
const Content = (props) => {
|
|
10
10
|
const { visible, title, footer, footerDirection, onClick, children } = props;
|
|
11
11
|
const classPrefix = "nut-dialog";
|
|
@@ -37,42 +37,10 @@ const Content = (props) => {
|
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
39
|
Content.displayName = "NutContent";
|
|
40
|
-
const defaultDialogProps = {
|
|
41
|
-
...ComponentDefaults,
|
|
42
|
-
overlay: true,
|
|
43
|
-
overlayStyle: {},
|
|
44
|
-
overlayClassName: "",
|
|
45
|
-
onCancel: () => {
|
|
46
|
-
},
|
|
47
|
-
onClose: () => {
|
|
48
|
-
},
|
|
49
|
-
onOverlayClick: (e) => true,
|
|
50
|
-
...defaultOverlayProps
|
|
51
|
-
};
|
|
52
|
-
const DialogWrap = (props) => {
|
|
53
|
-
const { visible, overlay, overlayStyle, overlayClassName, closeOnOverlayClick, lockScroll, onClose, onCancel, onOverlayClick } = props;
|
|
54
|
-
const onHandleClickOverlay = (e) => {
|
|
55
|
-
console.log("onClose?.()", closeOnOverlayClick);
|
|
56
|
-
if (closeOnOverlayClick && visible && e.target === e.currentTarget) {
|
|
57
|
-
const closed = onOverlayClick && onOverlayClick(e);
|
|
58
|
-
closed && (onClose == null ? void 0 : onClose());
|
|
59
|
-
closed && (onCancel == null ? void 0 : onCancel());
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
return React__default.createElement(
|
|
63
|
-
React__default.Fragment,
|
|
64
|
-
null,
|
|
65
|
-
overlay ? React__default.createElement(Overlay, { style: overlayStyle, className: overlayClassName, visible: true, closeOnOverlayClick, lockScroll, onClick: onHandleClickOverlay }) : null,
|
|
66
|
-
React__default.createElement(
|
|
67
|
-
CSSTransition,
|
|
68
|
-
{ in: visible, timeout: 300, classNames: "fadeDialog", unmountOnExit: true, appear: true },
|
|
69
|
-
React__default.createElement(Content, { ...props, visible })
|
|
70
|
-
)
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
DialogWrap.defaultProps = defaultDialogProps;
|
|
74
|
-
DialogWrap.displayName = "NutDialogWrap";
|
|
75
40
|
const defaultProps = {
|
|
41
|
+
title: "",
|
|
42
|
+
content: "",
|
|
43
|
+
footer: "",
|
|
76
44
|
confirmText: "",
|
|
77
45
|
cancelText: "",
|
|
78
46
|
overlay: true,
|
|
@@ -83,12 +51,20 @@ const defaultProps = {
|
|
|
83
51
|
footerDirection: "horizontal",
|
|
84
52
|
lockScroll: true,
|
|
85
53
|
beforeCancel: () => true,
|
|
86
|
-
beforeClose: () => true
|
|
54
|
+
beforeClose: () => true,
|
|
55
|
+
onOverlayClick: () => void 0
|
|
87
56
|
};
|
|
88
|
-
const BaseDialog =
|
|
89
|
-
const { locale } = useConfig();
|
|
90
|
-
const { visible, footer, hideConfirmButton, hideCancelButton, lockScroll, disableConfirmButton, closeOnOverlayClick, confirmText, cancelText, onClose, onCancel, onConfirm, beforeCancel, beforeClose, ...restProps } = props;
|
|
57
|
+
const BaseDialog = (props) => {
|
|
91
58
|
const classPrefix = "nut-dialog";
|
|
59
|
+
const { locale } = useConfig();
|
|
60
|
+
const { params: { id, visible, footer, title, footerDirection, hideConfirmButton, hideCancelButton, lockScroll, disableConfirmButton, closeOnOverlayClick, onOverlayClick, confirmText, cancelText, overlay, onClose, onCancel, onConfirm, beforeCancel, beforeClose }, setParams } = useParams({ ...defaultProps, ...props });
|
|
61
|
+
useCustomEvent(id, ({ status, options }) => {
|
|
62
|
+
if (status) {
|
|
63
|
+
setParams({ ...options, visible: true });
|
|
64
|
+
} else {
|
|
65
|
+
setParams({ ...options, visible: false });
|
|
66
|
+
}
|
|
67
|
+
});
|
|
92
68
|
const renderFooter = () => {
|
|
93
69
|
if (footer === null)
|
|
94
70
|
return "";
|
|
@@ -115,14 +91,42 @@ const BaseDialog = forwardRef((props, ref) => {
|
|
|
115
91
|
}), disabled: disableConfirmButton, onClick: (e) => handleOk(e) }, confirmText || locale.confirm)
|
|
116
92
|
);
|
|
117
93
|
};
|
|
94
|
+
const onHandleClickOverlay = (e) => {
|
|
95
|
+
console.log("onClose?.()", closeOnOverlayClick);
|
|
96
|
+
if (closeOnOverlayClick && visible && e.target === e.currentTarget) {
|
|
97
|
+
const closed = onOverlayClick && onOverlayClick();
|
|
98
|
+
closed && (onClose == null ? void 0 : onClose());
|
|
99
|
+
closed && (onCancel == null ? void 0 : onCancel());
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
console.log("props", props, visible);
|
|
118
103
|
return React__default.createElement(
|
|
119
104
|
View,
|
|
120
105
|
{ style: { display: visible ? "block" : "none" }, catchMove: lockScroll },
|
|
121
|
-
React__default.createElement(
|
|
106
|
+
React__default.createElement(
|
|
107
|
+
React__default.Fragment,
|
|
108
|
+
null,
|
|
109
|
+
overlay ? React__default.createElement(Overlay, { visible: true, closeOnOverlayClick, lockScroll, onClick: onHandleClickOverlay }) : null,
|
|
110
|
+
React__default.createElement(
|
|
111
|
+
CSSTransition,
|
|
112
|
+
{ in: visible, timeout: 300, classNames: "fadeDialog", unmountOnExit: true, appear: true },
|
|
113
|
+
React__default.createElement(Content, { title, footer: renderFooter(), footerDirection, visible })
|
|
114
|
+
)
|
|
115
|
+
)
|
|
122
116
|
);
|
|
123
|
-
}
|
|
117
|
+
};
|
|
118
|
+
function open(selector, options) {
|
|
119
|
+
const path = useCustomEventsPath(selector);
|
|
120
|
+
customEvents.trigger(path, { status: true, options });
|
|
121
|
+
}
|
|
122
|
+
function close(selector) {
|
|
123
|
+
const path = useCustomEventsPath(selector);
|
|
124
|
+
customEvents.trigger(path, { status: false });
|
|
125
|
+
}
|
|
124
126
|
BaseDialog.defaultProps = defaultProps;
|
|
125
127
|
BaseDialog.displayName = "NutDialog";
|
|
128
|
+
BaseDialog.open = open;
|
|
129
|
+
BaseDialog.close = close;
|
|
126
130
|
export {
|
|
127
131
|
BaseDialog as B
|
|
128
132
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default, { useState, useEffect } from "react";
|
|
2
|
-
import { u as useConfig } from "./configprovider.taro-
|
|
2
|
+
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
3
3
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
4
4
|
const defaultStatus = {
|
|
5
5
|
empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png",
|
|
@@ -2,7 +2,7 @@ import React__default from "react";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { Left } from "@nutui/icons-react-taro";
|
|
4
4
|
import { O as Overlay } from "./overlay.taro-626840fc.js";
|
|
5
|
-
import { u as useConfig } from "./configprovider.taro-
|
|
5
|
+
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
6
6
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
7
7
|
const defaultProps = {
|
|
8
8
|
...ComponentDefaults,
|
|
@@ -8,7 +8,7 @@ import React__default, { useRef } from "react";
|
|
|
8
8
|
import classNames from "classnames";
|
|
9
9
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
10
10
|
import { C as Cell } from "./cell.taro-0a9f80bc.js";
|
|
11
|
-
import { C as Context, F as FormItem } from "./formitem.taro-
|
|
11
|
+
import { C as Context, F as FormItem } from "./formitem.taro-9e2d3898.js";
|
|
12
12
|
function _extends() {
|
|
13
13
|
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
14
14
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -40,7 +40,7 @@ class FormItem extends React__default.Component {
|
|
|
40
40
|
}
|
|
41
41
|
const controlled = {
|
|
42
42
|
...children.props,
|
|
43
|
-
[this.props.valuePropName || "value"]: getFieldValue(name)
|
|
43
|
+
[this.props.valuePropName || "value"]: getFieldValue(name) === void 0 ? this.props.initialValue : getFieldValue(name),
|
|
44
44
|
[this.props.trigger || "onChange"]: (...args) => {
|
|
45
45
|
const originOnChange = children.props[this.props.trigger || "onChange"];
|
|
46
46
|
if (originOnChange) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
|
-
import { a as GridContext, G as GridItem, p as pxCheck } from "./griditem.taro-
|
|
3
|
+
import { a as GridContext, G as GridItem, p as pxCheck } from "./griditem.taro-b7abc653.js";
|
|
4
4
|
const defaultProps = {
|
|
5
5
|
columns: 4,
|
|
6
6
|
gap: 0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { useContext } from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
|
-
import { u as useConfig } from "./configprovider.taro-
|
|
3
|
+
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
4
4
|
const gridContext = {
|
|
5
5
|
onClick: (item, index) => {
|
|
6
6
|
}
|
|
@@ -5,7 +5,7 @@ import { P as Popup } from "./popup.taro-487eb86e.js";
|
|
|
5
5
|
import InnerSwiper from "./Swiper.js";
|
|
6
6
|
import { S as SwiperItem } from "./swiperitem.taro-da39a67b.js";
|
|
7
7
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
8
|
-
import { u as usePropsValue } from "./use-props-value-
|
|
8
|
+
import { u as usePropsValue } from "./use-props-value-c78cbf9b.js";
|
|
9
9
|
const defaultProps = {
|
|
10
10
|
...ComponentDefaults,
|
|
11
11
|
images: [],
|