@nutui/nutui-react 1.3.5 → 1.3.7
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 +14 -0
- package/dist/esm/ActionSheet.js +15 -25
- package/dist/esm/Address.js +151 -221
- package/dist/esm/AnimatingNumbers.js +7 -31
- package/dist/esm/Audio.js +31 -66
- package/dist/esm/Avatar.js +25 -51
- package/dist/esm/AvatarGroup.js +2 -9
- package/dist/esm/BackTop.js +29 -55
- package/dist/esm/Badge.js +9 -20
- package/dist/esm/Barrage.js +8 -20
- package/dist/esm/Button.js +22 -37
- package/dist/esm/Calendar.js +23 -37
- package/dist/esm/CalendarItem.js +86 -186
- package/dist/esm/Card.js +14 -20
- package/dist/esm/Cascader.js +77 -197
- package/dist/esm/Cell.js +20 -30
- package/dist/esm/CellGroup.js +6 -12
- package/dist/esm/Checkbox.js +27 -48
- package/dist/esm/CheckboxGroup.js +12 -30
- package/dist/esm/CircleProgress.js +11 -28
- package/dist/esm/Col.js +11 -22
- package/dist/esm/Collapse.js +11 -27
- package/dist/esm/CollapseItem.js +33 -47
- package/dist/esm/ConfigProvider.js +4 -15
- package/dist/esm/CountDown.js +37 -74
- package/dist/esm/DatePicker.js +44 -106
- package/dist/esm/Dialog.js +31 -89
- package/dist/esm/Divider.js +8 -15
- package/dist/esm/Drag.js +30 -45
- package/dist/esm/Elevator.js +37 -74
- package/dist/esm/Empty.js +11 -24
- package/dist/esm/FixedNav.js +18 -29
- package/dist/esm/Grid.js +13 -28
- package/dist/esm/GridItem.js +18 -34
- package/dist/esm/ImagePreview.js +36 -71
- package/dist/esm/Indicator.js +9 -20
- package/dist/esm/Infiniteloading.js +26 -55
- package/dist/esm/Input.js +62 -106
- package/dist/esm/InputNumber.js +25 -52
- package/dist/esm/Layout.js +0 -6
- package/dist/esm/Menu.js +27 -49
- package/dist/esm/MenuItem.js +32 -56
- package/dist/esm/NavBar.js +18 -34
- package/dist/esm/NoticeBar.js +54 -102
- package/dist/esm/Notify.js +9 -38
- package/dist/esm/NumberKeyboard.js +21 -52
- package/dist/esm/Pagination.js +38 -71
- package/dist/esm/Picker.js +91 -178
- package/dist/esm/Popover.js +32 -72
- package/dist/esm/Popup.js +40 -72
- package/dist/esm/Price.js +7 -24
- package/dist/esm/Progress.js +35 -50
- package/dist/esm/PullToRefresh.js +28 -83
- package/dist/esm/Radio.js +24 -47
- package/dist/esm/RadioGroup.js +14 -24
- package/dist/esm/Range.js +44 -116
- package/dist/esm/Rate.js +21 -39
- package/dist/esm/Row.js +7 -16
- package/dist/esm/SearchBar.js +47 -68
- package/dist/esm/ShortPassword.js +29 -56
- package/dist/esm/SideNavBar.js +9 -16
- package/dist/esm/SideNavBarItem.js +4 -11
- package/dist/esm/Signature.js +13 -43
- package/dist/esm/Skeleton.js +13 -23
- package/dist/esm/Step.js +12 -28
- package/dist/esm/Steps.js +6 -14
- package/dist/esm/Sticky.js +24 -52
- package/dist/esm/SubSideNavBar.js +7 -22
- package/dist/esm/Swipe.js +15 -54
- package/dist/esm/Swiper.js +102 -186
- package/dist/esm/SwiperItem.js +2 -12
- package/dist/esm/Switch.js +13 -27
- package/dist/esm/Tabbar.js +13 -25
- package/dist/esm/TabbarItem.js +15 -23
- package/dist/esm/Table.js +19 -39
- package/dist/esm/Tag.js +19 -36
- package/dist/esm/TextArea.js +19 -43
- package/dist/esm/TimeDetail.js +15 -28
- package/dist/esm/TimePannel.js +5 -12
- package/dist/esm/TimeSelect.js +35 -59
- package/dist/esm/Toast.js +16 -49
- package/dist/esm/Uploader.js +57 -152
- package/dist/esm/Video.js +8 -19
- package/dist/esm/VirtualList.js +84 -118
- package/dist/esm/date-710f8c7c.js +9 -33
- package/dist/esm/get-scroll-parent-3dcd3f53.js +1 -9
- package/dist/esm/icon-8dc4de10.js +11 -21
- package/dist/esm/offsetContext-0e3d04b3.js +0 -3
- package/dist/esm/overlay-ed3eb37d.js +12 -23
- package/dist/esm/render-18227751.js +0 -11
- package/dist/esm/tabpane-c957ab14.js +4 -10
- package/dist/esm/tabs-0896a61b.js +28 -56
- package/dist/esm/types/src/packages/elevator/demo.d.ts +1 -0
- package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +2 -0
- package/dist/esm/useClientRect-839d18c5.js +0 -5
- package/dist/esm/useTouch-a2ea68c6.js +27 -47
- 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/nutui.react.es.js +429 -413
- package/dist/nutui.react.umd.js +421 -405
- package/dist/packages/menu/menu.scss +4 -0
- package/dist/packages/menuitem/menuitem.scss +27 -2
- package/dist/packages/searchbar/searchbar.scss +20 -3
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/esm/SearchBar.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
-
|
|
6
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
-
|
|
8
5
|
import React__default, { useRef, useState, useEffect } from 'react';
|
|
9
6
|
import { c as cn } from './bem-893ad28d.js';
|
|
10
7
|
import { useConfig } from './ConfigProvider.js';
|
|
11
8
|
import Icon from './Icon.js';
|
|
12
9
|
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
13
10
|
import '@bem-react/classname';
|
|
14
|
-
|
|
15
11
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
16
12
|
placeholder: '',
|
|
17
13
|
shape: 'square',
|
|
@@ -27,71 +23,62 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
27
23
|
size: "12"
|
|
28
24
|
})
|
|
29
25
|
});
|
|
30
|
-
|
|
31
26
|
var SearchBar = function SearchBar(props) {
|
|
32
27
|
var searchbarBem = cn('searchbar');
|
|
33
|
-
|
|
34
28
|
var _useConfig = useConfig(),
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
locale = _useConfig.locale;
|
|
37
30
|
var searchRef = useRef(null);
|
|
38
|
-
|
|
39
31
|
var _useState = useState(function () {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
return props.value;
|
|
33
|
+
}),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
value = _useState2[0],
|
|
36
|
+
setValue = _useState2[1];
|
|
46
37
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
38
|
+
placeholder = _defaultProps$props.placeholder,
|
|
39
|
+
shape = _defaultProps$props.shape,
|
|
40
|
+
className = _defaultProps$props.className,
|
|
41
|
+
disabled = _defaultProps$props.disabled,
|
|
42
|
+
maxLength = _defaultProps$props.maxLength,
|
|
43
|
+
clearable = _defaultProps$props.clearable,
|
|
44
|
+
align = _defaultProps$props.align,
|
|
45
|
+
readOnly = _defaultProps$props.readOnly,
|
|
46
|
+
autoFocus = _defaultProps$props.autoFocus,
|
|
47
|
+
label = _defaultProps$props.label,
|
|
48
|
+
actionText = _defaultProps$props.actionText,
|
|
49
|
+
leftinIcon = _defaultProps$props.leftinIcon,
|
|
50
|
+
rightinIcon = _defaultProps$props.rightinIcon,
|
|
51
|
+
leftoutIcon = _defaultProps$props.leftoutIcon,
|
|
52
|
+
rightoutIcon = _defaultProps$props.rightoutIcon,
|
|
53
|
+
onChange = _defaultProps$props.onChange,
|
|
54
|
+
onFocus = _defaultProps$props.onFocus,
|
|
55
|
+
onBlur = _defaultProps$props.onBlur,
|
|
56
|
+
onClear = _defaultProps$props.onClear,
|
|
57
|
+
onCancel = _defaultProps$props.onCancel,
|
|
58
|
+
onSearch = _defaultProps$props.onSearch,
|
|
59
|
+
onClickInput = _defaultProps$props.onClickInput,
|
|
60
|
+
onClickLeftinIcon = _defaultProps$props.onClickLeftinIcon,
|
|
61
|
+
onClickLeftoutIcon = _defaultProps$props.onClickLeftoutIcon,
|
|
62
|
+
onClickRightinIcon = _defaultProps$props.onClickRightinIcon,
|
|
63
|
+
onClickRightoutIcon = _defaultProps$props.onClickRightoutIcon,
|
|
64
|
+
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
65
|
+
iconFontClassName = _defaultProps$props.iconFontClassName;
|
|
75
66
|
var alignClass = "".concat(align);
|
|
76
|
-
|
|
77
67
|
var change = function change(event) {
|
|
78
68
|
var value = event.target.value;
|
|
79
69
|
onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(value, event));
|
|
80
70
|
setValue(value);
|
|
81
71
|
};
|
|
82
|
-
|
|
83
72
|
var focus = function focus(event) {
|
|
84
73
|
var value = event.target.value;
|
|
85
74
|
onFocus && (onFocus === null || onFocus === void 0 ? void 0 : onFocus(value, event));
|
|
86
75
|
};
|
|
87
|
-
|
|
88
76
|
var blur = function blur(event) {
|
|
89
77
|
var searchSelf = searchRef.current;
|
|
90
78
|
searchSelf && searchSelf.blur();
|
|
91
79
|
var value = event.target.value;
|
|
92
80
|
onBlur && (onBlur === null || onBlur === void 0 ? void 0 : onBlur(value, event));
|
|
93
81
|
};
|
|
94
|
-
|
|
95
82
|
useEffect(function () {
|
|
96
83
|
setValue(props.value);
|
|
97
84
|
}, [props.value]);
|
|
@@ -101,7 +88,6 @@ var SearchBar = function SearchBar(props) {
|
|
|
101
88
|
searchSelf && searchSelf.focus();
|
|
102
89
|
}
|
|
103
90
|
}, [autoFocus]);
|
|
104
|
-
|
|
105
91
|
var renderField = function renderField() {
|
|
106
92
|
return React__default.createElement("input", {
|
|
107
93
|
className: "".concat(searchbarBem('input'), " ").concat(searchbarBem(alignClass), " ").concat(shape === 'round' ? searchbarBem('round') : '', " ").concat(clearable ? searchbarBem('input-clear') : ''),
|
|
@@ -114,6 +100,7 @@ var SearchBar = function SearchBar(props) {
|
|
|
114
100
|
disabled: disabled,
|
|
115
101
|
readOnly: readOnly,
|
|
116
102
|
maxLength: maxLength,
|
|
103
|
+
onKeyPress: onKeypress,
|
|
117
104
|
onChange: function onChange(e) {
|
|
118
105
|
return change(e);
|
|
119
106
|
},
|
|
@@ -128,11 +115,9 @@ var SearchBar = function SearchBar(props) {
|
|
|
128
115
|
}
|
|
129
116
|
});
|
|
130
117
|
};
|
|
131
|
-
|
|
132
118
|
var clickInput = function clickInput(e) {
|
|
133
119
|
onClickInput && onClickInput(e);
|
|
134
120
|
};
|
|
135
|
-
|
|
136
121
|
var renderLeftinIcon = function renderLeftinIcon() {
|
|
137
122
|
if (!leftinIcon) return null;
|
|
138
123
|
return React__default.createElement("div", {
|
|
@@ -142,7 +127,6 @@ var SearchBar = function SearchBar(props) {
|
|
|
142
127
|
}
|
|
143
128
|
}, leftinIcon);
|
|
144
129
|
};
|
|
145
|
-
|
|
146
130
|
var renderLeftoutIcon = function renderLeftoutIcon() {
|
|
147
131
|
if (!leftoutIcon) return null;
|
|
148
132
|
return React__default.createElement("div", {
|
|
@@ -152,7 +136,6 @@ var SearchBar = function SearchBar(props) {
|
|
|
152
136
|
}
|
|
153
137
|
}, leftoutIcon);
|
|
154
138
|
};
|
|
155
|
-
|
|
156
139
|
var clickLeftIcon = function clickLeftIcon(flag, event) {
|
|
157
140
|
if (flag === 'in-left') {
|
|
158
141
|
onClickLeftinIcon && onClickLeftinIcon(value, event);
|
|
@@ -160,7 +143,6 @@ var SearchBar = function SearchBar(props) {
|
|
|
160
143
|
onClickLeftoutIcon && onClickLeftoutIcon(value, event);
|
|
161
144
|
}
|
|
162
145
|
};
|
|
163
|
-
|
|
164
146
|
var renderRightinIcon = function renderRightinIcon() {
|
|
165
147
|
if (!rightinIcon) return null;
|
|
166
148
|
return React__default.createElement("div", {
|
|
@@ -170,7 +152,6 @@ var SearchBar = function SearchBar(props) {
|
|
|
170
152
|
}
|
|
171
153
|
}, rightinIcon);
|
|
172
154
|
};
|
|
173
|
-
|
|
174
155
|
var renderRightoutIcon = function renderRightoutIcon() {
|
|
175
156
|
if (!rightoutIcon) return null;
|
|
176
157
|
return React__default.createElement("div", {
|
|
@@ -180,7 +161,6 @@ var SearchBar = function SearchBar(props) {
|
|
|
180
161
|
}
|
|
181
162
|
}, rightoutIcon);
|
|
182
163
|
};
|
|
183
|
-
|
|
184
164
|
var clickRightIcon = function clickRightIcon(flag, event) {
|
|
185
165
|
if (flag === 'in-left') {
|
|
186
166
|
onClickRightinIcon && onClickRightinIcon(value, event);
|
|
@@ -188,7 +168,6 @@ var SearchBar = function SearchBar(props) {
|
|
|
188
168
|
onClickRightoutIcon && onClickRightoutIcon(value, event);
|
|
189
169
|
}
|
|
190
170
|
};
|
|
191
|
-
|
|
192
171
|
var handleClear = function handleClear() {
|
|
193
172
|
return React__default.createElement("div", {
|
|
194
173
|
className: "".concat(searchbarBem('clear'), " ").concat(rightinIcon ? 'pos-right' : ''),
|
|
@@ -203,41 +182,42 @@ var SearchBar = function SearchBar(props) {
|
|
|
203
182
|
color: "#555"
|
|
204
183
|
}));
|
|
205
184
|
};
|
|
206
|
-
|
|
207
185
|
var clearaVal = function clearaVal(event) {
|
|
208
186
|
if (disabled || readOnly) {
|
|
209
187
|
return;
|
|
210
188
|
}
|
|
211
|
-
|
|
212
189
|
setValue('');
|
|
213
190
|
onClear && onClear(event);
|
|
214
191
|
};
|
|
215
|
-
|
|
216
192
|
var renderRightLabel = function renderRightLabel() {
|
|
217
193
|
if (actionText) {
|
|
218
194
|
return React__default.createElement("div", {
|
|
219
195
|
className: searchbarBem('action-text'),
|
|
220
|
-
onClick:
|
|
196
|
+
onClick: cancel
|
|
221
197
|
}, actionText);
|
|
222
198
|
}
|
|
223
|
-
|
|
224
199
|
return null;
|
|
225
200
|
};
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
201
|
+
var onKeypress = function onKeypress(e) {
|
|
202
|
+
if (e.key === 'Enter') {
|
|
203
|
+
var event = e.nativeEvent;
|
|
204
|
+
if (typeof event.cancelable !== 'boolean' || event.cancelable) {
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
}
|
|
207
|
+
onSearch && onSearch(value);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
var cancel = function cancel() {
|
|
211
|
+
onCancel && onCancel();
|
|
229
212
|
};
|
|
230
|
-
|
|
231
213
|
var renderLabel = function renderLabel() {
|
|
232
214
|
if (label) {
|
|
233
215
|
return React__default.createElement("div", {
|
|
234
216
|
className: searchbarBem('label')
|
|
235
217
|
}, label);
|
|
236
218
|
}
|
|
237
|
-
|
|
238
219
|
return null;
|
|
239
220
|
};
|
|
240
|
-
|
|
241
221
|
return React__default.createElement("div", {
|
|
242
222
|
className: "".concat(searchbarBem(), " ").concat(disabled ? searchbarBem('disabled') : '', " ").concat(className || ''),
|
|
243
223
|
style: _objectSpread(_objectSpread({}, props.style), {}, {
|
|
@@ -247,7 +227,6 @@ var SearchBar = function SearchBar(props) {
|
|
|
247
227
|
className: "".concat(searchbarBem('content'))
|
|
248
228
|
}, renderLeftinIcon(), renderField(), renderRightinIcon(), clearable && value && handleClear()), renderRightoutIcon(), renderRightLabel());
|
|
249
229
|
};
|
|
250
|
-
|
|
251
230
|
SearchBar.defaultProps = defaultProps;
|
|
252
231
|
SearchBar.displayName = 'NutSearchBar';
|
|
253
232
|
export { SearchBar as default };
|
|
@@ -3,11 +3,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
var _excluded = ["title", "desc", "tips", "visible", "modelValue", "errorMsg", "noButton", "closeOnClickOverlay", "length", "style", "className", "onChange", "onOk", "onTips", "onCancel", "onClose", "onComplete", "iconClassPrefix", "iconFontClassName"];
|
|
6
|
-
|
|
7
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
-
|
|
9
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
|
|
11
8
|
import React__default, { useRef, useState, useEffect } from 'react';
|
|
12
9
|
import { c as cn } from './bem-893ad28d.js';
|
|
13
10
|
import Popup from './Popup.js';
|
|
@@ -15,7 +12,6 @@ import Icon from './Icon.js';
|
|
|
15
12
|
import { useConfig } from './ConfigProvider.js';
|
|
16
13
|
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
17
14
|
import '@bem-react/classname';
|
|
18
|
-
|
|
19
15
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
20
16
|
title: '',
|
|
21
17
|
desc: '',
|
|
@@ -34,54 +30,46 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
34
30
|
onTips: function onTips() {},
|
|
35
31
|
onComplete: function onComplete(value) {}
|
|
36
32
|
});
|
|
37
|
-
|
|
38
33
|
var ShortPassword = function ShortPassword(props) {
|
|
39
34
|
var _useConfig = useConfig(),
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
locale = _useConfig.locale;
|
|
42
36
|
var title = props.title,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
37
|
+
desc = props.desc,
|
|
38
|
+
tips = props.tips,
|
|
39
|
+
visible = props.visible,
|
|
40
|
+
modelValue = props.modelValue,
|
|
41
|
+
errorMsg = props.errorMsg,
|
|
42
|
+
noButton = props.noButton,
|
|
43
|
+
closeOnClickOverlay = props.closeOnClickOverlay,
|
|
44
|
+
length = props.length,
|
|
45
|
+
style = props.style,
|
|
46
|
+
className = props.className,
|
|
47
|
+
onChange = props.onChange,
|
|
48
|
+
onOk = props.onOk,
|
|
49
|
+
onTips = props.onTips,
|
|
50
|
+
onCancel = props.onCancel,
|
|
51
|
+
onClose = props.onClose,
|
|
52
|
+
onComplete = props.onComplete,
|
|
53
|
+
iconClassPrefix = props.iconClassPrefix,
|
|
54
|
+
iconFontClassName = props.iconFontClassName,
|
|
55
|
+
reset = _objectWithoutProperties(props, _excluded);
|
|
63
56
|
var b = cn('shortpassword');
|
|
64
57
|
var textInput = useRef(null);
|
|
65
|
-
|
|
66
58
|
var range = function range(val) {
|
|
67
59
|
return Math.min(Math.max(4, val), 6);
|
|
68
60
|
};
|
|
69
|
-
|
|
70
61
|
var _useState = useState(visible),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
63
|
+
innerVisible = _useState2[0],
|
|
64
|
+
setInnerVisible = _useState2[1];
|
|
75
65
|
var _useState3 = useState(range(Number(length))),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
67
|
+
comLen = _useState4[0],
|
|
68
|
+
setComLen = _useState4[1];
|
|
80
69
|
var _useState5 = useState(''),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
70
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
71
|
+
inputValue = _useState6[0],
|
|
72
|
+
setInputValue = _useState6[1];
|
|
85
73
|
useEffect(function () {
|
|
86
74
|
setInnerVisible(visible);
|
|
87
75
|
}, [visible]);
|
|
@@ -90,58 +78,44 @@ var ShortPassword = function ShortPassword(props) {
|
|
|
90
78
|
setInputValue(modelValue);
|
|
91
79
|
}
|
|
92
80
|
}, [modelValue]);
|
|
93
|
-
|
|
94
81
|
var changeValue = function changeValue(e) {
|
|
95
82
|
var inputValue = e.target.value;
|
|
96
|
-
|
|
97
83
|
if (String(inputValue).length > comLen) {
|
|
98
84
|
inputValue = inputValue.slice(0, comLen);
|
|
99
85
|
}
|
|
100
|
-
|
|
101
86
|
setInputValue(inputValue);
|
|
102
|
-
|
|
103
87
|
if (String(inputValue).length === comLen) {
|
|
104
88
|
onComplete && onComplete(inputValue);
|
|
105
89
|
}
|
|
106
|
-
|
|
107
90
|
onChange && onChange(inputValue);
|
|
108
91
|
};
|
|
109
|
-
|
|
110
92
|
var systemStyle = function systemStyle() {
|
|
111
93
|
var u = navigator.userAgent;
|
|
112
94
|
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; // g
|
|
113
|
-
|
|
114
95
|
var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
115
|
-
|
|
116
96
|
var style = {};
|
|
117
97
|
console.log(isIOS, isAndroid);
|
|
118
|
-
|
|
119
98
|
if (isIOS) {
|
|
120
99
|
style = {
|
|
121
100
|
paddingRight: '1200px'
|
|
122
101
|
};
|
|
123
102
|
}
|
|
124
|
-
|
|
125
103
|
if (isAndroid) {
|
|
126
104
|
style = {
|
|
127
105
|
opacity: 0,
|
|
128
106
|
zIndex: 10
|
|
129
107
|
};
|
|
130
108
|
}
|
|
131
|
-
|
|
132
109
|
return style;
|
|
133
110
|
};
|
|
134
|
-
|
|
135
111
|
var focus = function focus() {
|
|
136
112
|
if (textInput.current) {
|
|
137
113
|
textInput.current.focus();
|
|
138
114
|
}
|
|
139
115
|
};
|
|
140
|
-
|
|
141
116
|
var sure = function sure() {
|
|
142
117
|
onOk && onOk(inputValue);
|
|
143
118
|
};
|
|
144
|
-
|
|
145
119
|
return React__default.createElement("div", null, React__default.createElement(Popup, {
|
|
146
120
|
style: {
|
|
147
121
|
padding: '32px 24px 28px 24px',
|
|
@@ -212,7 +186,6 @@ var ShortPassword = function ShortPassword(props) {
|
|
|
212
186
|
}
|
|
213
187
|
}, locale.confirm)) : null)));
|
|
214
188
|
};
|
|
215
|
-
|
|
216
189
|
ShortPassword.defaultProps = defaultProps;
|
|
217
190
|
ShortPassword.displayName = 'NutShortPassword';
|
|
218
191
|
export { ShortPassword as default };
|
package/dist/esm/SideNavBar.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["title", "visible", "width", "position", "children", "className", "showhead", "handleClose"];
|
|
4
|
-
|
|
5
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
-
|
|
7
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
-
|
|
9
6
|
import React__default from 'react';
|
|
10
7
|
import { useConfig } from './ConfigProvider.js';
|
|
11
8
|
import Popup from './Popup.js';
|
|
@@ -15,21 +12,18 @@ var defaultProps = {
|
|
|
15
12
|
position: 'left',
|
|
16
13
|
width: '80%'
|
|
17
14
|
};
|
|
18
|
-
|
|
19
15
|
var SideNavBar = function SideNavBar(props) {
|
|
20
16
|
useConfig();
|
|
21
|
-
|
|
22
17
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
title = _defaultProps$props.title,
|
|
19
|
+
visible = _defaultProps$props.visible,
|
|
20
|
+
width = _defaultProps$props.width,
|
|
21
|
+
position = _defaultProps$props.position,
|
|
22
|
+
children = _defaultProps$props.children,
|
|
23
|
+
className = _defaultProps$props.className,
|
|
24
|
+
showhead = _defaultProps$props.showhead,
|
|
25
|
+
handleClose = _defaultProps$props.handleClose,
|
|
26
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
33
27
|
var offset = props.offset ? Number(props.offset) : 20;
|
|
34
28
|
return React__default.createElement(Popup, {
|
|
35
29
|
visible: visible,
|
|
@@ -59,7 +53,6 @@ var SideNavBar = function SideNavBar(props) {
|
|
|
59
53
|
className: "nut-sidenavbar__content"
|
|
60
54
|
}, children))))));
|
|
61
55
|
};
|
|
62
|
-
|
|
63
56
|
SideNavBar.defaultProps = defaultProps;
|
|
64
57
|
SideNavBar.displayName = 'NutSideNavBar';
|
|
65
58
|
export { SideNavBar as default };
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["title", "ikey", "children", "click"];
|
|
4
|
-
|
|
5
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
-
|
|
7
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
-
|
|
9
6
|
import React__default from 'react';
|
|
10
|
-
|
|
11
7
|
var SideNavBarItem = function SideNavBarItem(props) {
|
|
12
8
|
var title = props.title,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
ikey = props.ikey,
|
|
10
|
+
children = props.children,
|
|
11
|
+
click = props.click,
|
|
12
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
18
13
|
var clickFn = function clickFn(e) {
|
|
19
14
|
e.stopPropagation();
|
|
20
15
|
click && click({
|
|
@@ -22,11 +17,9 @@ var SideNavBarItem = function SideNavBarItem(props) {
|
|
|
22
17
|
ikey: ikey
|
|
23
18
|
});
|
|
24
19
|
};
|
|
25
|
-
|
|
26
20
|
return React__default.createElement("div", _objectSpread({
|
|
27
21
|
className: "nut-subsidenavbar__item border-bt",
|
|
28
22
|
onClick: clickFn
|
|
29
23
|
}, rest), title);
|
|
30
24
|
};
|
|
31
|
-
|
|
32
25
|
export { SideNavBarItem as default };
|
package/dist/esm/Signature.js
CHANGED
|
@@ -2,11 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["type", "lineWidth", "strokeStyle", "unSupportTpl", "className"];
|
|
5
|
-
|
|
6
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
|
|
8
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
-
|
|
10
7
|
import React__default, { useRef, useState, useEffect } from 'react';
|
|
11
8
|
import Button from './Button.js';
|
|
12
9
|
import { c as cn } from './bem-893ad28d.js';
|
|
@@ -19,40 +16,32 @@ var defaultProps = {
|
|
|
19
16
|
unSupportTpl: '对不起,当前浏览器不支持Canvas,无法使用本控件!',
|
|
20
17
|
className: ''
|
|
21
18
|
};
|
|
22
|
-
|
|
23
19
|
var Signature = function Signature(props) {
|
|
24
20
|
var _useConfig = useConfig(),
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
locale = _useConfig.locale;
|
|
27
22
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
type = _defaultProps$props.type,
|
|
24
|
+
lineWidth = _defaultProps$props.lineWidth,
|
|
25
|
+
strokeStyle = _defaultProps$props.strokeStyle,
|
|
26
|
+
unSupportTpl = _defaultProps$props.unSupportTpl,
|
|
27
|
+
className = _defaultProps$props.className,
|
|
28
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
35
29
|
var b = cn('signature');
|
|
36
30
|
var canvasRef = useRef(null);
|
|
37
31
|
var wrapRef = useRef(null);
|
|
38
|
-
|
|
39
32
|
var _useState = useState(0),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
canvasHeight = _useState2[0],
|
|
35
|
+
setCanvasHeight = _useState2[1];
|
|
44
36
|
var _useState3 = useState(0),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
38
|
+
canvasWidth = _useState4[0],
|
|
39
|
+
setCanvasWidth = _useState4[1];
|
|
49
40
|
var ctx = useRef(null);
|
|
50
|
-
|
|
51
41
|
var isCanvasSupported = function isCanvasSupported() {
|
|
52
42
|
var elem = document.createElement('canvas');
|
|
53
43
|
return !!(elem.getContext && elem.getContext('2d'));
|
|
54
44
|
};
|
|
55
|
-
|
|
56
45
|
var isSupportTouch = ('ontouchstart' in window);
|
|
57
46
|
var events = isSupportTouch ? ['touchstart', 'touchmove', 'touchend', 'touchleave'] : ['mousedown', 'mousemove', 'mouseup', 'mouseleave'];
|
|
58
47
|
useEffect(function () {
|
|
@@ -63,10 +52,8 @@ var Signature = function Signature(props) {
|
|
|
63
52
|
addEvent();
|
|
64
53
|
}
|
|
65
54
|
}, []);
|
|
66
|
-
|
|
67
55
|
var startEventHandler = function startEventHandler(event) {
|
|
68
56
|
event.preventDefault();
|
|
69
|
-
|
|
70
57
|
if (ctx.current && canvasRef.current) {
|
|
71
58
|
ctx.current.beginPath();
|
|
72
59
|
ctx.current.lineWidth = lineWidth;
|
|
@@ -76,17 +63,14 @@ var Signature = function Signature(props) {
|
|
|
76
63
|
canvasRef.current.addEventListener(events[3], leaveEventHandler, false);
|
|
77
64
|
}
|
|
78
65
|
};
|
|
79
|
-
|
|
80
66
|
var addEvent = function addEvent() {
|
|
81
67
|
if (canvasRef.current) {
|
|
82
68
|
canvasRef.current.addEventListener(events[0], startEventHandler, false);
|
|
83
69
|
}
|
|
84
70
|
};
|
|
85
|
-
|
|
86
71
|
var moveEventHandler = function moveEventHandler(event) {
|
|
87
72
|
event.preventDefault();
|
|
88
73
|
var evt = isSupportTouch ? event.touches[0] : event;
|
|
89
|
-
|
|
90
74
|
if (canvasRef.current && ctx.current) {
|
|
91
75
|
var coverPos = canvasRef.current.getBoundingClientRect();
|
|
92
76
|
var mouseX = evt.clientX - coverPos.left;
|
|
@@ -95,59 +79,46 @@ var Signature = function Signature(props) {
|
|
|
95
79
|
ctx.current.stroke();
|
|
96
80
|
}
|
|
97
81
|
};
|
|
98
|
-
|
|
99
82
|
var endEventHandler = function endEventHandler(event) {
|
|
100
83
|
event.preventDefault();
|
|
101
|
-
|
|
102
84
|
if (canvasRef.current) {
|
|
103
85
|
canvasRef.current.removeEventListener(events[1], moveEventHandler, false);
|
|
104
86
|
canvasRef.current.removeEventListener(events[2], endEventHandler, false);
|
|
105
87
|
}
|
|
106
88
|
};
|
|
107
|
-
|
|
108
89
|
var leaveEventHandler = function leaveEventHandler(event) {
|
|
109
90
|
event.preventDefault();
|
|
110
|
-
|
|
111
91
|
if (canvasRef.current) {
|
|
112
92
|
canvasRef.current.removeEventListener(events[1], moveEventHandler, false);
|
|
113
93
|
canvasRef.current.removeEventListener(events[2], endEventHandler, false);
|
|
114
94
|
}
|
|
115
95
|
};
|
|
116
|
-
|
|
117
96
|
var clear = function clear() {
|
|
118
97
|
if (canvasRef.current && ctx.current) {
|
|
119
98
|
canvasRef.current.addEventListener(events[2], endEventHandler, false);
|
|
120
99
|
ctx.current.clearRect(0, 0, canvasWidth, canvasHeight);
|
|
121
100
|
ctx.current.closePath();
|
|
122
101
|
}
|
|
123
|
-
|
|
124
102
|
props.clear && props.clear();
|
|
125
103
|
};
|
|
126
|
-
|
|
127
104
|
var confirm = function confirm() {
|
|
128
105
|
onSave(canvasRef.current);
|
|
129
106
|
};
|
|
130
|
-
|
|
131
107
|
var onSave = function onSave(canvas) {
|
|
132
108
|
var dataurl;
|
|
133
|
-
|
|
134
109
|
switch (type) {
|
|
135
110
|
case 'png':
|
|
136
111
|
dataurl = canvas.toDataURL('image/png');
|
|
137
112
|
break;
|
|
138
|
-
|
|
139
113
|
case 'jpg':
|
|
140
114
|
dataurl = canvas.toDataURL('image/jpeg', 0.8);
|
|
141
115
|
break;
|
|
142
|
-
|
|
143
116
|
default:
|
|
144
117
|
dataurl = canvas.toDataURL('image/png');
|
|
145
118
|
}
|
|
146
|
-
|
|
147
119
|
clear();
|
|
148
120
|
props.confirm && props.confirm(canvas, dataurl);
|
|
149
121
|
};
|
|
150
|
-
|
|
151
122
|
return React__default.createElement("div", _objectSpread({
|
|
152
123
|
className: "".concat(b(), " ").concat(className)
|
|
153
124
|
}, rest), React__default.createElement("div", {
|
|
@@ -173,7 +144,6 @@ var Signature = function Signature(props) {
|
|
|
173
144
|
}
|
|
174
145
|
}, locale.confirm));
|
|
175
146
|
};
|
|
176
|
-
|
|
177
147
|
Signature.defaultProps = defaultProps;
|
|
178
148
|
Signature.displayName = 'NutSignature';
|
|
179
149
|
export { Signature as default };
|