@nutui/nutui-react 2.0.0-alpha.3 → 2.0.0-alpha.5
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 +24 -0
- package/dist/esm/Avatar.js +30 -25
- package/dist/esm/AvatarGroup.js +10 -15
- package/dist/esm/Badge.js +4 -66
- package/dist/esm/Checkbox.js +1 -2
- package/dist/esm/CheckboxGroup.js +18 -20
- package/dist/esm/CircleProgress.js +20 -25
- package/dist/esm/Ellipsis.js +13 -12
- package/dist/esm/Empty.js +18 -26
- package/dist/esm/Input.js +87 -193
- package/dist/esm/Skeleton.js +1 -1
- package/dist/esm/Swipe.js +4 -10
- package/dist/esm/Tabbar/style/index.js +1 -1
- package/dist/esm/Tabbar.js +29 -33
- package/dist/esm/TabbarItem.js +5 -75
- package/dist/esm/badge2.js +69 -0
- package/dist/esm/cellgroup2.js +5 -4
- package/dist/esm/checkbox2.js +34 -47
- package/dist/esm/tabbaritem2.js +61 -0
- 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 +846 -997
- package/dist/nutui.react.umd.js +846 -997
- package/dist/packages/badge/badge.scss +0 -1
- package/dist/packages/cellgroup/cellgroup.scss +20 -16
- package/dist/packages/checkbox/checkbox.scss +8 -11
- package/dist/packages/circleprogress/circleprogress.scss +0 -9
- package/dist/packages/empty/empty.scss +0 -9
- package/dist/packages/input/input.scss +13 -180
- package/dist/packages/tabbar/tabbar.scss +16 -22
- package/dist/packages/tabbaritem/tabbaritem.scss +9 -70
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/themes/default.scss +0 -1
- package/dist/styles/variables-jmapp.scss +12 -16
- package/dist/styles/variables.scss +12 -16
- package/dist/types/index.d.ts +80 -126
- package/package.json +1 -1
- package/dist/esm/Icon.js +0 -83
- package/dist/packages/icon/icon.scss +0 -0
- /package/dist/esm/{AvatarContext.js → context.js} +0 -0
package/dist/esm/Empty.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _excluded = ["image", "imageSize", "description", "children", "className", "status"];
|
|
5
5
|
function ownKeys(object, enumerableOnly) {
|
|
6
6
|
var keys = Object.keys(object);
|
|
7
7
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -24,35 +24,29 @@ function _objectSpread(target) {
|
|
|
24
24
|
return target;
|
|
25
25
|
}
|
|
26
26
|
import React__default, { useState, useEffect } from "react";
|
|
27
|
-
import { c as cn } from "./bem.js";
|
|
28
27
|
import { useConfig } from "./ConfigProvider.js";
|
|
29
|
-
import "
|
|
28
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
30
29
|
var defaultStatus = {
|
|
31
30
|
empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png",
|
|
32
31
|
error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png",
|
|
33
32
|
network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png"
|
|
34
33
|
};
|
|
35
|
-
var defaultProps = {
|
|
34
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
36
35
|
description: "",
|
|
37
|
-
image: "empty",
|
|
38
36
|
imageSize: "",
|
|
39
|
-
|
|
40
|
-
};
|
|
37
|
+
status: "empty"
|
|
38
|
+
});
|
|
39
|
+
var classPrefix = "nut-empty";
|
|
41
40
|
var Empty = function Empty2(props) {
|
|
42
41
|
var _useConfig = useConfig(), locale = _useConfig.locale;
|
|
43
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), image = _defaultProps$props.image, imageSize = _defaultProps$props.imageSize, description = _defaultProps$props.description, children = _defaultProps$props.children, className = _defaultProps$props.className, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
42
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), image = _defaultProps$props.image, imageSize = _defaultProps$props.imageSize, description = _defaultProps$props.description, children = _defaultProps$props.children, className = _defaultProps$props.className, status = _defaultProps$props.status, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
44
43
|
var _useState = useState({}), _useState2 = _slicedToArray(_useState, 2), imgStyle = _useState2[0], setImgStyle = _useState2[1];
|
|
45
|
-
var
|
|
46
|
-
var imageNode =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
className: "img",
|
|
52
|
-
src: imageUrl,
|
|
53
|
-
alt: "empty"
|
|
54
|
-
});
|
|
55
|
-
}
|
|
44
|
+
var imageUrl = image || defaultStatus[status];
|
|
45
|
+
var imageNode = typeof imageUrl === "string" ? React__default.createElement("img", {
|
|
46
|
+
className: "img",
|
|
47
|
+
src: imageUrl,
|
|
48
|
+
alt: "empty"
|
|
49
|
+
}) : imageUrl;
|
|
56
50
|
useEffect(function() {
|
|
57
51
|
setImgStyle(function() {
|
|
58
52
|
if (!imageSize) {
|
|
@@ -71,15 +65,13 @@ var Empty = function Empty2(props) {
|
|
|
71
65
|
});
|
|
72
66
|
}, [imageSize]);
|
|
73
67
|
return React__default.createElement("div", _objectSpread({
|
|
74
|
-
className: "".concat(
|
|
68
|
+
className: "".concat(classPrefix, " ").concat(className)
|
|
75
69
|
}, rest), React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
76
|
-
className:
|
|
70
|
+
className: "".concat(classPrefix, "__image"),
|
|
77
71
|
style: imgStyle
|
|
78
72
|
}, imageNode), typeof description === "string" ? React__default.createElement("div", {
|
|
79
|
-
className:
|
|
80
|
-
}, description || locale.noData) :
|
|
81
|
-
description
|
|
82
|
-
}, children));
|
|
73
|
+
className: "".concat(classPrefix, "__description")
|
|
74
|
+
}, description || locale.noData) : description, children));
|
|
83
75
|
};
|
|
84
76
|
Empty.defaultProps = defaultProps;
|
|
85
77
|
Empty.displayName = "NutEmpty";
|
package/dist/esm/Input.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _excluded = ["
|
|
4
|
+
var _excluded = ["type", "name", "placeholder", "align", "disabled", "readOnly", "maxLength", "clearable", "clearIcon", "formatTrigger", "autoFocus", "style", "className", "onChange", "onFocus", "onClear", "formatter", "onClick", "confirmType", "defaultValue", "value"];
|
|
5
5
|
function ownKeys(object, enumerableOnly) {
|
|
6
6
|
var keys = Object.keys(object);
|
|
7
7
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -23,10 +23,11 @@ function _objectSpread(target) {
|
|
|
23
23
|
}
|
|
24
24
|
return target;
|
|
25
25
|
}
|
|
26
|
-
import React__default, { forwardRef,
|
|
26
|
+
import React__default, { forwardRef, useRef, useState, useImperativeHandle, useCallback } from "react";
|
|
27
27
|
import { MaskClose } from "@nutui/icons-react";
|
|
28
28
|
import { useConfig } from "./ConfigProvider.js";
|
|
29
29
|
import { C as ComponentDefaults } from "./typings.js";
|
|
30
|
+
import { u as usePropsValue } from "./use-props-value.js";
|
|
30
31
|
function trimExtraChar(value, _char, regExp) {
|
|
31
32
|
var index = value.indexOf(_char);
|
|
32
33
|
if (index === -1) {
|
|
@@ -56,253 +57,146 @@ function formatNumber(value) {
|
|
|
56
57
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
57
58
|
type: "text",
|
|
58
59
|
name: "",
|
|
59
|
-
defaultValue: "",
|
|
60
60
|
placeholder: "",
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
labelWidth: "80",
|
|
64
|
-
labelAlign: "left",
|
|
65
|
-
colon: false,
|
|
66
|
-
inputAlign: "left",
|
|
67
|
-
center: false,
|
|
61
|
+
confirmType: "done",
|
|
62
|
+
align: "left",
|
|
68
63
|
required: false,
|
|
69
64
|
disabled: false,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
maxlength: "9999",
|
|
73
|
-
leftIcon: null,
|
|
74
|
-
rightIcon: null,
|
|
65
|
+
readOnly: false,
|
|
66
|
+
maxLength: 9999,
|
|
75
67
|
clearable: false,
|
|
76
68
|
clearIcon: null,
|
|
77
|
-
clearSize: "14",
|
|
78
|
-
border: true,
|
|
79
69
|
formatTrigger: "onChange",
|
|
80
|
-
|
|
81
|
-
rows: null,
|
|
82
|
-
errorMessage: "",
|
|
83
|
-
errorMessageAlign: "",
|
|
84
|
-
showWordLimit: false,
|
|
85
|
-
autofocus: false,
|
|
86
|
-
slotButton: null,
|
|
87
|
-
slotInput: null
|
|
70
|
+
autoFocus: false
|
|
88
71
|
});
|
|
89
72
|
var Input = forwardRef(function(props, ref) {
|
|
90
73
|
var _useConfig = useConfig(), locale = _useConfig.locale;
|
|
91
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
};
|
|
74
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), type = _defaultProps$props.type, name = _defaultProps$props.name, placeholder = _defaultProps$props.placeholder, align = _defaultProps$props.align, disabled = _defaultProps$props.disabled, readOnly = _defaultProps$props.readOnly, maxLength = _defaultProps$props.maxLength, clearable = _defaultProps$props.clearable, clearIcon = _defaultProps$props.clearIcon, formatTrigger = _defaultProps$props.formatTrigger, autoFocus = _defaultProps$props.autoFocus, style = _defaultProps$props.style, className = _defaultProps$props.className, onChange = _defaultProps$props.onChange, onFocus = _defaultProps$props.onFocus, onClear = _defaultProps$props.onClear, formatter = _defaultProps$props.formatter, _onClick = _defaultProps$props.onClick, confirmType = _defaultProps$props.confirmType, defaultValue = _defaultProps$props.defaultValue, _value = _defaultProps$props.value, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
75
|
+
var _usePropsValue = usePropsValue({
|
|
76
|
+
value: props.value,
|
|
77
|
+
defaultValue: props.defaultValue,
|
|
78
|
+
finalValue: "",
|
|
79
|
+
onChange
|
|
80
|
+
}), _usePropsValue2 = _slicedToArray(_usePropsValue, 2), value = _usePropsValue2[0], setValue = _usePropsValue2[1];
|
|
99
81
|
var inputRef = useRef(null);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
SetInputValue(defaultValue);
|
|
103
|
-
}, [defaultValue]);
|
|
104
|
-
useEffect(function() {
|
|
105
|
-
if (inputValue) {
|
|
106
|
-
updateValue(getModelValue());
|
|
107
|
-
resetValidation();
|
|
108
|
-
}
|
|
109
|
-
}, [inputValue]);
|
|
82
|
+
var composingRef = useRef(false);
|
|
83
|
+
var _useState = useState(false), _useState2 = _slicedToArray(_useState, 2), active = _useState2[0], setActive = _useState2[1];
|
|
110
84
|
useImperativeHandle(ref, function() {
|
|
111
|
-
return
|
|
85
|
+
return {
|
|
86
|
+
clear: function clear() {
|
|
87
|
+
setValue("");
|
|
88
|
+
},
|
|
89
|
+
focus: function focus() {
|
|
90
|
+
var _inputRef$current;
|
|
91
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
92
|
+
},
|
|
93
|
+
blur: function blur() {
|
|
94
|
+
var _inputRef$current2;
|
|
95
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.blur();
|
|
96
|
+
},
|
|
97
|
+
get nativeElement() {
|
|
98
|
+
return inputRef.current;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
112
101
|
});
|
|
113
102
|
var inputClass = useCallback(function() {
|
|
114
|
-
var
|
|
115
|
-
return [
|
|
116
|
-
}, [disabled
|
|
117
|
-
|
|
118
|
-
setClasses(inputClass);
|
|
119
|
-
}, [disabled, required, error, border, slotButton, rightIcon, center]);
|
|
120
|
-
var updateValue = function updateValue2(value) {
|
|
121
|
-
var _inputRef$current;
|
|
103
|
+
var classPrefix = "nut-input";
|
|
104
|
+
return [classPrefix, "".concat(disabled ? "".concat(classPrefix, "-disabled") : "")].filter(Boolean).join(" ");
|
|
105
|
+
}, [disabled]);
|
|
106
|
+
var updateValue = function updateValue2(value2) {
|
|
122
107
|
var trigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "onChange";
|
|
123
|
-
var
|
|
124
|
-
var val = value;
|
|
125
|
-
if (type === "digit" || type === "tel") {
|
|
126
|
-
val = formatNumber(val, false, false);
|
|
127
|
-
}
|
|
108
|
+
var val = value2;
|
|
128
109
|
if (type === "number") {
|
|
129
|
-
val = formatNumber(val,
|
|
110
|
+
val = formatNumber(val, false, true);
|
|
130
111
|
}
|
|
131
|
-
if (type === "
|
|
132
|
-
|
|
133
|
-
var regNumber = /[^-0-9]/g;
|
|
134
|
-
val = !regTel.test(val) && val.length > 11 ? val.substring(0, 11) : val.replace(regNumber, "");
|
|
112
|
+
if (type === "digit") {
|
|
113
|
+
val = formatNumber(val, true, true);
|
|
135
114
|
}
|
|
136
115
|
if (formatter && trigger === formatTrigger) {
|
|
137
116
|
val = formatter(val);
|
|
138
117
|
}
|
|
139
|
-
|
|
140
|
-
|
|
118
|
+
setValue(val);
|
|
119
|
+
var eventHandler = props[trigger];
|
|
120
|
+
if (eventHandler && typeof eventHandler === "function") {
|
|
121
|
+
eventHandler(val);
|
|
141
122
|
}
|
|
142
|
-
SetInputValue(val);
|
|
143
123
|
};
|
|
144
124
|
var handleFocus = function handleFocus2(event) {
|
|
145
125
|
var val = event.target.value;
|
|
146
|
-
|
|
147
|
-
|
|
126
|
+
onFocus && onFocus(val);
|
|
127
|
+
setActive(true);
|
|
148
128
|
};
|
|
149
|
-
var handleInput = function handleInput2(
|
|
150
|
-
|
|
151
|
-
if (maxlength && val.length > Number(maxlength)) {
|
|
152
|
-
val = val.slice(0, Number(maxlength));
|
|
153
|
-
}
|
|
154
|
-
updateValue(val, "onChange");
|
|
155
|
-
onChange && onChange(val, event);
|
|
129
|
+
var handleInput = function handleInput2(value2) {
|
|
130
|
+
updateValue(value2, "onChange");
|
|
156
131
|
};
|
|
157
132
|
var handleBlur = function handleBlur2(event) {
|
|
158
|
-
setTimeout(function() {
|
|
159
|
-
SetActive(false);
|
|
160
|
-
}, 200);
|
|
161
133
|
var val = event.target.value;
|
|
162
|
-
if (maxlength && val.length > Number(maxlength)) {
|
|
163
|
-
val = val.slice(0, Number(maxlength));
|
|
164
|
-
}
|
|
165
134
|
updateValue(val, "onBlur");
|
|
166
|
-
|
|
167
|
-
};
|
|
168
|
-
var handleClickInput = function handleClickInput2(event) {
|
|
169
|
-
onClickInput && onClickInput(event);
|
|
170
|
-
};
|
|
171
|
-
var handleClickLeftIcon = function handleClickLeftIcon2(event) {
|
|
172
|
-
onClickLeftIcon && onClickLeftIcon(event);
|
|
173
|
-
};
|
|
174
|
-
var handleClickRightIcon = function handleClickRightIcon2(event) {
|
|
175
|
-
onClickRightIcon && onClickRightIcon(event);
|
|
176
|
-
};
|
|
177
|
-
var resetValidation = function resetValidation2() {
|
|
135
|
+
setActive(false);
|
|
178
136
|
};
|
|
179
137
|
var inputType = function inputType2(type2) {
|
|
180
|
-
if (type2 === "
|
|
138
|
+
if (type2 === "digit") {
|
|
181
139
|
return "text";
|
|
182
140
|
}
|
|
183
|
-
if (type2 === "
|
|
141
|
+
if (type2 === "number") {
|
|
184
142
|
return "tel";
|
|
185
143
|
}
|
|
186
144
|
return type2;
|
|
187
145
|
};
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
};
|
|
192
|
-
return React__default.createElement("div", _objectSpread(_objectSpread({
|
|
193
|
-
className: "".concat(classes, " ").concat(className || ""),
|
|
194
|
-
style
|
|
195
|
-
}, rest), {}, {
|
|
146
|
+
return React__default.createElement("div", {
|
|
147
|
+
className: "".concat(inputClass(), " ").concat(className || ""),
|
|
148
|
+
style,
|
|
196
149
|
onClick: function onClick(e) {
|
|
197
150
|
_onClick && _onClick(e);
|
|
198
151
|
}
|
|
199
|
-
}
|
|
200
|
-
className: "nut-input-label ".concat(labelClass),
|
|
201
|
-
style: {
|
|
202
|
-
width: "".concat(labelWidth, "px"),
|
|
203
|
-
textAlign: labelAlign
|
|
204
|
-
}
|
|
205
|
-
}, React__default.createElement("div", {
|
|
206
|
-
className: "label-string"
|
|
207
|
-
}, label, colon ? ":" : "")) : null, React__default.createElement("div", {
|
|
208
|
-
className: "nut-input-value"
|
|
209
|
-
}, React__default.createElement("div", {
|
|
210
|
-
className: "nut-input-inner",
|
|
211
|
-
onClick: function onClick(e) {
|
|
212
|
-
handleClickInput(e);
|
|
213
|
-
}
|
|
214
|
-
}, slotInput))) : React__default.createElement(React__default.Fragment, null, React__default.isValidElement(leftIcon) ? React__default.createElement("div", {
|
|
215
|
-
className: "nut-input-left-icon",
|
|
216
|
-
onClick: function onClick(e) {
|
|
217
|
-
handleClickLeftIcon(e);
|
|
218
|
-
}
|
|
219
|
-
}, leftIcon) : null, label ? React__default.createElement("div", {
|
|
220
|
-
className: "nut-input-label ".concat(labelClass),
|
|
221
|
-
style: {
|
|
222
|
-
width: "".concat(labelWidth, "px"),
|
|
223
|
-
textAlign: labelAlign
|
|
224
|
-
}
|
|
225
|
-
}, React__default.createElement("div", {
|
|
226
|
-
className: "label-string"
|
|
227
|
-
}, label, colon ? ":" : "")) : null, React__default.createElement("div", {
|
|
228
|
-
className: "nut-input-value"
|
|
229
|
-
}, React__default.createElement("div", {
|
|
230
|
-
className: "nut-input-main-con"
|
|
231
|
-
}, React__default.createElement("div", {
|
|
232
|
-
className: "nut-input-inner",
|
|
233
|
-
onClick: function onClick(e) {
|
|
234
|
-
handleClickInput(e);
|
|
235
|
-
}
|
|
236
|
-
}, type === "textarea" ? React__default.createElement("textarea", {
|
|
152
|
+
}, React__default.createElement("input", _objectSpread(_objectSpread({}, rest), {}, {
|
|
237
153
|
name,
|
|
238
|
-
className: "input-
|
|
154
|
+
className: "nut-input-native",
|
|
239
155
|
ref: inputRef,
|
|
240
156
|
style: {
|
|
241
|
-
textAlign:
|
|
242
|
-
height: "".concat(Number(rows) * 24, "px")
|
|
157
|
+
textAlign: align
|
|
243
158
|
},
|
|
244
|
-
|
|
245
|
-
|
|
159
|
+
type: inputType(type),
|
|
160
|
+
maxLength,
|
|
161
|
+
placeholder: placeholder || locale.placeholder,
|
|
246
162
|
disabled,
|
|
247
|
-
readOnly
|
|
248
|
-
value
|
|
249
|
-
autoFocus
|
|
250
|
-
|
|
163
|
+
readOnly,
|
|
164
|
+
value,
|
|
165
|
+
autoFocus,
|
|
166
|
+
enterKeyHint: confirmType,
|
|
167
|
+
onBlur: function onBlur(e) {
|
|
251
168
|
handleBlur(e);
|
|
252
169
|
},
|
|
253
170
|
onFocus: function onFocus2(e) {
|
|
254
171
|
handleFocus(e);
|
|
255
172
|
},
|
|
256
|
-
|
|
257
|
-
handleInput(e);
|
|
258
|
-
}
|
|
259
|
-
}) : React__default.createElement("input", {
|
|
260
|
-
name,
|
|
261
|
-
className: "input-text",
|
|
262
|
-
ref: inputRef,
|
|
263
|
-
style: {
|
|
264
|
-
textAlign: inputAlign
|
|
265
|
-
},
|
|
266
|
-
type: inputType(type),
|
|
267
|
-
maxLength: maxlength,
|
|
268
|
-
placeholder: inputPlaceholder,
|
|
269
|
-
disabled,
|
|
270
|
-
readOnly: readonly,
|
|
271
|
-
value: inputValue,
|
|
272
|
-
autoFocus: autofocus,
|
|
273
|
-
onBlur: function onBlur2(e) {
|
|
274
|
-
handleBlur(e);
|
|
173
|
+
onChange: function onChange2(e) {
|
|
174
|
+
handleInput(e.currentTarget.value);
|
|
275
175
|
},
|
|
276
|
-
|
|
277
|
-
|
|
176
|
+
onCompositionStart: function onCompositionStart(e) {
|
|
177
|
+
var _props$onCompositionS;
|
|
178
|
+
composingRef.current = true;
|
|
179
|
+
(_props$onCompositionS = props.onCompositionStart) === null || _props$onCompositionS === void 0 ? void 0 : _props$onCompositionS.call(props, e);
|
|
278
180
|
},
|
|
279
|
-
|
|
280
|
-
|
|
181
|
+
onCompositionEnd: function onCompositionEnd(e) {
|
|
182
|
+
var _props$onCompositionE;
|
|
183
|
+
composingRef.current = false;
|
|
184
|
+
(_props$onCompositionE = props.onCompositionEnd) === null || _props$onCompositionE === void 0 ? void 0 : _props$onCompositionE.call(props, e);
|
|
281
185
|
}
|
|
282
|
-
}), clearable && !
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
186
|
+
})), clearable && !readOnly && active && value.length > 0 ? React__default.createElement("span", {
|
|
187
|
+
style: {
|
|
188
|
+
display: "flex",
|
|
189
|
+
alignItems: "center"
|
|
190
|
+
},
|
|
191
|
+
onClick: function onClick() {
|
|
192
|
+
if (!disabled) {
|
|
193
|
+
setValue("");
|
|
194
|
+
onClear && onClear("");
|
|
195
|
+
}
|
|
286
196
|
}
|
|
287
197
|
}, clearIcon || React__default.createElement(MaskClose, {
|
|
288
198
|
className: "nut-input-clear"
|
|
289
|
-
})) : null)
|
|
290
|
-
className: "nut-input-right-icon",
|
|
291
|
-
onClick: function onClick(e) {
|
|
292
|
-
handleClickRightIcon(e);
|
|
293
|
-
}
|
|
294
|
-
}, rightIcon) : null, slotButton ? React__default.createElement("div", {
|
|
295
|
-
className: "nut-input-button"
|
|
296
|
-
}, slotButton) : null, showWordLimit && maxlength ? React__default.createElement("div", {
|
|
297
|
-
className: "nut-input-word-limit"
|
|
298
|
-
}, React__default.createElement("span", {
|
|
299
|
-
className: "nut-input-word-num"
|
|
300
|
-
}, inputValue ? inputValue.length : 0), "/", maxlength) : null), errorMessage ? React__default.createElement("div", {
|
|
301
|
-
className: "nut-input-error-message",
|
|
302
|
-
style: {
|
|
303
|
-
textAlign: errorMessageAlign
|
|
304
|
-
}
|
|
305
|
-
}, errorMessage) : React__default.createElement("div", null))));
|
|
199
|
+
})) : null);
|
|
306
200
|
});
|
|
307
201
|
Input.defaultProps = defaultProps;
|
|
308
202
|
Input.displayName = "NutInput";
|
package/dist/esm/Skeleton.js
CHANGED
|
@@ -77,7 +77,7 @@ var Skeleton = function Skeleton2(props) {
|
|
|
77
77
|
className: "nut-skeleton-content"
|
|
78
78
|
}, avatar && React__default.createElement(Avatar, {
|
|
79
79
|
className: avatarClass,
|
|
80
|
-
|
|
80
|
+
background: "rgb(239, 239, 239)",
|
|
81
81
|
shape: avatarShape,
|
|
82
82
|
style: getStyle()
|
|
83
83
|
}), row === 1 && React__default.createElement("div", {
|
package/dist/esm/Swipe.js
CHANGED
|
@@ -21,7 +21,7 @@ function _objectSpread(target) {
|
|
|
21
21
|
}
|
|
22
22
|
return target;
|
|
23
23
|
}
|
|
24
|
-
import React__default, { forwardRef, useRef, useState,
|
|
24
|
+
import React__default, { forwardRef, useRef, useState, useCallback, useImperativeHandle, useEffect } from "react";
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import { c as cn } from "./bem.js";
|
|
27
27
|
import { u as useTouch } from "./use-touch.js";
|
|
@@ -36,9 +36,7 @@ function preventDefault(event, isStopPropagation) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
var defaultProps = {
|
|
39
|
-
name: ""
|
|
40
|
-
leftWidth: 0,
|
|
41
|
-
rightWidth: 0
|
|
39
|
+
name: ""
|
|
42
40
|
};
|
|
43
41
|
var Swipe = forwardRef(function(props, instanceRef) {
|
|
44
42
|
var swipeBem = cn("swipe");
|
|
@@ -60,12 +58,8 @@ var Swipe = forwardRef(function(props, instanceRef) {
|
|
|
60
58
|
transform: "translate3d(".concat(state.offset, "px, 0, 0)"),
|
|
61
59
|
transitionDuration: state.dragging ? "0s" : ".6s"
|
|
62
60
|
};
|
|
63
|
-
var leftWidth =
|
|
64
|
-
|
|
65
|
-
}, [props.leftWidth, actionWidth.left]);
|
|
66
|
-
var rightWidth = useMemo(function() {
|
|
67
|
-
return props.rightWidth ? props.rightWidth : actionWidth.right;
|
|
68
|
-
}, [props.rightWidth, actionWidth.right]);
|
|
61
|
+
var leftWidth = actionWidth.left;
|
|
62
|
+
var rightWidth = actionWidth.right;
|
|
69
63
|
var _onTouchStart = function onTouchStart(event) {
|
|
70
64
|
if (!props.disabled) {
|
|
71
65
|
startOffset.current = state.offset;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import '../../TabbarItem/style'
|
|
2
2
|
import '../../../packages/tabbar/tabbar.scss'
|
package/dist/esm/Tabbar.js
CHANGED
|
@@ -21,38 +21,35 @@ function _objectSpread(target) {
|
|
|
21
21
|
}
|
|
22
22
|
return target;
|
|
23
23
|
}
|
|
24
|
-
import React__default
|
|
25
|
-
import
|
|
26
|
-
import "
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
import React__default from "react";
|
|
25
|
+
import classNames from "classnames";
|
|
26
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
27
|
+
import { u as usePropsValue } from "./use-props-value.js";
|
|
28
|
+
import { T as TabbarItem } from "./tabbaritem2.js";
|
|
29
|
+
import "./badge2.js";
|
|
30
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
31
|
+
defaultValue: 0,
|
|
32
|
+
fixed: false,
|
|
33
|
+
inactiveColor: "",
|
|
32
34
|
activeColor: "",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
style: {},
|
|
36
|
-
onSwitch: function onSwitch(child, activeVisible) {
|
|
35
|
+
safeArea: false,
|
|
36
|
+
onSwitch: function onSwitch(value) {
|
|
37
37
|
}
|
|
38
|
-
};
|
|
38
|
+
});
|
|
39
39
|
var Tabbar = function Tabbar2(props) {
|
|
40
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children,
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
useEffect(function() {
|
|
49
|
-
if (activeVisible !== void 0) {
|
|
50
|
-
setSelectIndex(activeVisible);
|
|
51
|
-
}
|
|
52
|
-
}, [activeVisible]);
|
|
40
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, defaultValue = _defaultProps$props.defaultValue, value = _defaultProps$props.value, fixed = _defaultProps$props.fixed, activeColor = _defaultProps$props.activeColor, inactiveColor = _defaultProps$props.inactiveColor, safeArea = _defaultProps$props.safeArea, className = _defaultProps$props.className, style = _defaultProps$props.style, onSwitch2 = _defaultProps$props.onSwitch;
|
|
41
|
+
var classPrefix = "nut-tabbar";
|
|
42
|
+
var _usePropsValue = usePropsValue({
|
|
43
|
+
value,
|
|
44
|
+
defaultValue,
|
|
45
|
+
finalValue: 0,
|
|
46
|
+
onChange: onSwitch2
|
|
47
|
+
}), _usePropsValue2 = _slicedToArray(_usePropsValue, 2), selectIndex = _usePropsValue2[0], setSelectIndex = _usePropsValue2[1];
|
|
53
48
|
return React__default.createElement("div", {
|
|
54
|
-
className:
|
|
49
|
+
className: classNames(classPrefix, className, _defineProperty({}, "".concat(classPrefix, "__fixed"), fixed)),
|
|
55
50
|
style
|
|
51
|
+
}, React__default.createElement("div", {
|
|
52
|
+
className: "".concat(classPrefix, "__wrap")
|
|
56
53
|
}, React__default.Children.map(children, function(child, idx) {
|
|
57
54
|
if (!React__default.isValidElement(child)) {
|
|
58
55
|
return null;
|
|
@@ -60,19 +57,18 @@ var Tabbar = function Tabbar2(props) {
|
|
|
60
57
|
var childProps = _objectSpread(_objectSpread({}, child.props), {}, {
|
|
61
58
|
active: idx === selectIndex,
|
|
62
59
|
index: idx,
|
|
63
|
-
|
|
60
|
+
inactiveColor,
|
|
64
61
|
activeColor,
|
|
65
|
-
|
|
66
|
-
handleClick: function handleClick() {
|
|
67
|
-
_handleClick(idx);
|
|
68
|
-
onSwitch2(child, idx);
|
|
69
|
-
}
|
|
62
|
+
handleClick: setSelectIndex
|
|
70
63
|
});
|
|
71
64
|
return React__default.cloneElement(child, childProps);
|
|
65
|
+
})), (fixed || safeArea) && React__default.createElement("div", {
|
|
66
|
+
className: "".concat(classPrefix, "__safe-area")
|
|
72
67
|
}));
|
|
73
68
|
};
|
|
74
69
|
Tabbar.defaultProps = defaultProps;
|
|
75
70
|
Tabbar.displayName = "NutTabbar";
|
|
71
|
+
Tabbar.Item = TabbarItem;
|
|
76
72
|
export {
|
|
77
73
|
Tabbar as default
|
|
78
74
|
};
|