@nutui/nutui-react-taro 2.0.0-alpha.7 → 2.0.0-alpha.9
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 +26 -0
- package/dist/esm/Address.js +2 -2
- package/dist/esm/Audio.js +7 -6
- package/dist/esm/Card.js +5 -5
- package/dist/esm/Cascader.js +2 -2
- package/dist/esm/DatePicker.js +2 -3
- package/dist/esm/Elevator.js +1 -1
- package/dist/esm/ImagePreview.js +4 -7
- package/dist/esm/Indicator.js +1 -1
- package/dist/esm/InputNumber.js +1 -1
- package/dist/esm/Notify.js +2 -3
- package/dist/esm/NumberKeyboard.js +3 -5
- package/dist/esm/Picker.js +1 -2
- package/dist/esm/Price.js +2 -3
- package/dist/esm/PullToRefresh.js +4 -6
- package/dist/esm/Radio.js +3 -3
- package/dist/esm/RadioGroup.js +3 -3
- package/dist/esm/Range/style/index.js +1 -1
- package/dist/esm/Range.js +5 -7
- package/dist/esm/Sticky.js +1 -2
- package/dist/esm/Swiper.js +3 -5
- package/dist/esm/SwiperItem.js +1 -5
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/{address.taro-1c534feb.js → address.taro-1a8ab3f1.js} +1 -1
- package/dist/esm/{audio.taro-ec96ef80.js → audio.taro-bbd39f93.js} +2 -2
- package/dist/esm/{card.taro-a46fdf25.js → card.taro-2080f4d2.js} +1 -1
- package/dist/esm/{cascader.taro-0a2694ed.js → cascader.taro-fb7a0230.js} +21 -13
- package/dist/esm/{datepicker.taro-3f718964.js → datepicker.taro-65dbeceb.js} +1 -1
- package/dist/esm/{elevator.taro-bc162e4f.js → elevator.taro-df8fde9d.js} +20 -15
- package/dist/esm/{imagepreview.taro-8832dc01.js → imagepreview.taro-2508d412.js} +8 -5
- package/dist/esm/{indicator.taro-f2bd212f.js → indicator.taro-edbc71df.js} +3 -3
- package/dist/esm/{inputnumber.taro-877dc947.js → inputnumber.taro-6657d2c1.js} +1 -1
- package/dist/esm/{notify.taro-6b6eb6bf.js → notify.taro-5768403d.js} +11 -18
- package/dist/esm/numberkeyboard.taro-ad8afaf9.js +136 -0
- package/dist/esm/nutui-react.es.js +20 -25
- package/dist/esm/{picker.taro-a5603921.js → picker.taro-0570ec32.js} +14 -1
- package/dist/esm/{price.taro-c4f45310.js → price.taro-479f1b82.js} +17 -17
- package/dist/esm/pulltorefresh.taro-6afe4805.js +138 -0
- package/dist/esm/radio.taro-5d6ca4ad.js +153 -0
- package/dist/esm/range.taro-615e193a.js +259 -0
- package/dist/esm/{sticky.taro-3c03eb0a.js → sticky.taro-f8ae8d5e.js} +21 -1
- package/dist/esm/swiper.taro-53a36427.js +83 -0
- package/dist/esm/swiperitem.taro-ef7342e8.js +14 -0
- package/dist/esm/{tabs.taro-b75f20ff.js → tabs.taro-66164782.js} +8 -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/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.mjs +1634 -6666
- package/dist/nutui.react.umd.js +2047 -7095
- package/dist/packages/imagepreview/imagepreview.scss +5 -0
- package/dist/packages/notify/notify.scss +1 -1
- package/dist/packages/numberkeyboard/numberkeyboard.scss +29 -77
- package/dist/packages/price/price.scss +8 -0
- package/dist/packages/pulltorefresh/pulltorefresh.scss +0 -8
- package/dist/packages/radio/radio.scss +13 -32
- package/dist/packages/radiogroup/radiogroup.scss +17 -51
- package/dist/packages/range/range.scss +24 -49
- package/dist/packages/swiper/swiper.scss +0 -15
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +61 -61
- package/dist/styles/variables.scss +61 -60
- package/dist/types/index.d.ts +83 -118
- package/package.json +1 -1
- package/dist/esm/UserContext-735db09f.js +0 -5
- package/dist/esm/get-scroll-parent-8da04f2e.js +0 -24
- package/dist/esm/numberkeyboard.taro-0a0e866a.js +0 -183
- package/dist/esm/pulltorefresh.taro-c611fd92.js +0 -179
- package/dist/esm/radio.taro-3a54f4c8.js +0 -152
- package/dist/esm/range.taro-52cda918.js +0 -325
- package/dist/esm/supports-passive-aaaf0eff.js +0 -17
- package/dist/esm/swiper.taro-74cf9306.js +0 -430
- package/dist/esm/swiperitem-80df464a.js +0 -29
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { CSSTransition } from "react-transition-group";
|
|
4
|
-
import {
|
|
4
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
5
5
|
const defaultProps = {
|
|
6
|
+
...ComponentDefaults,
|
|
6
7
|
id: "",
|
|
7
|
-
msg: "",
|
|
8
|
-
color: "",
|
|
9
8
|
duration: 3e3,
|
|
10
9
|
type: "danger",
|
|
11
|
-
className: "",
|
|
12
|
-
background: "",
|
|
13
10
|
position: "top",
|
|
14
|
-
isWrapTeleport: true,
|
|
15
11
|
visible: false,
|
|
16
|
-
|
|
12
|
+
onClose: () => {
|
|
17
13
|
},
|
|
18
14
|
onClick: () => {
|
|
19
15
|
}
|
|
20
16
|
};
|
|
17
|
+
const classPrefix = "nut-notify";
|
|
21
18
|
const Notify = (props) => {
|
|
22
|
-
const { id, children, style,
|
|
19
|
+
const { id, children, style, type, className, position, visible, duration, onClose, onClick, ...rest } = { ...defaultProps, ...props };
|
|
23
20
|
let timer;
|
|
24
21
|
const [showNotify, SetShow] = useState(false);
|
|
25
22
|
useEffect(() => {
|
|
@@ -53,14 +50,13 @@ const Notify = (props) => {
|
|
|
53
50
|
const element = document.getElementById(id);
|
|
54
51
|
element && element.parentNode && element.parentNode.removeChild(element);
|
|
55
52
|
}
|
|
56
|
-
|
|
53
|
+
onClose();
|
|
57
54
|
};
|
|
58
|
-
cn("notify");
|
|
59
55
|
const classes = classNames({
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
[
|
|
56
|
+
[`${classPrefix}--popup-top`]: position === "top",
|
|
57
|
+
[`${classPrefix}--popup-bottom`]: position === "bottom",
|
|
58
|
+
[`${classPrefix}`]: true,
|
|
59
|
+
[`${classPrefix}--${type}`]: true
|
|
64
60
|
});
|
|
65
61
|
return React.createElement(
|
|
66
62
|
React.Fragment,
|
|
@@ -68,10 +64,7 @@ const Notify = (props) => {
|
|
|
68
64
|
React.createElement(
|
|
69
65
|
CSSTransition,
|
|
70
66
|
{ in: showNotify, timeout: 300, classNames: "fade", unmountOnExit: true, appear: true, position, id },
|
|
71
|
-
React.createElement("div", { className: `${classes} ${className}`, style:
|
|
72
|
-
color: `${color || ""}`,
|
|
73
|
-
background: `${background || ""}`
|
|
74
|
-
}, onClick: clickHandle }, children || msg)
|
|
67
|
+
React.createElement("div", { className: `${classes} ${className}`, style, onClick: clickHandle }, children)
|
|
75
68
|
)
|
|
76
69
|
);
|
|
77
70
|
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React, { useMemo, useState } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { RectDown } from "@nutui/icons-react-taro";
|
|
4
|
+
import { View } from "@tarojs/components";
|
|
5
|
+
import { P as Popup } from "./popup.taro-e756f3fc.js";
|
|
6
|
+
import { u as useConfig } from "./configprovider.taro-25758d9f.js";
|
|
7
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
8
|
+
const defaultProps = {
|
|
9
|
+
...ComponentDefaults,
|
|
10
|
+
visible: false,
|
|
11
|
+
type: "default",
|
|
12
|
+
custom: [],
|
|
13
|
+
random: false,
|
|
14
|
+
onClose: () => {
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const NumberKeyboard = (props) => {
|
|
18
|
+
const { locale } = useConfig();
|
|
19
|
+
const { title, confirmText, visible, type, custom, random, style, className, onChange, onDelete, onClose, onConfirm, ...rest } = props;
|
|
20
|
+
const classPrefix = "nut-numberkeyboard";
|
|
21
|
+
const getBasicKeys = () => {
|
|
22
|
+
const keys = new Array(9).fill(0).map((_, index) => {
|
|
23
|
+
return {
|
|
24
|
+
id: String(index + 1),
|
|
25
|
+
type: "num"
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
return random ? keys.sort(() => Math.random() > 0.5 ? 1 : -1) : keys;
|
|
29
|
+
};
|
|
30
|
+
const getCustomKeys = () => {
|
|
31
|
+
const customKeys = [
|
|
32
|
+
{ id: "close", type: "close" },
|
|
33
|
+
{ id: "0", type: "num" },
|
|
34
|
+
{ id: "delete", type: "delete" }
|
|
35
|
+
];
|
|
36
|
+
if (!custom)
|
|
37
|
+
return customKeys;
|
|
38
|
+
if (custom.length > 0) {
|
|
39
|
+
customKeys[0] = { id: custom[0], type: "custom" };
|
|
40
|
+
}
|
|
41
|
+
if (custom.length > 1) {
|
|
42
|
+
customKeys[2] = { id: custom[1], type: "custom" };
|
|
43
|
+
}
|
|
44
|
+
return customKeys;
|
|
45
|
+
};
|
|
46
|
+
const keysList = useMemo(() => {
|
|
47
|
+
return [...getBasicKeys(), ...getCustomKeys()];
|
|
48
|
+
}, [type, random, custom]);
|
|
49
|
+
const DeleteIcon = () => {
|
|
50
|
+
const style2 = {
|
|
51
|
+
background: `url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAnCAYAAABJ0cukAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8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gb6kpKTn6KYzfBCehzg10H6lHPzMdIWq9U8znEpsXE6N4rTO9TjSGgPanG/pfwjwABn1PZcM5XI0AAAAABJRU5ErkJggg0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLTkwMjA5MzIyMjIxMzkzMzc2NzAwNjg0MC0tDQo=') no-repeat center`,
|
|
52
|
+
backgroundSize: "100% 100%",
|
|
53
|
+
width: "30px",
|
|
54
|
+
height: "24px"
|
|
55
|
+
};
|
|
56
|
+
return React.createElement(View, { style: style2 });
|
|
57
|
+
};
|
|
58
|
+
const NumberKeyboardKey = (props2) => {
|
|
59
|
+
const { item } = props2;
|
|
60
|
+
const [active, setActive] = useState(false);
|
|
61
|
+
const onTouchStart = () => {
|
|
62
|
+
setActive(true);
|
|
63
|
+
};
|
|
64
|
+
const onTouchEnd = (item2) => {
|
|
65
|
+
setActive(false);
|
|
66
|
+
if (item2.type === "num" || item2.type === "custom") {
|
|
67
|
+
onChange && onChange(item2.id);
|
|
68
|
+
}
|
|
69
|
+
if (item2.type === "close") {
|
|
70
|
+
onClose && onClose();
|
|
71
|
+
}
|
|
72
|
+
if (item2.type === "delete") {
|
|
73
|
+
onDelete && onDelete();
|
|
74
|
+
}
|
|
75
|
+
if (item2.type === "confirm") {
|
|
76
|
+
onConfirm && onConfirm();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return React.createElement(
|
|
80
|
+
"div",
|
|
81
|
+
{ key: item.id, className: `${classPrefix}__body__wrapper` },
|
|
82
|
+
React.createElement(
|
|
83
|
+
"div",
|
|
84
|
+
{ className: classNames({
|
|
85
|
+
key: true,
|
|
86
|
+
active,
|
|
87
|
+
close: item.type === "close",
|
|
88
|
+
delete: item.type === "delete",
|
|
89
|
+
confirm: item.type === "confirm"
|
|
90
|
+
}), onTouchStart: () => onTouchStart(), onTouchEnd: () => onTouchEnd(item), onTouchCancel: () => onTouchEnd(item) },
|
|
91
|
+
(item.type === "num" || item.type === "custom") && React.createElement("div", null, item.id),
|
|
92
|
+
item.type === "delete" && React.createElement(DeleteIcon, null),
|
|
93
|
+
item.type === "close" && React.createElement(RectDown, { size: 25 }),
|
|
94
|
+
item.type === "confirm" && React.createElement(React.Fragment, null, confirmText || locale.done)
|
|
95
|
+
)
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
return React.createElement(
|
|
99
|
+
Popup,
|
|
100
|
+
{ visible, position: "bottom", onClickOverlay: onClose, onClickCloseIcon: onClose, overlayStyle: { backgroundColor: "rgba(0, 0, 0, 0)" }, ...rest },
|
|
101
|
+
React.createElement(
|
|
102
|
+
"div",
|
|
103
|
+
{ className: classNames(classPrefix, className), style },
|
|
104
|
+
title && React.createElement(
|
|
105
|
+
"div",
|
|
106
|
+
{ className: `${classPrefix}__header` },
|
|
107
|
+
React.createElement("h3", { className: `${classPrefix}__header__title` }, title),
|
|
108
|
+
type === "default" && React.createElement("span", { className: `${classPrefix}__header__close`, onClick: onClose }, locale.done)
|
|
109
|
+
),
|
|
110
|
+
React.createElement(
|
|
111
|
+
"div",
|
|
112
|
+
{ className: `${classPrefix}__body` },
|
|
113
|
+
React.createElement("div", { className: `${classPrefix}__body__keys` }, keysList == null ? void 0 : keysList.map((item) => {
|
|
114
|
+
return React.createElement(NumberKeyboardKey, { key: item.id, item });
|
|
115
|
+
})),
|
|
116
|
+
type === "rightColumn" && React.createElement(
|
|
117
|
+
"div",
|
|
118
|
+
{ className: `${classPrefix}__sidebar` },
|
|
119
|
+
React.createElement(NumberKeyboardKey, { key: "delete", item: {
|
|
120
|
+
id: "delete",
|
|
121
|
+
type: "delete"
|
|
122
|
+
} }),
|
|
123
|
+
React.createElement(NumberKeyboardKey, { key: "confirm", item: {
|
|
124
|
+
id: "confirm",
|
|
125
|
+
type: "confirm"
|
|
126
|
+
} })
|
|
127
|
+
)
|
|
128
|
+
)
|
|
129
|
+
)
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
NumberKeyboard.defaultProps = defaultProps;
|
|
133
|
+
NumberKeyboard.displayName = "NutNumberKeyboard";
|
|
134
|
+
export {
|
|
135
|
+
NumberKeyboard as N
|
|
136
|
+
};
|
|
@@ -10,9 +10,9 @@ import { G } from "./grid.taro-fbbd8618.js";
|
|
|
10
10
|
import { G as G2 } from "./griditem.taro-b0c37077.js";
|
|
11
11
|
import { L } from "./layout.taro-9659a928.js";
|
|
12
12
|
import { R } from "./row.taro-8b7febd4.js";
|
|
13
|
-
import { S } from "./sticky.taro-
|
|
13
|
+
import { S } from "./sticky.taro-f8ae8d5e.js";
|
|
14
14
|
import { B as B2 } from "./backtop.taro-7de36464.js";
|
|
15
|
-
import { E } from "./elevator.taro-
|
|
15
|
+
import { E } from "./elevator.taro-df8fde9d.js";
|
|
16
16
|
import { F } from "./fixednav.taro-28e5f776.js";
|
|
17
17
|
import { N } from "./navbar.taro-5e1a0835.js";
|
|
18
18
|
import { S as S2 } from "./sidenavbar.taro-9f210df4.js";
|
|
@@ -21,23 +21,23 @@ import { S as S4 } from "./subsidenavbar.taro-abe07673.js";
|
|
|
21
21
|
import { T } from "./tabbar.taro-18eee41f.js";
|
|
22
22
|
import { T as T2 } from "./tabbaritem.taro-89646ca1.js";
|
|
23
23
|
import { T as T3 } from "./tabpane.taro-f8d92ece.js";
|
|
24
|
-
import { T as T4 } from "./tabs.taro-
|
|
25
|
-
import { A } from "./address.taro-
|
|
24
|
+
import { T as T4 } from "./tabs.taro-66164782.js";
|
|
25
|
+
import { A } from "./address.taro-1a8ab3f1.js";
|
|
26
26
|
import { C as C5 } from "./calendar.taro-10a6cb11.js";
|
|
27
27
|
import { C as C6 } from "./calendaritem.taro-3e5f114e.js";
|
|
28
|
-
import { C as C7 } from "./cascader.taro-
|
|
28
|
+
import { C as C7 } from "./cascader.taro-fb7a0230.js";
|
|
29
29
|
import { C as C8, a } from "./checkbox.taro-016074da.js";
|
|
30
|
-
import { D as D2 } from "./datepicker.taro-
|
|
30
|
+
import { D as D2 } from "./datepicker.taro-65dbeceb.js";
|
|
31
31
|
import { F as F2 } from "./form.taro-b06754e8.js";
|
|
32
32
|
import { F as F3 } from "./formitem.taro-b326809d.js";
|
|
33
33
|
import { I as I2 } from "./input.taro-27d686c9.js";
|
|
34
|
-
import { I as I3 } from "./inputnumber.taro-
|
|
34
|
+
import { I as I3 } from "./inputnumber.taro-6657d2c1.js";
|
|
35
35
|
import { M } from "./menu.taro-cd0fef41.js";
|
|
36
36
|
import { M as M2 } from "./menuitem.taro-6076bffa.js";
|
|
37
|
-
import { N as N2 } from "./numberkeyboard.taro-
|
|
38
|
-
import { P } from "./picker.taro-
|
|
39
|
-
import { R as R2, a as a2 } from "./radio.taro-
|
|
40
|
-
import { R as R3 } from "./range.taro-
|
|
37
|
+
import { N as N2 } from "./numberkeyboard.taro-ad8afaf9.js";
|
|
38
|
+
import { P } from "./picker.taro-0570ec32.js";
|
|
39
|
+
import { R as R2, a as a2 } from "./radio.taro-5d6ca4ad.js";
|
|
40
|
+
import { R as R3 } from "./range.taro-615e193a.js";
|
|
41
41
|
import { R as R4 } from "./rate.taro-78c66969.js";
|
|
42
42
|
import { S as S5 } from "./searchbar.taro-37ade36e.js";
|
|
43
43
|
import { S as S6 } from "./shortpassword.taro-f7292032.js";
|
|
@@ -52,16 +52,16 @@ import { D as D3 } from "./drag.taro-48e1ff38.js";
|
|
|
52
52
|
import { E as E2 } from "./empty.taro-ca792f57.js";
|
|
53
53
|
import { I as I4 } from "./infiniteloading.taro-f8f23ac6.js";
|
|
54
54
|
import { N as N3 } from "./noticebar.taro-b3bfd4fe.js";
|
|
55
|
-
import { N as N4 } from "./notify.taro-
|
|
55
|
+
import { N as N4 } from "./notify.taro-5768403d.js";
|
|
56
56
|
import { P as P2 } from "./popover.taro-ad483372.js";
|
|
57
|
-
import { P as P3 } from "./pulltorefresh.taro-
|
|
57
|
+
import { P as P3 } from "./pulltorefresh.taro-6afe4805.js";
|
|
58
58
|
import { S as S9 } from "./skeleton.taro-9ff9baf4.js";
|
|
59
59
|
import { S as S10 } from "./swipe.taro-de80fcd8.js";
|
|
60
60
|
import { P as P4 } from "./popup.taro-e756f3fc.js";
|
|
61
61
|
import { T as T6 } from "./toast.taro-92c10e1d.js";
|
|
62
62
|
import { A as A3 } from "./animate.taro-c8b29242.js";
|
|
63
63
|
import { A as A4 } from "./animatingnumbers.taro-c2a52dbd.js";
|
|
64
|
-
import { A as A5 } from "./audio.taro-
|
|
64
|
+
import { A as A5 } from "./audio.taro-bbd39f93.js";
|
|
65
65
|
import { A as A6 } from "./avatar.taro-01536aff.js";
|
|
66
66
|
import { A as A7 } from "./avatargroup-ad5ffb46.js";
|
|
67
67
|
import { C as C9 } from "./circleprogress.taro-7149e09d.js";
|
|
@@ -69,21 +69,21 @@ import { C as C10 } from "./collapse.taro-3d997680.js";
|
|
|
69
69
|
import { C as C11 } from "./collapseitem-f4571575.js";
|
|
70
70
|
import { C as C12 } from "./countdown.taro-22200811.js";
|
|
71
71
|
import { E as E3 } from "./ellipsis.taro-f9688dd7.js";
|
|
72
|
-
import { I as I5 } from "./imagepreview.taro-
|
|
73
|
-
import { I as I6 } from "./indicator.taro-
|
|
72
|
+
import { I as I5 } from "./imagepreview.taro-2508d412.js";
|
|
73
|
+
import { I as I6 } from "./indicator.taro-edbc71df.js";
|
|
74
74
|
import { V } from "./virtuallist.taro-99f03769.js";
|
|
75
75
|
import { P as P5 } from "./pagination.taro-63607c3b.js";
|
|
76
|
-
import { P as P6 } from "./price.taro-
|
|
76
|
+
import { P as P6 } from "./price.taro-479f1b82.js";
|
|
77
77
|
import { P as P7 } from "./progress.taro-ff63be75.js";
|
|
78
78
|
import { S as S11 } from "./step.taro-3bc01c0c.js";
|
|
79
79
|
import { S as S12 } from "./steps.taro-77e301ab.js";
|
|
80
|
-
import { S as S13 } from "./swiper.taro-
|
|
81
|
-
import { S as S14 } from "./swiperitem-
|
|
80
|
+
import { S as S13 } from "./swiper.taro-53a36427.js";
|
|
81
|
+
import { S as S14 } from "./swiperitem.taro-ef7342e8.js";
|
|
82
82
|
import { T as T7 } from "./table.taro-15a55c5d.js";
|
|
83
83
|
import { T as T8 } from "./tag.taro-1b4134a5.js";
|
|
84
84
|
import { V as V2 } from "./video-5d106e33.js";
|
|
85
85
|
import { B as B5 } from "./barrage.taro-c8cb9864.js";
|
|
86
|
-
import { C as C13 } from "./card.taro-
|
|
86
|
+
import { C as C13 } from "./card.taro-2080f4d2.js";
|
|
87
87
|
import { T as T9 } from "./timedetail.taro-8d2acbbf.js";
|
|
88
88
|
import { T as T10 } from "./timepannel.taro-ee4c5dfa.js";
|
|
89
89
|
import { T as T11 } from "./timeselect.taro-069deedd.js";
|
|
@@ -97,7 +97,6 @@ import "@tarojs/components";
|
|
|
97
97
|
import "./UserContext-ab42ba7f.js";
|
|
98
98
|
import "@tarojs/taro";
|
|
99
99
|
import "./use-client-rect-f317804e.js";
|
|
100
|
-
import "./get-scroll-parent-8da04f2e.js";
|
|
101
100
|
import "./can-use-dom-0e539bd3.js";
|
|
102
101
|
import "./offsetContext-f32a9246.js";
|
|
103
102
|
import "./use-props-value-7ac1b1b5.js";
|
|
@@ -106,14 +105,10 @@ import "@bem-react/classname";
|
|
|
106
105
|
import "./ConfigProvider.js";
|
|
107
106
|
import "react-transition-group";
|
|
108
107
|
import "./use-touch-ff43512c.js";
|
|
109
|
-
import "./supports-passive-aaaf0eff.js";
|
|
110
108
|
import "./index-e3184f19.js";
|
|
111
|
-
import "@use-gesture/react";
|
|
112
|
-
import "@react-spring/web";
|
|
113
109
|
import "react-dom";
|
|
114
110
|
import "./context-d0fccf11.js";
|
|
115
111
|
import "./UserContext-fde5badc.js";
|
|
116
|
-
import "./UserContext-735db09f.js";
|
|
117
112
|
export {
|
|
118
113
|
A2 as ActionSheet,
|
|
119
114
|
A as Address,
|
|
@@ -5,10 +5,23 @@ import { View, PickerView, PickerViewColumn } from "@tarojs/components";
|
|
|
5
5
|
import { P as Popup } from "./popup.taro-e756f3fc.js";
|
|
6
6
|
import { u as useTouch } from "./use-touch-ff43512c.js";
|
|
7
7
|
import { g as getRectByTaro } from "./use-client-rect-f317804e.js";
|
|
8
|
-
import {
|
|
8
|
+
import { c as canUseDom } from "./can-use-dom-0e539bd3.js";
|
|
9
9
|
import { u as useConfig } from "./configprovider.taro-25758d9f.js";
|
|
10
10
|
import { u as usePropsValue } from "./use-props-value-7ac1b1b5.js";
|
|
11
11
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
12
|
+
let passiveSupported = false;
|
|
13
|
+
if (canUseDom) {
|
|
14
|
+
try {
|
|
15
|
+
const opts = Object.defineProperty({}, "passive", {
|
|
16
|
+
get() {
|
|
17
|
+
passiveSupported = true;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
window.addEventListener("test-passive-supported", null, opts);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.log(e);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
12
25
|
const InternalPickerPanel = (props, ref) => {
|
|
13
26
|
const { keyIndex = 0, defaultValue, options = [], threeDimensional = true, duration = 1e3, itemShow = false, chooseItem } = props;
|
|
14
27
|
const touch = useTouch();
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
3
3
|
const defaultProps = {
|
|
4
|
+
...ComponentDefaults,
|
|
4
5
|
price: 0,
|
|
5
|
-
needSymbol: true,
|
|
6
6
|
symbol: "¥",
|
|
7
|
-
|
|
7
|
+
digits: 2,
|
|
8
8
|
thousands: false,
|
|
9
9
|
position: "before",
|
|
10
10
|
size: "large",
|
|
11
|
-
|
|
11
|
+
line: false
|
|
12
12
|
};
|
|
13
13
|
const Price = (props) => {
|
|
14
|
-
const { price,
|
|
14
|
+
const { price, symbol, digits, thousands, position, size, line, className, style, ...rest } = {
|
|
15
15
|
...defaultProps,
|
|
16
16
|
...props
|
|
17
17
|
};
|
|
18
|
-
const
|
|
18
|
+
const classPrefix = "nut-price";
|
|
19
19
|
const replaceSpecialChar = (url) => {
|
|
20
20
|
url = url.replace(/"/g, '"');
|
|
21
21
|
url = url.replace(/&/g, "&");
|
|
@@ -26,7 +26,7 @@ const Price = (props) => {
|
|
|
26
26
|
return url;
|
|
27
27
|
};
|
|
28
28
|
const showSymbol = () => {
|
|
29
|
-
return { __html:
|
|
29
|
+
return { __html: symbol ? replaceSpecialChar(symbol) : "" };
|
|
30
30
|
};
|
|
31
31
|
const checkPoint = (price2) => {
|
|
32
32
|
return String(price2).indexOf(".") > 0;
|
|
@@ -36,7 +36,7 @@ const Price = (props) => {
|
|
|
36
36
|
num = 0;
|
|
37
37
|
}
|
|
38
38
|
if (checkPoint(num)) {
|
|
39
|
-
num = Number(num).toFixed(
|
|
39
|
+
num = Number(num).toFixed(digits);
|
|
40
40
|
num = typeof num.split(".") === "string" ? num.split(".") : num.split(".")[0];
|
|
41
41
|
} else {
|
|
42
42
|
num = num.toString();
|
|
@@ -51,26 +51,26 @@ const Price = (props) => {
|
|
|
51
51
|
decimalNum = 0;
|
|
52
52
|
}
|
|
53
53
|
if (checkPoint(decimalNum)) {
|
|
54
|
-
decimalNum = Number(decimalNum).toFixed(
|
|
54
|
+
decimalNum = Number(decimalNum).toFixed(digits);
|
|
55
55
|
decimalNum = typeof decimalNum.split(".") === "string" ? 0 : decimalNum.split(".")[1] || 0;
|
|
56
56
|
} else {
|
|
57
57
|
decimalNum = 0;
|
|
58
58
|
}
|
|
59
59
|
const result = `0.${decimalNum}`;
|
|
60
|
-
const resultFixed = Number(result).toFixed(
|
|
60
|
+
const resultFixed = Number(result).toFixed(digits);
|
|
61
61
|
return String(resultFixed).substring(2, resultFixed.length);
|
|
62
62
|
};
|
|
63
63
|
const renderSymbol = () => {
|
|
64
|
-
return React.createElement("div", { className: `${
|
|
64
|
+
return React.createElement("div", { className: `${classPrefix}__symbol ${classPrefix}__symbol-${size}`, dangerouslySetInnerHTML: showSymbol() });
|
|
65
65
|
};
|
|
66
66
|
return React.createElement(
|
|
67
67
|
"div",
|
|
68
|
-
{ className: `${
|
|
69
|
-
|
|
70
|
-
React.createElement("div", { className: `${
|
|
71
|
-
|
|
72
|
-
React.createElement("div", { className: `${
|
|
73
|
-
|
|
68
|
+
{ className: `${classPrefix} ${className} ${line ? `${classPrefix}--line` : ""}`, style, ...rest },
|
|
69
|
+
symbol && position === "before" ? renderSymbol() : null,
|
|
70
|
+
React.createElement("div", { className: `${classPrefix}__integer ${classPrefix}__integer-${size}` }, formatThousands(price)),
|
|
71
|
+
digits !== 0 ? React.createElement("div", { className: `${classPrefix}__decimal ${classPrefix}__decimal-${size}` }, ".") : null,
|
|
72
|
+
React.createElement("div", { className: `${classPrefix}__decimal ${classPrefix}__decimal-${size}` }, formatDecimal(price)),
|
|
73
|
+
symbol && position === "after" ? renderSymbol() : null
|
|
74
74
|
);
|
|
75
75
|
};
|
|
76
76
|
Price.defaultProps = defaultProps;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React, { useRef, useState } from "react";
|
|
2
|
+
import { View } from "@tarojs/components";
|
|
3
|
+
import { u as useConfig } from "./configprovider.taro-25758d9f.js";
|
|
4
|
+
import { u as useTouch } from "./use-touch-ff43512c.js";
|
|
5
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
6
|
+
function bound(position, min, max) {
|
|
7
|
+
let ret = position;
|
|
8
|
+
if (min !== void 0) {
|
|
9
|
+
ret = Math.max(position, min);
|
|
10
|
+
}
|
|
11
|
+
if (max !== void 0) {
|
|
12
|
+
ret = Math.min(ret, max);
|
|
13
|
+
}
|
|
14
|
+
return ret;
|
|
15
|
+
}
|
|
16
|
+
function rubberband(distance, dimension, constant) {
|
|
17
|
+
return distance * dimension * constant / (dimension + constant * distance);
|
|
18
|
+
}
|
|
19
|
+
function rubberbandIfOutOfBounds(position, min, max, dimension, constant = 0.15) {
|
|
20
|
+
if (constant === 0)
|
|
21
|
+
return bound(position, min, max);
|
|
22
|
+
if (position < min)
|
|
23
|
+
return -rubberband(min - position, dimension, constant) + min;
|
|
24
|
+
if (position > max)
|
|
25
|
+
return +rubberband(position - max, dimension, constant) + max;
|
|
26
|
+
return position;
|
|
27
|
+
}
|
|
28
|
+
const sleep = (time) => new Promise((resolve) => setTimeout(resolve, time));
|
|
29
|
+
const defaultProps = {
|
|
30
|
+
...ComponentDefaults,
|
|
31
|
+
pullingText: "",
|
|
32
|
+
canReleaseText: "",
|
|
33
|
+
refreshingText: "",
|
|
34
|
+
completeText: "",
|
|
35
|
+
completeDelay: 500,
|
|
36
|
+
disabled: false,
|
|
37
|
+
headHeight: 40,
|
|
38
|
+
threshold: 60,
|
|
39
|
+
scrollTop: 0,
|
|
40
|
+
onRefresh: () => {
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const PullToRefresh = (p) => {
|
|
44
|
+
const classPrefix = "nut-pulltorefresh";
|
|
45
|
+
const { locale } = useConfig();
|
|
46
|
+
const touch = useTouch();
|
|
47
|
+
const props = {
|
|
48
|
+
...defaultProps,
|
|
49
|
+
...p,
|
|
50
|
+
...{
|
|
51
|
+
pullingText: p.pullingText || locale.pullToRefresh.pullingText,
|
|
52
|
+
canReleaseText: p.canReleaseText || locale.pullToRefresh.canReleaseText,
|
|
53
|
+
refreshingText: p.refreshingText || locale.pullToRefresh.refreshingText,
|
|
54
|
+
completeText: p.completeText || locale.pullToRefresh.completeText
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const headHeight = props.headHeight;
|
|
58
|
+
const threshold = props.threshold;
|
|
59
|
+
const heightRef = useRef(0);
|
|
60
|
+
const pullingRef = useRef(false);
|
|
61
|
+
const [status, setStatus] = useState("pulling");
|
|
62
|
+
const renderStatusText = () => {
|
|
63
|
+
var _a;
|
|
64
|
+
if (props.renderText) {
|
|
65
|
+
return (_a = props.renderText) == null ? void 0 : _a.call(props, status);
|
|
66
|
+
}
|
|
67
|
+
if (status === "pulling")
|
|
68
|
+
return props.pullingText;
|
|
69
|
+
if (status === "canRelease")
|
|
70
|
+
return props.canReleaseText;
|
|
71
|
+
if (status === "refreshing")
|
|
72
|
+
return props.refreshingText;
|
|
73
|
+
if (status === "complete")
|
|
74
|
+
return props.completeText;
|
|
75
|
+
return "";
|
|
76
|
+
};
|
|
77
|
+
const handleTouchStart = (e) => {
|
|
78
|
+
touch.start(e);
|
|
79
|
+
};
|
|
80
|
+
const handleTouchMove = (e) => {
|
|
81
|
+
if (props.scrollTop > 0) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (status === "refreshing" || status === "complete")
|
|
85
|
+
return;
|
|
86
|
+
touch.move(e);
|
|
87
|
+
if (touch.isVertical()) {
|
|
88
|
+
pullingRef.current = true;
|
|
89
|
+
heightRef.current = Math.max(rubberbandIfOutOfBounds(touch.deltaY, 0, 0, headHeight * 5, 0.5), 0);
|
|
90
|
+
setStatus(heightRef.current > threshold ? "canRelease" : "pulling");
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
async function doRefresh() {
|
|
94
|
+
heightRef.current = headHeight;
|
|
95
|
+
setStatus("refreshing");
|
|
96
|
+
try {
|
|
97
|
+
await props.onRefresh();
|
|
98
|
+
setStatus("complete");
|
|
99
|
+
} catch (e) {
|
|
100
|
+
heightRef.current = 0;
|
|
101
|
+
setStatus("pulling");
|
|
102
|
+
throw e;
|
|
103
|
+
}
|
|
104
|
+
if (props.completeDelay > 0) {
|
|
105
|
+
await sleep(props.completeDelay);
|
|
106
|
+
}
|
|
107
|
+
heightRef.current = 0;
|
|
108
|
+
setStatus("pulling");
|
|
109
|
+
}
|
|
110
|
+
const handleTouchEnd = () => {
|
|
111
|
+
pullingRef.current = false;
|
|
112
|
+
if (status === "canRelease") {
|
|
113
|
+
doRefresh();
|
|
114
|
+
} else {
|
|
115
|
+
heightRef.current = 0;
|
|
116
|
+
setStatus("pulling");
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const springStyles = {
|
|
120
|
+
height: `${heightRef.current}px`,
|
|
121
|
+
...!pullingRef.current ? { transition: "height .3s ease" } : {}
|
|
122
|
+
};
|
|
123
|
+
return React.createElement(
|
|
124
|
+
View,
|
|
125
|
+
{ className: `${classPrefix} ${props.className}`, style: props.style, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd },
|
|
126
|
+
React.createElement(
|
|
127
|
+
View,
|
|
128
|
+
{ style: springStyles, className: `${classPrefix}-head` },
|
|
129
|
+
React.createElement("div", { className: `${classPrefix}-head-content`, style: { height: headHeight } }, renderStatusText())
|
|
130
|
+
),
|
|
131
|
+
React.createElement("div", { className: `${classPrefix}-content` }, props.children)
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
PullToRefresh.defaultProps = defaultProps;
|
|
135
|
+
PullToRefresh.displayName = "NutPullToRefresh";
|
|
136
|
+
export {
|
|
137
|
+
PullToRefresh as P
|
|
138
|
+
};
|