@nutui/nutui-react 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/Audio.js +12 -8
- package/dist/esm/Cascader.js +20 -12
- package/dist/esm/Elevator.js +6 -5
- package/dist/esm/Image.js +2 -5
- package/dist/esm/ImagePreview.js +9 -9
- package/dist/esm/Indicator.js +4 -4
- package/dist/esm/Notify.js +35 -46
- package/dist/esm/NumberKeyboard.js +137 -195
- package/dist/esm/Price.js +22 -23
- package/dist/esm/PullToRefresh.js +8 -8
- package/dist/esm/Radio.js +2 -0
- package/dist/esm/RadioGroup.js +31 -51
- package/dist/esm/Range/style/index.js +1 -1
- package/dist/esm/Range.js +119 -174
- package/dist/esm/Swiper.js +100 -111
- package/dist/esm/SwiperItem.js +1 -1
- package/dist/esm/radio2.js +52 -54
- package/dist/esm/tabs2.js +19 -8
- 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 +1306 -1386
- package/dist/nutui.react.umd.js +1305 -1385
- 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 +84 -106
- package/package.json +1 -1
- /package/dist/esm/{UserContext3.js → context2.js} +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
var _excluded = ["title", "confirmText", "visible", "type", "custom", "random", "style", "className", "onChange", "onDelete", "onClose", "onConfirm"];
|
|
4
6
|
function ownKeys(object, enumerableOnly) {
|
|
5
7
|
var keys = Object.keys(object);
|
|
6
8
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -22,226 +24,166 @@ function _objectSpread(target) {
|
|
|
22
24
|
}
|
|
23
25
|
return target;
|
|
24
26
|
}
|
|
25
|
-
import React__default, {
|
|
27
|
+
import React__default, { useMemo, useState } from "react";
|
|
26
28
|
import classNames from "classnames";
|
|
27
|
-
import {
|
|
29
|
+
import { RectDown } from "@nutui/icons-react";
|
|
28
30
|
import Popup from "./Popup.js";
|
|
29
31
|
import { useConfig } from "./ConfigProvider.js";
|
|
30
|
-
import "
|
|
31
|
-
var defaultProps = {
|
|
32
|
-
confirmText: "",
|
|
33
|
-
title: "",
|
|
32
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
33
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
34
34
|
visible: false,
|
|
35
|
-
overlay: true,
|
|
36
35
|
type: "default",
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
randomKeys: false,
|
|
40
|
-
popClass: "",
|
|
36
|
+
custom: [],
|
|
37
|
+
random: false,
|
|
41
38
|
onClose: function onClose() {
|
|
42
39
|
}
|
|
43
|
-
};
|
|
40
|
+
});
|
|
44
41
|
var NumberKeyboard = function NumberKeyboard2(props) {
|
|
45
42
|
var _useConfig = useConfig(), locale = _useConfig.locale;
|
|
46
|
-
var title = props.title, confirmText = props.confirmText, visible = props.visible,
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return [].concat(_toConsumableArray(getBasicKeys()), [leftBottomKey, {
|
|
70
|
-
id: 0,
|
|
71
|
-
type: "number"
|
|
43
|
+
var title = props.title, confirmText = props.confirmText, visible = props.visible, type = props.type, custom = props.custom, random = props.random, style = props.style, className = props.className, onChange = props.onChange, onDelete = props.onDelete, onClose2 = props.onClose, onConfirm = props.onConfirm, rest = _objectWithoutProperties(props, _excluded);
|
|
44
|
+
var classPrefix = "nut-numberkeyboard";
|
|
45
|
+
var getBasicKeys = function getBasicKeys2() {
|
|
46
|
+
var keys = new Array(9).fill(0).map(function(_, index) {
|
|
47
|
+
return {
|
|
48
|
+
id: String(index + 1),
|
|
49
|
+
type: "num"
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
return random ? keys.sort(function() {
|
|
53
|
+
return Math.random() > 0.5 ? 1 : -1;
|
|
54
|
+
}) : keys;
|
|
55
|
+
};
|
|
56
|
+
var getCustomKeys = function getCustomKeys2() {
|
|
57
|
+
var customKeys = [{
|
|
58
|
+
id: "close",
|
|
59
|
+
type: "close"
|
|
60
|
+
}, {
|
|
61
|
+
id: "0",
|
|
62
|
+
type: "num"
|
|
72
63
|
}, {
|
|
73
64
|
id: "delete",
|
|
74
65
|
type: "delete"
|
|
75
|
-
}]
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
id: i,
|
|
82
|
-
type: "number"
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
if (randomKeys) {
|
|
86
|
-
return keys.sort(function() {
|
|
87
|
-
return Math.random() > 0.5 ? 1 : -1;
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
return keys;
|
|
91
|
-
};
|
|
92
|
-
var genCustomKeys = function genCustomKeys2() {
|
|
93
|
-
var keys = getBasicKeys();
|
|
94
|
-
if (!customKey)
|
|
95
|
-
return [];
|
|
96
|
-
var customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
97
|
-
if (customKeys.length > 2) {
|
|
98
|
-
customKeys = [customKeys[0], customKeys[1]];
|
|
99
|
-
}
|
|
100
|
-
if (customKeys.length === 2 && props.title && props.type !== "rightColumn") {
|
|
101
|
-
customKeys = [customKeys[0]];
|
|
102
|
-
}
|
|
103
|
-
if (customKeys.length === 1) {
|
|
104
|
-
if (props.title && props.type !== "rightColumn") {
|
|
105
|
-
keys.push({
|
|
106
|
-
id: customKeys[0],
|
|
107
|
-
type: "custom"
|
|
108
|
-
}, {
|
|
109
|
-
id: 0,
|
|
110
|
-
type: "number"
|
|
111
|
-
}, {
|
|
112
|
-
id: "delete",
|
|
113
|
-
type: "delete"
|
|
114
|
-
});
|
|
115
|
-
} else {
|
|
116
|
-
keys.push({
|
|
117
|
-
id: 0,
|
|
118
|
-
type: "number"
|
|
119
|
-
}, {
|
|
120
|
-
id: customKeys[0],
|
|
121
|
-
type: "custom"
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
} else if (customKeys.length === 2) {
|
|
125
|
-
keys.push({
|
|
126
|
-
id: customKeys[0],
|
|
127
|
-
type: "custom"
|
|
128
|
-
}, {
|
|
129
|
-
id: 0,
|
|
130
|
-
type: "number"
|
|
131
|
-
}, {
|
|
132
|
-
id: customKeys[1],
|
|
66
|
+
}];
|
|
67
|
+
if (!custom)
|
|
68
|
+
return customKeys;
|
|
69
|
+
if (custom.length > 0) {
|
|
70
|
+
customKeys[0] = {
|
|
71
|
+
id: custom[0],
|
|
133
72
|
type: "custom"
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return keys;
|
|
137
|
-
};
|
|
138
|
-
useEffect(function() {
|
|
139
|
-
if (props.type === "rightColumn" || props.title !== "") {
|
|
140
|
-
setKeysList(genCustomKeys());
|
|
141
|
-
} else {
|
|
142
|
-
setKeysList(defaultKey());
|
|
143
|
-
}
|
|
144
|
-
}, []);
|
|
145
|
-
var onTouchstart = function onTouchstart2(item, event) {
|
|
146
|
-
event.stopPropagation();
|
|
147
|
-
setClickKeyIndex(item.id);
|
|
148
|
-
if (item.type === "number" || item.type === "custom") {
|
|
149
|
-
onChange && onChange(item.id);
|
|
73
|
+
};
|
|
150
74
|
}
|
|
151
|
-
if (
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
75
|
+
if (custom.length > 1) {
|
|
76
|
+
customKeys[2] = {
|
|
77
|
+
id: custom[1],
|
|
78
|
+
type: "custom"
|
|
79
|
+
};
|
|
156
80
|
}
|
|
81
|
+
return customKeys;
|
|
157
82
|
};
|
|
158
|
-
var
|
|
159
|
-
|
|
83
|
+
var keysList = useMemo(function() {
|
|
84
|
+
return [].concat(_toConsumableArray(getBasicKeys()), _toConsumableArray(getCustomKeys()));
|
|
85
|
+
}, [type, random, custom]);
|
|
86
|
+
var DeleteIcon = function DeleteIcon2() {
|
|
87
|
+
return React__default.createElement("svg", {
|
|
88
|
+
viewBox: "0 0 1024 1024",
|
|
89
|
+
width: "36",
|
|
90
|
+
height: "36"
|
|
91
|
+
}, React__default.createElement("path", {
|
|
92
|
+
d: "M875.594 186.122H390.803a51.162 51.162 0 0 0-36.18 14.986L79.91 475.821a51.166 51.166 0 0 0 0 72.358l274.714 274.712a51.164 51.164 0 0 0 36.179 14.986h484.791c46.033 0 83.484-37.45 83.484-83.483V269.606c.001-46.033-37.45-83.484-83.483-83.484zm32.32 568.274c0 17.85-14.473 32.318-32.32 32.318H390.803L116.089 512l274.714-274.714h484.791c17.849 0 32.32 14.47 32.32 32.32v484.789z",
|
|
93
|
+
fill: "currentColor"
|
|
94
|
+
}), React__default.createElement("path", {
|
|
95
|
+
d: "M753.945 360.214l-121.43 121.429-121.43-121.429s-16.062-8.224-30.356 6.072c-14.295 14.295-6.073 30.357-6.073 30.357l121.43 121.428L486.8 627.357s-8.222 16.062 6.072 30.357c14.297 14.296 30.358 6.072 30.358 6.072l109.286-109.285 109.286 109.285s16.062 8.224 30.357-6.072c14.295-14.295 6.07-30.357 6.07-30.357L668.944 518.072l121.431-121.43s8.22-16.061-6.074-30.356c-14.294-14.296-30.356-6.072-30.356-6.072z",
|
|
96
|
+
fill: "currentColor"
|
|
97
|
+
}));
|
|
160
98
|
};
|
|
161
|
-
var
|
|
162
|
-
|
|
163
|
-
|
|
99
|
+
var NumberKeyboardKey = function NumberKeyboardKey2(props2) {
|
|
100
|
+
var item = props2.item;
|
|
101
|
+
var _useState = useState(false), _useState2 = _slicedToArray(_useState, 2), active = _useState2[0], setActive = _useState2[1];
|
|
102
|
+
var _onTouchStart = function onTouchStart() {
|
|
103
|
+
setActive(true);
|
|
104
|
+
};
|
|
105
|
+
var _onTouchEnd = function onTouchEnd(item2) {
|
|
106
|
+
setActive(false);
|
|
107
|
+
if (item2.type === "num" || item2.type === "custom") {
|
|
108
|
+
onChange && onChange(item2.id);
|
|
109
|
+
}
|
|
110
|
+
if (item2.type === "close") {
|
|
111
|
+
onClose2 && onClose2();
|
|
112
|
+
}
|
|
113
|
+
if (item2.type === "delete") {
|
|
114
|
+
onDelete && onDelete();
|
|
115
|
+
}
|
|
116
|
+
if (item2.type === "confirm") {
|
|
117
|
+
onConfirm && onConfirm();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
return React__default.createElement("div", {
|
|
121
|
+
key: item.id,
|
|
122
|
+
className: "".concat(classPrefix, "__body__wrapper")
|
|
123
|
+
}, React__default.createElement("div", {
|
|
124
|
+
className: classNames({
|
|
125
|
+
key: true,
|
|
126
|
+
active,
|
|
127
|
+
close: item.type === "close",
|
|
128
|
+
"delete": item.type === "delete",
|
|
129
|
+
confirm: item.type === "confirm"
|
|
130
|
+
}),
|
|
131
|
+
onTouchStart: function onTouchStart() {
|
|
132
|
+
return _onTouchStart();
|
|
133
|
+
},
|
|
134
|
+
onTouchEnd: function onTouchEnd() {
|
|
135
|
+
return _onTouchEnd(item);
|
|
136
|
+
},
|
|
137
|
+
onTouchCancel: function onTouchCancel() {
|
|
138
|
+
return _onTouchEnd(item);
|
|
139
|
+
}
|
|
140
|
+
}, (item.type === "num" || item.type === "custom") && React__default.createElement("div", null, item.id), item.type === "delete" && React__default.createElement(DeleteIcon, null), item.type === "close" && React__default.createElement(RectDown, {
|
|
141
|
+
width: 25,
|
|
142
|
+
height: 25
|
|
143
|
+
}), item.type === "confirm" && React__default.createElement(React__default.Fragment, null, confirmText || locale.done)));
|
|
164
144
|
};
|
|
165
|
-
return React__default.createElement(
|
|
166
|
-
visible
|
|
145
|
+
return React__default.createElement(Popup, _objectSpread({
|
|
146
|
+
visible,
|
|
167
147
|
position: "bottom",
|
|
168
|
-
className: popClass,
|
|
169
148
|
onClickOverlay: onClose2,
|
|
170
|
-
overlay,
|
|
171
149
|
onClickCloseIcon: onClose2,
|
|
172
150
|
overlayStyle: {
|
|
173
151
|
backgroundColor: "rgba(0, 0, 0, 0)"
|
|
174
152
|
}
|
|
175
|
-
}, React__default.createElement("div", {
|
|
176
|
-
className:
|
|
177
|
-
style
|
|
178
|
-
}, title
|
|
179
|
-
className:
|
|
153
|
+
}, rest), React__default.createElement("div", {
|
|
154
|
+
className: classNames(classPrefix, className),
|
|
155
|
+
style
|
|
156
|
+
}, title && React__default.createElement("div", {
|
|
157
|
+
className: "".concat(classPrefix, "__header")
|
|
180
158
|
}, React__default.createElement("h3", {
|
|
181
|
-
className:
|
|
182
|
-
}, title), type === "default"
|
|
183
|
-
className:
|
|
184
|
-
onClick: onClose2
|
|
185
|
-
}, locale.done) : null) : null, React__default.createElement("div", {
|
|
186
|
-
className: b("body")
|
|
187
|
-
}, React__default.createElement("div", {
|
|
188
|
-
className: b("body__keys")
|
|
189
|
-
}, keysList === null || keysList === void 0 ? void 0 : keysList.map(function(item, index) {
|
|
190
|
-
return React__default.createElement("div", {
|
|
191
|
-
key: index,
|
|
192
|
-
className: classNames({
|
|
193
|
-
"key-board-wrapper": true,
|
|
194
|
-
"key-board-wrapper-large": item.id === 0 && type === "rightColumn" && Array.isArray(customKey) && customKey.length === 1
|
|
195
|
-
})
|
|
196
|
-
}, React__default.createElement("div", {
|
|
197
|
-
className: classNames({
|
|
198
|
-
key: true,
|
|
199
|
-
active: item.id === clickKeyIndex,
|
|
200
|
-
lock: item.type === "lock",
|
|
201
|
-
"delete": item.type === "delete"
|
|
202
|
-
}),
|
|
203
|
-
onTouchStart: function onTouchStart(event) {
|
|
204
|
-
return onTouchstart(item, event);
|
|
205
|
-
},
|
|
206
|
-
onTouchMove,
|
|
207
|
-
onTouchEnd
|
|
208
|
-
}, item.type === "number" || item.type === "custom" ? React__default.createElement("div", null, item.id) : null, item.type === "lock" ? React__default.createElement("img", {
|
|
209
|
-
src: "https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png",
|
|
210
|
-
alt: ""
|
|
211
|
-
}) : null, item.type === "delete" ? React__default.createElement("img", {
|
|
212
|
-
src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png",
|
|
213
|
-
alt: ""
|
|
214
|
-
}) : null));
|
|
215
|
-
})), type === "rightColumn" ? React__default.createElement("div", {
|
|
216
|
-
className: b("sidebar")
|
|
217
|
-
}, React__default.createElement("div", {
|
|
218
|
-
className: "key-board-wrapper"
|
|
219
|
-
}, React__default.createElement("div", {
|
|
220
|
-
className: classNames({
|
|
221
|
-
key: true,
|
|
222
|
-
active: clickKeyIndex === "delete"
|
|
223
|
-
}),
|
|
224
|
-
onTouchStart: function onTouchStart(event) {
|
|
225
|
-
return onTouchstart({
|
|
226
|
-
id: "delete",
|
|
227
|
-
type: "delete"
|
|
228
|
-
}, event);
|
|
229
|
-
},
|
|
230
|
-
onTouchMove,
|
|
231
|
-
onTouchEnd
|
|
232
|
-
}, React__default.createElement("img", {
|
|
233
|
-
src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png",
|
|
234
|
-
alt: ""
|
|
235
|
-
}))), React__default.createElement("div", {
|
|
236
|
-
className: "key-board-wrapper key-board-finish",
|
|
159
|
+
className: "".concat(classPrefix, "__header__title")
|
|
160
|
+
}, title), type === "default" && React__default.createElement("span", {
|
|
161
|
+
className: "".concat(classPrefix, "__header__close"),
|
|
237
162
|
onClick: onClose2
|
|
163
|
+
}, locale.done)), React__default.createElement("div", {
|
|
164
|
+
className: "".concat(classPrefix, "__body")
|
|
238
165
|
}, React__default.createElement("div", {
|
|
239
|
-
className:
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
166
|
+
className: "".concat(classPrefix, "__body__keys")
|
|
167
|
+
}, keysList === null || keysList === void 0 ? void 0 : keysList.map(function(item) {
|
|
168
|
+
return React__default.createElement(NumberKeyboardKey, {
|
|
169
|
+
key: item.id,
|
|
170
|
+
item
|
|
171
|
+
});
|
|
172
|
+
})), type === "rightColumn" && React__default.createElement("div", {
|
|
173
|
+
className: "".concat(classPrefix, "__sidebar")
|
|
174
|
+
}, React__default.createElement(NumberKeyboardKey, {
|
|
175
|
+
key: "delete",
|
|
176
|
+
item: {
|
|
177
|
+
id: "delete",
|
|
178
|
+
type: "delete"
|
|
179
|
+
}
|
|
180
|
+
}), React__default.createElement(NumberKeyboardKey, {
|
|
181
|
+
key: "confirm",
|
|
182
|
+
item: {
|
|
183
|
+
id: "confirm",
|
|
184
|
+
type: "confirm"
|
|
185
|
+
}
|
|
186
|
+
})))));
|
|
245
187
|
};
|
|
246
188
|
NumberKeyboard.defaultProps = defaultProps;
|
|
247
189
|
NumberKeyboard.displayName = "NutNumberKeyboard";
|
package/dist/esm/Price.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
var _excluded = ["price", "symbol", "digits", "thousands", "position", "size", "line", "className", "style"];
|
|
4
4
|
function ownKeys(object, enumerableOnly) {
|
|
5
5
|
var keys = Object.keys(object);
|
|
6
6
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -23,24 +23,22 @@ function _objectSpread(target) {
|
|
|
23
23
|
return target;
|
|
24
24
|
}
|
|
25
25
|
import React__default from "react";
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
var defaultProps = {
|
|
26
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
27
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
29
28
|
price: 0,
|
|
30
|
-
needSymbol: true,
|
|
31
29
|
symbol: "¥",
|
|
32
|
-
|
|
30
|
+
digits: 2,
|
|
33
31
|
thousands: false,
|
|
34
32
|
position: "before",
|
|
35
33
|
size: "large",
|
|
36
|
-
|
|
37
|
-
};
|
|
34
|
+
line: false
|
|
35
|
+
});
|
|
38
36
|
var Price = function Price2(props) {
|
|
39
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), price = _defaultProps$props.price,
|
|
40
|
-
var
|
|
37
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), price = _defaultProps$props.price, symbol = _defaultProps$props.symbol, digits = _defaultProps$props.digits, thousands = _defaultProps$props.thousands, position = _defaultProps$props.position, size = _defaultProps$props.size, line = _defaultProps$props.line, className = _defaultProps$props.className, style = _defaultProps$props.style, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
38
|
+
var classPrefix = "nut-price";
|
|
41
39
|
var showSymbol = function showSymbol2() {
|
|
42
40
|
return {
|
|
43
|
-
__html:
|
|
41
|
+
__html: symbol || ""
|
|
44
42
|
};
|
|
45
43
|
};
|
|
46
44
|
var checkPoint = function checkPoint2(price2) {
|
|
@@ -51,7 +49,7 @@ var Price = function Price2(props) {
|
|
|
51
49
|
num = 0;
|
|
52
50
|
}
|
|
53
51
|
if (checkPoint(num)) {
|
|
54
|
-
num = Number(num).toFixed(
|
|
52
|
+
num = Number(num).toFixed(digits);
|
|
55
53
|
num = typeof num.split(".") === "string" ? num.split(".") : num.split(".")[0];
|
|
56
54
|
} else {
|
|
57
55
|
num = num.toString();
|
|
@@ -66,30 +64,31 @@ var Price = function Price2(props) {
|
|
|
66
64
|
decimalNum = 0;
|
|
67
65
|
}
|
|
68
66
|
if (checkPoint(decimalNum)) {
|
|
69
|
-
decimalNum = Number(decimalNum).toFixed(
|
|
67
|
+
decimalNum = Number(decimalNum).toFixed(digits);
|
|
70
68
|
decimalNum = typeof decimalNum.split(".") === "string" ? 0 : decimalNum.split(".")[1] || 0;
|
|
71
69
|
} else {
|
|
72
70
|
decimalNum = 0;
|
|
73
71
|
}
|
|
74
72
|
var result = "0.".concat(decimalNum);
|
|
75
|
-
var resultFixed = Number(result).toFixed(
|
|
73
|
+
var resultFixed = Number(result).toFixed(digits);
|
|
76
74
|
return String(resultFixed).substring(2, resultFixed.length);
|
|
77
75
|
};
|
|
78
76
|
var renderSymbol = function renderSymbol2() {
|
|
79
77
|
return React__default.createElement("div", {
|
|
80
|
-
className: "".concat(
|
|
78
|
+
className: "".concat(classPrefix, "__symbol ").concat(classPrefix, "__symbol-").concat(size),
|
|
81
79
|
dangerouslySetInnerHTML: showSymbol()
|
|
82
80
|
});
|
|
83
81
|
};
|
|
84
82
|
return React__default.createElement("div", _objectSpread({
|
|
85
|
-
className: "".concat(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
className: "".concat(classPrefix, " ").concat(className, " ").concat(line ? "".concat(classPrefix, "--line") : ""),
|
|
84
|
+
style
|
|
85
|
+
}, rest), symbol && position === "before" ? renderSymbol() : null, React__default.createElement("div", {
|
|
86
|
+
className: "".concat(classPrefix, "__integer ").concat(classPrefix, "__integer-").concat(size)
|
|
87
|
+
}, formatThousands(price)), digits !== 0 ? React__default.createElement("div", {
|
|
88
|
+
className: "".concat(classPrefix, "__decimal ").concat(classPrefix, "__decimal-").concat(size)
|
|
90
89
|
}, ".") : null, React__default.createElement("div", {
|
|
91
|
-
className: "".concat(
|
|
92
|
-
}, formatDecimal(price)),
|
|
90
|
+
className: "".concat(classPrefix, "__decimal ").concat(classPrefix, "__decimal-").concat(size)
|
|
91
|
+
}, formatDecimal(price)), symbol && position === "after" ? renderSymbol() : null);
|
|
93
92
|
};
|
|
94
93
|
Price.defaultProps = defaultProps;
|
|
95
94
|
Price.displayName = "NutPrice";
|
|
@@ -28,6 +28,7 @@ import { useDrag } from "@use-gesture/react";
|
|
|
28
28
|
import { useSpring, animated } from "@react-spring/web";
|
|
29
29
|
import { useConfig } from "./ConfigProvider.js";
|
|
30
30
|
import { c as canUseDom, g as getScrollParent } from "./get-scroll-parent.js";
|
|
31
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
31
32
|
function bound(position, min, max) {
|
|
32
33
|
var ret = position;
|
|
33
34
|
if (min !== void 0) {
|
|
@@ -69,9 +70,7 @@ if (canUseDom) {
|
|
|
69
70
|
console.log(e);
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
var defaultProps = {
|
|
73
|
-
className: "",
|
|
74
|
-
style: {},
|
|
73
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
75
74
|
pullingText: "",
|
|
76
75
|
canReleaseText: "",
|
|
77
76
|
refreshingText: "",
|
|
@@ -82,8 +81,9 @@ var defaultProps = {
|
|
|
82
81
|
threshold: 60,
|
|
83
82
|
onRefresh: function onRefresh() {
|
|
84
83
|
}
|
|
85
|
-
};
|
|
84
|
+
});
|
|
86
85
|
var PullToRefresh = function PullToRefresh2(p) {
|
|
86
|
+
var classPrefix = "nut-pulltorefresh";
|
|
87
87
|
var _useConfig = useConfig(), locale = _useConfig.locale;
|
|
88
88
|
var props = _objectSpread(_objectSpread(_objectSpread({}, defaultProps), p), {
|
|
89
89
|
pullingText: p.pullingText || locale.pullToRefresh.pullingText,
|
|
@@ -280,18 +280,18 @@ var PullToRefresh = function PullToRefresh2(p) {
|
|
|
280
280
|
};
|
|
281
281
|
return React__default.createElement(animated.div, {
|
|
282
282
|
ref: elementRef,
|
|
283
|
-
className: "
|
|
283
|
+
className: "".concat(classPrefix, " ").concat(props.className),
|
|
284
284
|
style: props.style
|
|
285
285
|
}, React__default.createElement(animated.div, {
|
|
286
286
|
style: springStyles,
|
|
287
|
-
className: "
|
|
287
|
+
className: "".concat(classPrefix, "-head")
|
|
288
288
|
}, React__default.createElement("div", {
|
|
289
|
-
className: "
|
|
289
|
+
className: "".concat(classPrefix, "-head-content"),
|
|
290
290
|
style: {
|
|
291
291
|
height: headHeight
|
|
292
292
|
}
|
|
293
293
|
}, renderStatusText())), React__default.createElement("div", {
|
|
294
|
-
className: "
|
|
294
|
+
className: "".concat(classPrefix, "-content")
|
|
295
295
|
}, props.children));
|
|
296
296
|
};
|
|
297
297
|
PullToRefresh.defaultProps = defaultProps;
|
package/dist/esm/Radio.js
CHANGED
package/dist/esm/RadioGroup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["children", "className", "value", "defaultValue", "onChange", "labelPosition", "direction", "options", "disabled"], _excluded2 = ["label", "value", "disabled", "onChange"];
|
|
5
5
|
function ownKeys(object, enumerableOnly) {
|
|
6
6
|
var keys = Object.keys(object);
|
|
7
7
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -23,78 +23,58 @@ function _objectSpread(target) {
|
|
|
23
23
|
}
|
|
24
24
|
return target;
|
|
25
25
|
}
|
|
26
|
-
import React__default, {
|
|
26
|
+
import React__default, { useCallback } from "react";
|
|
27
|
+
import classNames from "classnames";
|
|
27
28
|
import { R as Radio, a as RadioContext } from "./radio2.js";
|
|
28
|
-
import {
|
|
29
|
+
import { u as usePropsValue } from "./use-props-value.js";
|
|
29
30
|
import "@nutui/icons-react";
|
|
30
31
|
import "./RadioGroup.js";
|
|
31
32
|
import "./typings.js";
|
|
32
|
-
import "@bem-react/classname";
|
|
33
33
|
var defaultProps = {
|
|
34
|
-
|
|
35
|
-
textPosition: "right",
|
|
34
|
+
labelPosition: "right",
|
|
36
35
|
onChange: function onChange(value) {
|
|
37
36
|
},
|
|
38
37
|
direction: "vertical",
|
|
39
38
|
options: []
|
|
40
39
|
};
|
|
40
|
+
var classPrefix = "nut-radiogroup";
|
|
41
41
|
var RadioGroup = React__default.forwardRef(function(props, ref) {
|
|
42
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
function validateChildChecked(child) {
|
|
50
|
-
if (val2State === null)
|
|
51
|
-
return false;
|
|
52
|
-
return val2State === child.props.value;
|
|
53
|
-
}
|
|
54
|
-
function validateChecked(value2) {
|
|
55
|
-
if (val2State === null)
|
|
56
|
-
return false;
|
|
57
|
-
return val2State === value2;
|
|
58
|
-
}
|
|
59
|
-
function cloneChildren() {
|
|
60
|
-
return React__default.Children.map(children, function(child, index) {
|
|
61
|
-
var childChecked = validateChildChecked(child);
|
|
62
|
-
if (child.type.displayName !== "NutRadio") {
|
|
63
|
-
return React__default.cloneElement(child);
|
|
64
|
-
}
|
|
65
|
-
return React__default.cloneElement(child, {
|
|
66
|
-
textPosition,
|
|
67
|
-
checked: childChecked
|
|
68
|
-
// onChange: handleChildChange,
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
}
|
|
42
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, className = _defaultProps$props.className, value = _defaultProps$props.value, defaultValue = _defaultProps$props.defaultValue, onChange2 = _defaultProps$props.onChange, labelPosition = _defaultProps$props.labelPosition, direction = _defaultProps$props.direction, options = _defaultProps$props.options, disabled = _defaultProps$props.disabled, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
43
|
+
var _usePropsValue = usePropsValue({
|
|
44
|
+
defaultValue: props.defaultValue,
|
|
45
|
+
value: props.value,
|
|
46
|
+
finalValue: "",
|
|
47
|
+
onChange: onChange2
|
|
48
|
+
}), _usePropsValue2 = _slicedToArray(_usePropsValue, 2), val2State = _usePropsValue2[0], setVal2State = _usePropsValue2[1];
|
|
72
49
|
var renderOptionsChildren = useCallback(function() {
|
|
73
50
|
return options === null || options === void 0 ? void 0 : options.map(function(_ref) {
|
|
74
|
-
var label = _ref.label, value2 = _ref.value,
|
|
75
|
-
|
|
76
|
-
return React__default.createElement(Radio, _objectSpread(_objectSpread({
|
|
51
|
+
var label = _ref.label, value2 = _ref.value, disabled2 = _ref.disabled, onChange22 = _ref.onChange, rest2 = _objectWithoutProperties(_ref, _excluded2);
|
|
52
|
+
return React__default.createElement(Radio, _objectSpread(_objectSpread({}, rest2), {}, {
|
|
77
53
|
key: value2 === null || value2 === void 0 ? void 0 : value2.toString(),
|
|
78
54
|
children: label,
|
|
79
55
|
value: value2,
|
|
80
|
-
disabled,
|
|
81
|
-
onChange:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
checked: childChecked
|
|
56
|
+
disabled: disabled2,
|
|
57
|
+
onChange: onChange22,
|
|
58
|
+
labelPosition,
|
|
59
|
+
checked: value2 === val2State
|
|
85
60
|
}));
|
|
86
61
|
});
|
|
87
|
-
}, [
|
|
62
|
+
}, [options]);
|
|
88
63
|
return React__default.createElement(RadioContext.Provider, {
|
|
89
64
|
value: {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
65
|
+
labelPosition: labelPosition || "right",
|
|
66
|
+
disabled,
|
|
67
|
+
value: val2State,
|
|
68
|
+
check: function check(value2) {
|
|
69
|
+
setVal2State(value2);
|
|
70
|
+
},
|
|
71
|
+
uncheck: function uncheck() {
|
|
72
|
+
setVal2State("");
|
|
93
73
|
}
|
|
94
74
|
}
|
|
95
75
|
}, React__default.createElement("div", _objectSpread({
|
|
96
|
-
className:
|
|
97
|
-
}, rest), options !== null && options !== void 0 && options.length ? renderOptionsChildren() :
|
|
76
|
+
className: classNames(classPrefix, className, _defineProperty({}, "".concat(classPrefix, "--").concat(props.direction), props.direction))
|
|
77
|
+
}, rest), options !== null && options !== void 0 && options.length ? renderOptionsChildren() : children));
|
|
98
78
|
});
|
|
99
79
|
RadioGroup.defaultProps = defaultProps;
|
|
100
80
|
RadioGroup.displayName = "NutRadioGroup";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import '../../../packages/range/range.scss'
|