@nutui/nutui-react-taro 2.0.12-beta.0 → 2.0.13
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 +11 -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/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/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/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
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.13 Wed Aug 16 2023 13:44:02 GMT+0800 (China Standard Time)
|
|
12
12
|
* (c) 2023 @jdf2e.
|
|
13
13
|
* Released under the MIT License.
|
|
14
14
|
*/
|
|
@@ -11033,7 +11033,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11033
11033
|
}
|
|
11034
11034
|
const controlled = {
|
|
11035
11035
|
...children.props,
|
|
11036
|
-
[this.props.valuePropName || "value"]: getFieldValue(name)
|
|
11036
|
+
[this.props.valuePropName || "value"]: getFieldValue(name) === void 0 ? this.props.initialValue : getFieldValue(name),
|
|
11037
11037
|
[this.props.trigger || "onChange"]: (...args) => {
|
|
11038
11038
|
const originOnChange = children.props[this.props.trigger || "onChange"];
|
|
11039
11039
|
if (originOnChange) {
|
|
@@ -11669,18 +11669,18 @@ var __publicField = (obj, key, value) => {
|
|
|
11669
11669
|
closeOnClickAway,
|
|
11670
11670
|
children,
|
|
11671
11671
|
activeColor,
|
|
11672
|
-
show,
|
|
11672
|
+
show: show2,
|
|
11673
11673
|
parent,
|
|
11674
11674
|
index
|
|
11675
11675
|
} = {
|
|
11676
11676
|
...defaultProps$U,
|
|
11677
11677
|
...props
|
|
11678
11678
|
};
|
|
11679
|
-
const [showPopup, setShowPopup] = React.useState(
|
|
11679
|
+
const [showPopup, setShowPopup] = React.useState(show2);
|
|
11680
11680
|
const [innerValue, setValue] = React.useState(value);
|
|
11681
11681
|
React.useEffect(() => {
|
|
11682
|
-
setShowPopup(
|
|
11683
|
-
}, [
|
|
11682
|
+
setShowPopup(show2);
|
|
11683
|
+
}, [show2]);
|
|
11684
11684
|
React.useEffect(() => {
|
|
11685
11685
|
getParentOffset();
|
|
11686
11686
|
}, [showPopup]);
|
|
@@ -14068,63 +14068,49 @@ var __publicField = (obj, key, value) => {
|
|
|
14068
14068
|
));
|
|
14069
14069
|
};
|
|
14070
14070
|
Content.displayName = "NutContent";
|
|
14071
|
-
const
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
overlayStyle,
|
|
14088
|
-
overlayClassName,
|
|
14089
|
-
closeOnOverlayClick,
|
|
14090
|
-
lockScroll,
|
|
14091
|
-
onClose,
|
|
14092
|
-
onCancel,
|
|
14093
|
-
onOverlayClick
|
|
14094
|
-
} = props;
|
|
14095
|
-
const onHandleClickOverlay = (e) => {
|
|
14096
|
-
console.log("onClose?.()", closeOnOverlayClick);
|
|
14097
|
-
if (closeOnOverlayClick && visible && e.target === e.currentTarget) {
|
|
14098
|
-
const closed = onOverlayClick && onOverlayClick(e);
|
|
14099
|
-
closed && (onClose == null ? void 0 : onClose());
|
|
14100
|
-
closed && (onCancel == null ? void 0 : onCancel());
|
|
14101
|
-
}
|
|
14071
|
+
const customEvents = new Taro.Events();
|
|
14072
|
+
function useCustomEventsPath(selector) {
|
|
14073
|
+
var _a;
|
|
14074
|
+
const path = (_a = Taro.getCurrentInstance().router) == null ? void 0 : _a.path;
|
|
14075
|
+
return path ? `${path}__${selector}` : selector;
|
|
14076
|
+
}
|
|
14077
|
+
function useCustomEvent(selector, cb) {
|
|
14078
|
+
const path = useCustomEventsPath(selector);
|
|
14079
|
+
React.useEffect(() => {
|
|
14080
|
+
customEvents.on(path, cb);
|
|
14081
|
+
return () => {
|
|
14082
|
+
customEvents.off(path);
|
|
14083
|
+
};
|
|
14084
|
+
}, []);
|
|
14085
|
+
const trigger = (args) => {
|
|
14086
|
+
customEvents.trigger(path, args);
|
|
14102
14087
|
};
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
}
|
|
14125
|
-
DialogWrap.defaultProps = defaultDialogProps;
|
|
14126
|
-
DialogWrap.displayName = "NutDialogWrap";
|
|
14088
|
+
const off = () => {
|
|
14089
|
+
customEvents.off(path);
|
|
14090
|
+
};
|
|
14091
|
+
return [trigger, off];
|
|
14092
|
+
}
|
|
14093
|
+
function useParams(args) {
|
|
14094
|
+
const forceUpdate = useForceUpdate();
|
|
14095
|
+
const stateRef = React.useRef(args);
|
|
14096
|
+
const currentRef = React.useRef();
|
|
14097
|
+
const previousRef = React.useRef();
|
|
14098
|
+
if (!isequal(currentRef.current, args)) {
|
|
14099
|
+
previousRef.current = currentRef.current;
|
|
14100
|
+
currentRef.current = args;
|
|
14101
|
+
stateRef.current = args;
|
|
14102
|
+
}
|
|
14103
|
+
const setParams = (args2) => {
|
|
14104
|
+
stateRef.current = { ...stateRef.current, ...args2 };
|
|
14105
|
+
forceUpdate();
|
|
14106
|
+
};
|
|
14107
|
+
const params = stateRef.current;
|
|
14108
|
+
return { params, setParams };
|
|
14109
|
+
}
|
|
14127
14110
|
const defaultProps$F = {
|
|
14111
|
+
title: "",
|
|
14112
|
+
content: "",
|
|
14113
|
+
footer: "",
|
|
14128
14114
|
confirmText: "",
|
|
14129
14115
|
cancelText: "",
|
|
14130
14116
|
overlay: true,
|
|
@@ -14135,92 +14121,143 @@ var __publicField = (obj, key, value) => {
|
|
|
14135
14121
|
footerDirection: "horizontal",
|
|
14136
14122
|
lockScroll: true,
|
|
14137
14123
|
beforeCancel: () => true,
|
|
14138
|
-
beforeClose: () => true
|
|
14124
|
+
beforeClose: () => true,
|
|
14125
|
+
onOverlayClick: () => void 0
|
|
14139
14126
|
};
|
|
14140
|
-
const BaseDialog =
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14127
|
+
const BaseDialog = (props) => {
|
|
14128
|
+
const classPrefix2 = "nut-dialog";
|
|
14129
|
+
const { locale } = useConfig$1();
|
|
14130
|
+
const {
|
|
14131
|
+
params: {
|
|
14132
|
+
id,
|
|
14144
14133
|
visible,
|
|
14145
14134
|
footer,
|
|
14135
|
+
title,
|
|
14136
|
+
footerDirection,
|
|
14146
14137
|
hideConfirmButton,
|
|
14147
14138
|
hideCancelButton,
|
|
14148
14139
|
lockScroll,
|
|
14149
14140
|
disableConfirmButton,
|
|
14150
14141
|
closeOnOverlayClick,
|
|
14142
|
+
onOverlayClick,
|
|
14151
14143
|
confirmText,
|
|
14152
14144
|
cancelText,
|
|
14145
|
+
overlay,
|
|
14153
14146
|
onClose,
|
|
14154
14147
|
onCancel,
|
|
14155
14148
|
onConfirm,
|
|
14156
14149
|
beforeCancel,
|
|
14157
|
-
beforeClose
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
fill: "outline",
|
|
14183
|
-
type: "primary",
|
|
14184
|
-
className: `${classPrefix2}__footer-cancel`,
|
|
14185
|
-
onClick: (e) => handleCancel(e)
|
|
14186
|
-
},
|
|
14187
|
-
cancelText || locale.cancel
|
|
14188
|
-
), !hideConfirmButton && /* @__PURE__ */ React.createElement(
|
|
14189
|
-
Button,
|
|
14190
|
-
{
|
|
14191
|
-
size: "small",
|
|
14192
|
-
type: "primary",
|
|
14193
|
-
className: classNames(`${classPrefix2}__footer-ok`, {
|
|
14194
|
-
disabled: disableConfirmButton
|
|
14195
|
-
}),
|
|
14196
|
-
disabled: disableConfirmButton,
|
|
14197
|
-
onClick: (e) => handleOk(e)
|
|
14198
|
-
},
|
|
14199
|
-
confirmText || locale.confirm
|
|
14200
|
-
));
|
|
14150
|
+
beforeClose
|
|
14151
|
+
},
|
|
14152
|
+
setParams
|
|
14153
|
+
} = useParams({ ...defaultProps$F, ...props });
|
|
14154
|
+
useCustomEvent(
|
|
14155
|
+
id,
|
|
14156
|
+
({ status, options }) => {
|
|
14157
|
+
if (status) {
|
|
14158
|
+
setParams({ ...options, visible: true });
|
|
14159
|
+
} else {
|
|
14160
|
+
setParams({ ...options, visible: false });
|
|
14161
|
+
}
|
|
14162
|
+
}
|
|
14163
|
+
);
|
|
14164
|
+
const renderFooter = () => {
|
|
14165
|
+
if (footer === null)
|
|
14166
|
+
return "";
|
|
14167
|
+
const handleCancel = (e) => {
|
|
14168
|
+
e.stopPropagation();
|
|
14169
|
+
if (!(beforeCancel == null ? void 0 : beforeCancel()))
|
|
14170
|
+
return;
|
|
14171
|
+
if (!(beforeClose == null ? void 0 : beforeClose()))
|
|
14172
|
+
return;
|
|
14173
|
+
onClose == null ? void 0 : onClose();
|
|
14174
|
+
onCancel == null ? void 0 : onCancel();
|
|
14201
14175
|
};
|
|
14202
|
-
|
|
14203
|
-
|
|
14176
|
+
const handleOk = (e) => {
|
|
14177
|
+
e.stopPropagation();
|
|
14178
|
+
onClose == null ? void 0 : onClose();
|
|
14179
|
+
onConfirm == null ? void 0 : onConfirm(e);
|
|
14180
|
+
};
|
|
14181
|
+
return footer || /* @__PURE__ */ React.createElement(React.Fragment, null, !hideCancelButton && /* @__PURE__ */ React.createElement(
|
|
14182
|
+
Button,
|
|
14204
14183
|
{
|
|
14205
|
-
|
|
14206
|
-
|
|
14184
|
+
size: "small",
|
|
14185
|
+
fill: "outline",
|
|
14186
|
+
type: "primary",
|
|
14187
|
+
className: `${classPrefix2}__footer-cancel`,
|
|
14188
|
+
onClick: (e) => handleCancel(e)
|
|
14189
|
+
},
|
|
14190
|
+
cancelText || locale.cancel
|
|
14191
|
+
), !hideConfirmButton && /* @__PURE__ */ React.createElement(
|
|
14192
|
+
Button,
|
|
14193
|
+
{
|
|
14194
|
+
size: "small",
|
|
14195
|
+
type: "primary",
|
|
14196
|
+
className: classNames(`${classPrefix2}__footer-ok`, {
|
|
14197
|
+
disabled: disableConfirmButton
|
|
14198
|
+
}),
|
|
14199
|
+
disabled: disableConfirmButton,
|
|
14200
|
+
onClick: (e) => handleOk(e)
|
|
14201
|
+
},
|
|
14202
|
+
confirmText || locale.confirm
|
|
14203
|
+
));
|
|
14204
|
+
};
|
|
14205
|
+
const onHandleClickOverlay = (e) => {
|
|
14206
|
+
console.log("onClose?.()", closeOnOverlayClick);
|
|
14207
|
+
if (closeOnOverlayClick && visible && e.target === e.currentTarget) {
|
|
14208
|
+
const closed = onOverlayClick && onOverlayClick();
|
|
14209
|
+
closed && (onClose == null ? void 0 : onClose());
|
|
14210
|
+
closed && (onCancel == null ? void 0 : onCancel());
|
|
14211
|
+
}
|
|
14212
|
+
};
|
|
14213
|
+
console.log("props", props, visible);
|
|
14214
|
+
return /* @__PURE__ */ React.createElement(
|
|
14215
|
+
components.View,
|
|
14216
|
+
{
|
|
14217
|
+
style: { display: visible ? "block" : "none" },
|
|
14218
|
+
catchMove: lockScroll
|
|
14219
|
+
},
|
|
14220
|
+
/* @__PURE__ */ React.createElement(React.Fragment, null, overlay ? /* @__PURE__ */ React.createElement(
|
|
14221
|
+
Overlay,
|
|
14222
|
+
{
|
|
14223
|
+
visible: true,
|
|
14224
|
+
closeOnOverlayClick,
|
|
14225
|
+
lockScroll,
|
|
14226
|
+
onClick: onHandleClickOverlay
|
|
14227
|
+
}
|
|
14228
|
+
) : null, /* @__PURE__ */ React.createElement(
|
|
14229
|
+
CSSTransition$1,
|
|
14230
|
+
{
|
|
14231
|
+
in: visible,
|
|
14232
|
+
timeout: 300,
|
|
14233
|
+
classNames: "fadeDialog",
|
|
14234
|
+
unmountOnExit: true,
|
|
14235
|
+
appear: true
|
|
14207
14236
|
},
|
|
14208
14237
|
/* @__PURE__ */ React.createElement(
|
|
14209
|
-
|
|
14238
|
+
Content,
|
|
14210
14239
|
{
|
|
14211
|
-
|
|
14212
|
-
visible,
|
|
14213
|
-
lockScroll,
|
|
14240
|
+
title,
|
|
14214
14241
|
footer: renderFooter(),
|
|
14215
|
-
|
|
14216
|
-
|
|
14242
|
+
footerDirection,
|
|
14243
|
+
visible
|
|
14217
14244
|
}
|
|
14218
14245
|
)
|
|
14219
|
-
)
|
|
14220
|
-
|
|
14221
|
-
|
|
14246
|
+
))
|
|
14247
|
+
);
|
|
14248
|
+
};
|
|
14249
|
+
function open$1(selector, options) {
|
|
14250
|
+
const path = useCustomEventsPath(selector);
|
|
14251
|
+
customEvents.trigger(path, { status: true, options });
|
|
14252
|
+
}
|
|
14253
|
+
function close$1(selector) {
|
|
14254
|
+
const path = useCustomEventsPath(selector);
|
|
14255
|
+
customEvents.trigger(path, { status: false });
|
|
14256
|
+
}
|
|
14222
14257
|
BaseDialog.defaultProps = defaultProps$F;
|
|
14223
14258
|
BaseDialog.displayName = "NutDialog";
|
|
14259
|
+
BaseDialog.open = open$1;
|
|
14260
|
+
BaseDialog.close = close$1;
|
|
14224
14261
|
const defaultProps$E = {
|
|
14225
14262
|
...ComponentDefaults,
|
|
14226
14263
|
attract: false,
|
|
@@ -14958,28 +14995,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14958
14995
|
};
|
|
14959
14996
|
NoticeBar.defaultProps = defaultProps$A;
|
|
14960
14997
|
NoticeBar.displayName = "NutNoticeBar";
|
|
14961
|
-
const customEvents = new Taro.Events();
|
|
14962
|
-
function useCustomEventsPath(selector) {
|
|
14963
|
-
var _a;
|
|
14964
|
-
const path = (_a = Taro.getCurrentInstance().router) == null ? void 0 : _a.path;
|
|
14965
|
-
return path ? `${path}__${selector}` : selector;
|
|
14966
|
-
}
|
|
14967
|
-
function useCustomEvent(selector, cb) {
|
|
14968
|
-
const path = useCustomEventsPath(selector);
|
|
14969
|
-
React.useEffect(() => {
|
|
14970
|
-
customEvents.on(path, cb);
|
|
14971
|
-
return () => {
|
|
14972
|
-
customEvents.off(path);
|
|
14973
|
-
};
|
|
14974
|
-
}, []);
|
|
14975
|
-
const trigger = (args) => {
|
|
14976
|
-
customEvents.trigger(path, args);
|
|
14977
|
-
};
|
|
14978
|
-
const off = () => {
|
|
14979
|
-
customEvents.off(path);
|
|
14980
|
-
};
|
|
14981
|
-
return [trigger, off];
|
|
14982
|
-
}
|
|
14983
14998
|
const defaultProps$z = {
|
|
14984
14999
|
...ComponentDefaults,
|
|
14985
15000
|
id: "",
|
|
@@ -15008,26 +15023,26 @@ var __publicField = (obj, key, value) => {
|
|
|
15008
15023
|
onClick
|
|
15009
15024
|
} = { ...defaultProps$z, ...props };
|
|
15010
15025
|
useCustomEvent(id, (status) => {
|
|
15011
|
-
status ?
|
|
15026
|
+
status ? show2() : hide2();
|
|
15012
15027
|
});
|
|
15013
15028
|
let timer;
|
|
15014
15029
|
const [showNotify, setShowNotify] = React.useState(false);
|
|
15015
15030
|
React.useEffect(() => {
|
|
15016
15031
|
if (visible) {
|
|
15017
|
-
|
|
15032
|
+
show2();
|
|
15018
15033
|
} else {
|
|
15019
|
-
|
|
15034
|
+
hide2();
|
|
15020
15035
|
}
|
|
15021
15036
|
}, [visible]);
|
|
15022
15037
|
const clickHandle = () => {
|
|
15023
15038
|
onClick();
|
|
15024
15039
|
};
|
|
15025
|
-
const
|
|
15040
|
+
const show2 = () => {
|
|
15026
15041
|
setShowNotify(true);
|
|
15027
15042
|
clearTimer();
|
|
15028
15043
|
if (duration) {
|
|
15029
15044
|
timer = window.setTimeout(() => {
|
|
15030
|
-
|
|
15045
|
+
hide2();
|
|
15031
15046
|
}, duration);
|
|
15032
15047
|
}
|
|
15033
15048
|
};
|
|
@@ -15037,7 +15052,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15037
15052
|
timer = null;
|
|
15038
15053
|
}
|
|
15039
15054
|
};
|
|
15040
|
-
const
|
|
15055
|
+
const hide2 = () => {
|
|
15041
15056
|
setShowNotify(false);
|
|
15042
15057
|
onClose();
|
|
15043
15058
|
};
|
|
@@ -15905,57 +15920,69 @@ var __publicField = (obj, key, value) => {
|
|
|
15905
15920
|
const classPrefix$8 = "nut-toast";
|
|
15906
15921
|
const Toast = (props) => {
|
|
15907
15922
|
const {
|
|
15908
|
-
|
|
15909
|
-
|
|
15910
|
-
|
|
15911
|
-
|
|
15912
|
-
|
|
15913
|
-
|
|
15914
|
-
|
|
15915
|
-
|
|
15916
|
-
|
|
15917
|
-
|
|
15918
|
-
|
|
15919
|
-
|
|
15920
|
-
|
|
15921
|
-
|
|
15922
|
-
|
|
15923
|
-
|
|
15924
|
-
|
|
15925
|
-
|
|
15926
|
-
|
|
15927
|
-
|
|
15923
|
+
params: {
|
|
15924
|
+
id,
|
|
15925
|
+
position,
|
|
15926
|
+
contentStyle,
|
|
15927
|
+
icon,
|
|
15928
|
+
iconSize,
|
|
15929
|
+
msg,
|
|
15930
|
+
duration,
|
|
15931
|
+
type: type2,
|
|
15932
|
+
title,
|
|
15933
|
+
closeOnOverlayClick,
|
|
15934
|
+
lockScroll,
|
|
15935
|
+
contentClassName,
|
|
15936
|
+
size,
|
|
15937
|
+
visible,
|
|
15938
|
+
className,
|
|
15939
|
+
style,
|
|
15940
|
+
onClose
|
|
15941
|
+
},
|
|
15942
|
+
setParams
|
|
15943
|
+
} = useParams({ ...defaultProps$s, ...props });
|
|
15928
15944
|
let timer;
|
|
15929
15945
|
const [openState, SetOpenState] = React.useState(false);
|
|
15930
15946
|
React.useEffect(() => {
|
|
15931
15947
|
if (visible) {
|
|
15932
|
-
|
|
15933
|
-
show();
|
|
15948
|
+
show2();
|
|
15934
15949
|
} else {
|
|
15935
|
-
|
|
15950
|
+
hide2();
|
|
15936
15951
|
}
|
|
15937
15952
|
}, [visible]);
|
|
15953
|
+
useCustomEvent(
|
|
15954
|
+
id,
|
|
15955
|
+
({ status, options }) => {
|
|
15956
|
+
if (status) {
|
|
15957
|
+
setParams(options);
|
|
15958
|
+
show2();
|
|
15959
|
+
} else {
|
|
15960
|
+
hide2();
|
|
15961
|
+
}
|
|
15962
|
+
}
|
|
15963
|
+
);
|
|
15938
15964
|
const clearTimer = () => {
|
|
15939
15965
|
if (timer) {
|
|
15940
15966
|
clearTimeout(timer);
|
|
15941
15967
|
timer = null;
|
|
15942
15968
|
}
|
|
15943
15969
|
};
|
|
15944
|
-
const
|
|
15970
|
+
const hide2 = () => {
|
|
15945
15971
|
SetOpenState(false);
|
|
15946
|
-
onClose();
|
|
15972
|
+
onClose == null ? void 0 : onClose();
|
|
15947
15973
|
};
|
|
15948
|
-
const
|
|
15974
|
+
const show2 = () => {
|
|
15949
15975
|
clearTimer();
|
|
15976
|
+
SetOpenState(true);
|
|
15950
15977
|
if (duration) {
|
|
15951
15978
|
timer = window.setTimeout(() => {
|
|
15952
|
-
|
|
15979
|
+
hide2();
|
|
15953
15980
|
}, duration * 1e3);
|
|
15954
15981
|
}
|
|
15955
15982
|
};
|
|
15956
15983
|
const clickCover = () => {
|
|
15957
15984
|
if (closeOnOverlayClick) {
|
|
15958
|
-
|
|
15985
|
+
hide2();
|
|
15959
15986
|
}
|
|
15960
15987
|
};
|
|
15961
15988
|
const hasIcon = () => {
|
|
@@ -16003,8 +16030,18 @@ var __publicField = (obj, key, value) => {
|
|
|
16003
16030
|
))
|
|
16004
16031
|
) : null);
|
|
16005
16032
|
};
|
|
16033
|
+
function show(selector, options) {
|
|
16034
|
+
const path = useCustomEventsPath(selector);
|
|
16035
|
+
customEvents.trigger(path, { status: true, options });
|
|
16036
|
+
}
|
|
16037
|
+
function hide(selector) {
|
|
16038
|
+
const path = useCustomEventsPath(selector);
|
|
16039
|
+
customEvents.trigger(path, { status: false });
|
|
16040
|
+
}
|
|
16006
16041
|
Toast.defaultProps = defaultProps$s;
|
|
16007
16042
|
Toast.displayName = "NutToast";
|
|
16043
|
+
Toast.show = show;
|
|
16044
|
+
Toast.hide = hide;
|
|
16008
16045
|
const defaultProps$r = {
|
|
16009
16046
|
...ComponentDefaults,
|
|
16010
16047
|
type: "shake",
|
package/dist/style.mjs
CHANGED
|
@@ -24,6 +24,7 @@ export interface BasicDialogProps {
|
|
|
24
24
|
onConfirm?: (e?: MouseEvent<HTMLButtonElement>) => Promise<() => void> | void;
|
|
25
25
|
onCancel?: () => void;
|
|
26
26
|
onClick?: () => void;
|
|
27
|
+
onOverlayClick?: () => void;
|
|
27
28
|
}
|
|
28
29
|
export type DialogReturnProps = {
|
|
29
30
|
update: (newConfig: ConfirmProps) => void;
|
|
@@ -7,5 +7,5 @@ interface ContentProps {
|
|
|
7
7
|
footerDirection: string;
|
|
8
8
|
onClick: (event: ITouchEvent) => void;
|
|
9
9
|
}
|
|
10
|
-
export declare const Content: FunctionComponent<Partial<ContentProps> & Omit<HTMLAttributes<HTMLDivElement>, 'onClick'>>;
|
|
10
|
+
export declare const Content: FunctionComponent<Partial<ContentProps> & Omit<HTMLAttributes<HTMLDivElement>, 'onClick' | 'title'>>;
|
|
11
11
|
export {};
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
2
|
import { BasicDialogProps } from './config';
|
|
3
|
-
|
|
4
|
-
export
|
|
3
|
+
import { BasicComponent } from '../../utils/typings';
|
|
4
|
+
export type DialogProps = BasicDialogProps & BasicComponent;
|
|
5
|
+
declare const defaultProps: DialogProps;
|
|
6
|
+
export declare const BaseDialog: FunctionComponent<Partial<DialogProps>> & {
|
|
7
|
+
open: typeof open;
|
|
8
|
+
close: typeof close;
|
|
9
|
+
};
|
|
10
|
+
export declare function open(selector: string, options: Partial<typeof defaultProps>): void;
|
|
11
|
+
export declare function close(selector: string): void;
|
|
12
|
+
export {};
|
|
@@ -71,4 +71,15 @@ export interface ToastProps extends BasicComponent {
|
|
|
71
71
|
*/
|
|
72
72
|
onClose: () => void
|
|
73
73
|
}
|
|
74
|
-
export declare const Toast: FunctionComponent<Partial<ToastProps> & React.HTMLAttributes<HTMLDivElement
|
|
74
|
+
export declare const Toast: FunctionComponent<Partial<ToastProps> & React.HTMLAttributes<HTMLDivElement>> & {
|
|
75
|
+
show: typeof show;
|
|
76
|
+
hide: typeof hide;
|
|
77
|
+
};
|
|
78
|
+
export interface ToastOptions {
|
|
79
|
+
title: string;
|
|
80
|
+
msg?: string;
|
|
81
|
+
type?: string;
|
|
82
|
+
duration?: number;
|
|
83
|
+
}
|
|
84
|
+
export declare function show(selector: string, options: ToastOptions): void;
|
|
85
|
+
export declare function hide(selector: string): void;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export declare const customEvents: TaroGeneral.Events;
|
|
2
2
|
export declare function useCustomEventsPath(selector: string): string;
|
|
3
3
|
export declare function useCustomEvent(selector: string, cb: any): (<T = any>(args: T) => void)[];
|
|
4
|
+
export declare function useParams<T = any>(args: T): {
|
|
5
|
+
params: T;
|
|
6
|
+
setParams: (args: T) => void;
|
|
7
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nutui/nutui-react-taro",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.13",
|
|
4
4
|
"style": "dist/style.css",
|
|
5
5
|
"main": "dist/nutui.react.umd.js",
|
|
6
6
|
"module": "dist/esm/nutui-react.es.js",
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@babel/runtime": "^7.21.0",
|
|
55
|
-
"@nutui/icons-react-taro": "0.0.1
|
|
55
|
+
"@nutui/icons-react-taro": "0.0.1",
|
|
56
56
|
"@nutui/touch-emulator": "^1.0.0",
|
|
57
57
|
"@react-spring/web": "~9.6.1",
|
|
58
58
|
"@use-gesture/react": "10.2.20",
|
|
59
59
|
"async-validator": "^4.2.5",
|
|
60
60
|
"classnames": "^2.3.2",
|
|
61
|
-
"lodash.kebabcase": "^4.1.1",
|
|
62
61
|
"lodash.isequal": "^4.5.0",
|
|
62
|
+
"lodash.kebabcase": "^4.1.1",
|
|
63
63
|
"react-transition-group": "^4.4.5"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"resolutions": {
|
|
69
69
|
"@types/react": "18",
|
|
70
|
-
"@types/react-dom": "18"
|
|
70
|
+
"@types/react-dom": "18",
|
|
71
|
+
"@swc/core": "1.3.42"
|
|
71
72
|
}
|
|
72
73
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { FunctionComponent, HTMLAttributes } from 'react';
|
|
2
|
-
import { OverlayProps } from '../../packages/overlay/overlay.taro';
|
|
3
|
-
interface DialogWrapProps extends OverlayProps {
|
|
4
|
-
visible: boolean;
|
|
5
|
-
overlay: boolean;
|
|
6
|
-
overlayStyle: React.CSSProperties;
|
|
7
|
-
overlayClassName: string;
|
|
8
|
-
footer: React.ReactNode;
|
|
9
|
-
onCancel: () => void;
|
|
10
|
-
onClose: () => void;
|
|
11
|
-
onOverlayClick: (e: MouseEvent) => boolean | void;
|
|
12
|
-
}
|
|
13
|
-
export declare const DialogWrap: FunctionComponent<Partial<DialogWrapProps> & Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'content' | 'onClick'>>;
|
|
14
|
-
export {};
|