@nutui/nutui-react-taro 1.3.5 → 1.3.6

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.
Files changed (125) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/esm/Audio.js +4 -4
  3. package/dist/esm/Calendar.js +4 -4
  4. package/dist/esm/CalendarItem.js +3 -3
  5. package/dist/esm/DatePicker.js +4 -4
  6. package/dist/esm/Drag.js +3 -4
  7. package/dist/esm/Elevator.js +2 -4
  8. package/dist/esm/NoticeBar.js +3 -3
  9. package/dist/esm/Picker.js +3 -3
  10. package/dist/esm/Popover.js +3 -3
  11. package/dist/esm/Range.js +3 -3
  12. package/dist/esm/SearchBar.js +3 -2
  13. package/dist/esm/Signature.js +3 -2
  14. package/dist/esm/Swipe.js +3 -3
  15. package/dist/esm/actionsheet.taro-360d8d34.js +15 -25
  16. package/dist/esm/address.taro-f16cef31.js +151 -219
  17. package/dist/esm/animatingnumbers.taro-6f40a2e9.js +13 -41
  18. package/dist/esm/{audio.taro-29f5568f.js → audio.taro-57d4f0da.js} +33 -60
  19. package/dist/esm/avatar.taro-ec620cdd.js +25 -50
  20. package/dist/esm/avatargroup-5b2584d9.js +2 -9
  21. package/dist/esm/backtop.taro-aa8b2bc5.js +29 -55
  22. package/dist/esm/badge.taro-38684262.js +9 -20
  23. package/dist/esm/barrage.taro-d86c367a.js +8 -21
  24. package/dist/esm/button.taro-a9ebb937.js +22 -37
  25. package/dist/esm/{calendar.taro-438940bd.js → calendar.taro-533b3219.js} +13 -24
  26. package/dist/esm/{calendaritem.taro-11333579.js → calendaritem.taro-fe5dd4bd.js} +71 -183
  27. package/dist/esm/card.taro-1bc35ebe.js +14 -20
  28. package/dist/esm/cascader.taro-77100fb4.js +77 -197
  29. package/dist/esm/cell.taro-a4c3bb7b.js +20 -30
  30. package/dist/esm/cellgroup.taro-8c87bf08.js +6 -12
  31. package/dist/esm/checkbox.taro-104557c1.js +27 -48
  32. package/dist/esm/checkboxgroup.taro-3d380042.js +12 -30
  33. package/dist/esm/circleprogress.taro-3c89a157.js +14 -41
  34. package/dist/esm/col.taro-2a437387.js +11 -22
  35. package/dist/esm/collapse.taro-72e58ba2.js +11 -27
  36. package/dist/esm/collapseitem-75843a5e.js +33 -47
  37. package/dist/esm/configprovider-3e87d67a.js +2 -6
  38. package/dist/esm/configprovider.taro-6c7b3056.js +4 -14
  39. package/dist/esm/countdown.taro-f2d9ffed.js +37 -74
  40. package/dist/esm/{datepicker.taro-1acec61f.js → datepicker.taro-49a4cf0c.js} +43 -104
  41. package/dist/esm/dialog.taro-492e2b9a.js +27 -58
  42. package/dist/esm/divider.taro-5236fe6a.js +8 -15
  43. package/dist/esm/drag.taro-0717c783.js +153 -0
  44. package/dist/esm/{elevator.taro-8e385785.js → elevator.taro-443253ec.js} +99 -124
  45. package/dist/esm/empty.taro-ab9c4f03.js +11 -24
  46. package/dist/esm/fixednav.taro-582322a1.js +16 -27
  47. package/dist/esm/grid.taro-5d75c0ad.js +13 -28
  48. package/dist/esm/griditem.taro-866cd288.js +18 -34
  49. package/dist/esm/icon-8dc4de10.js +11 -21
  50. package/dist/esm/icon.taro-1d0d4fb7.js +11 -21
  51. package/dist/esm/imagepreview.taro-1199e977.js +36 -71
  52. package/dist/esm/indicator.taro-183ea169.js +9 -20
  53. package/dist/esm/infiniteloading.taro-b95e62bf.js +23 -49
  54. package/dist/esm/input.taro-2453d7c4.js +62 -106
  55. package/dist/esm/inputnumber.taro-0cf7c1b7.js +25 -52
  56. package/dist/esm/layout.taro-358f014f.js +0 -6
  57. package/dist/esm/menu.taro-9345dcfd.js +21 -41
  58. package/dist/esm/menuitem.taro-fc0961b7.js +29 -54
  59. package/dist/esm/navbar.taro-c931c078.js +18 -34
  60. package/dist/esm/{noticebar.taro-1fa04a96.js → noticebar.taro-332691f9.js} +55 -107
  61. package/dist/esm/notify.taro-d9c48fae.js +18 -34
  62. package/dist/esm/numberkeyboard.taro-53c350b8.js +21 -52
  63. package/dist/esm/nutui-react.es.js +16 -16
  64. package/dist/esm/offsetContext-0e3d04b3.js +0 -3
  65. package/dist/esm/overlay.taro-be45fed5.js +12 -23
  66. package/dist/esm/pagination.taro-62bbd23f.js +38 -71
  67. package/dist/esm/{picker.taro-6a4dad23.js → picker.taro-f003b725.js} +95 -186
  68. package/dist/esm/{popover.taro-eddd0bd2.js → popover.taro-7e5dff8c.js} +33 -76
  69. package/dist/esm/popup.taro-33d0bbc8.js +40 -72
  70. package/dist/esm/price.taro-97393d8f.js +7 -24
  71. package/dist/esm/progress.taro-623bc807.js +23 -31
  72. package/dist/esm/pulltorefresh.taro-e66c78ad.js +29 -92
  73. package/dist/esm/radio.taro-95d43860.js +24 -47
  74. package/dist/esm/radiogroup.taro-b5dad516.js +14 -24
  75. package/dist/esm/{range.taro-515d37a4.js → range.taro-fc7c0b6a.js} +50 -133
  76. package/dist/esm/rate.taro-69c85081.js +21 -39
  77. package/dist/esm/row.taro-cec13a7e.js +7 -16
  78. package/dist/esm/{searchbar.taro-f134fb96.js → searchbar.taro-0d3c0081.js} +55 -70
  79. package/dist/esm/shortpassword.taro-2e96ca22.js +29 -56
  80. package/dist/esm/sidenavbar.taro-87f056cd.js +9 -16
  81. package/dist/esm/sidenavbaritem.taro-77e077f4.js +4 -11
  82. package/dist/esm/signature.taro-59b3b3ab.js +146 -0
  83. package/dist/esm/skeleton.taro-b9ff84b9.js +13 -23
  84. package/dist/esm/step.taro-f1057500.js +12 -28
  85. package/dist/esm/steps.taro-943f4fbb.js +6 -14
  86. package/dist/esm/sticky.taro-30d4e453.js +0 -7
  87. package/dist/esm/subsidenavbar.taro-2c1fcf16.js +7 -22
  88. package/dist/esm/{swipe.taro-dfb9a049.js → swipe.taro-83bc248f.js} +98 -91
  89. package/dist/esm/swiper.taro-f314d67a.js +110 -196
  90. package/dist/esm/swiperitem-d00e7513.js +2 -12
  91. package/dist/esm/switch.taro-be5eb823.js +13 -27
  92. package/dist/esm/tabbar.taro-da72fa2c.js +13 -25
  93. package/dist/esm/tabbaritem.taro-94cd62c2.js +15 -23
  94. package/dist/esm/table.taro-7ac89a6c.js +19 -39
  95. package/dist/esm/tabpane.taro-95aa185b.js +4 -10
  96. package/dist/esm/tabs.taro-86186dff.js +28 -54
  97. package/dist/esm/tag.taro-95d7f5c2.js +19 -36
  98. package/dist/esm/textarea.taro-388d1f90.js +18 -35
  99. package/dist/esm/timedetail.taro-519808cf.js +15 -28
  100. package/dist/esm/timepannel.taro-9904f6e6.js +5 -12
  101. package/dist/esm/timeselect.taro-73796bfc.js +35 -59
  102. package/dist/esm/toast.taro-86862dff.js +26 -46
  103. package/dist/esm/types/src/packages/elevator/demo.d.ts +1 -0
  104. package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +2 -0
  105. package/dist/esm/types/src/packages/searchbar/searchbar.taro.d.ts +2 -0
  106. package/dist/esm/types/src/packages/signature/signature.taro.d.ts +10 -2
  107. package/dist/esm/uploader.taro-6184abe7.js +52 -144
  108. package/dist/esm/{useClientRect-8b7cc406.js → useClientRect-bf69d7b3.js} +1 -40
  109. package/dist/esm/useTouch-a2ea68c6.js +27 -47
  110. package/dist/esm/video-c1090c92.js +8 -19
  111. package/dist/esm/virtuallist.taro-6858f690.js +84 -118
  112. package/dist/locales/base.js +1 -1
  113. package/dist/locales/en-US.js +1 -1
  114. package/dist/locales/id-ID.js +1 -1
  115. package/dist/locales/zh-CN.js +1 -1
  116. package/dist/locales/zh-TW.js +1 -1
  117. package/dist/nutui.react.es.js +10844 -11362
  118. package/dist/nutui.react.umd.js +10844 -11362
  119. package/dist/packages/searchbar/searchbar.scss +20 -3
  120. package/dist/style.css +1 -1
  121. package/dist/style.es.js +1 -1
  122. package/dist/types/index.d.ts +17 -8
  123. package/package.json +1 -1
  124. package/dist/esm/drag.taro-56e8c87a.js +0 -134
  125. package/dist/esm/signature.taro-a9286cd1.js +0 -178
@@ -1,16 +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 { u as useConfig } from './configprovider.taro-6c7b3056.js';
11
8
  import { I as Icon } from './icon.taro-1d0d4fb7.js';
12
9
  import { C as ComponentDefaults } from './typings-1c5f2628.js';
13
-
10
+ import Taro from '@tarojs/taro';
14
11
  var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
15
12
  placeholder: '',
16
13
  shape: 'square',
@@ -26,71 +23,62 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
26
23
  size: "12"
27
24
  })
28
25
  });
29
-
30
26
  var SearchBar = function SearchBar(props) {
31
27
  var searchbarBem = cn('searchbar');
32
-
33
28
  var _useConfig = useConfig(),
34
- locale = _useConfig.locale;
35
-
29
+ locale = _useConfig.locale;
36
30
  var searchRef = useRef(null);
37
-
38
31
  var _useState = useState(function () {
39
- return props.value;
40
- }),
41
- _useState2 = _slicedToArray(_useState, 2),
42
- value = _useState2[0],
43
- setValue = _useState2[1];
44
-
32
+ return props.value;
33
+ }),
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ value = _useState2[0],
36
+ setValue = _useState2[1];
45
37
  var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
46
- placeholder = _defaultProps$props.placeholder,
47
- shape = _defaultProps$props.shape,
48
- className = _defaultProps$props.className,
49
- disabled = _defaultProps$props.disabled,
50
- maxLength = _defaultProps$props.maxLength,
51
- clearable = _defaultProps$props.clearable,
52
- align = _defaultProps$props.align,
53
- readOnly = _defaultProps$props.readOnly,
54
- autoFocus = _defaultProps$props.autoFocus,
55
- label = _defaultProps$props.label,
56
- actionText = _defaultProps$props.actionText,
57
- leftinIcon = _defaultProps$props.leftinIcon,
58
- rightinIcon = _defaultProps$props.rightinIcon,
59
- leftoutIcon = _defaultProps$props.leftoutIcon,
60
- rightoutIcon = _defaultProps$props.rightoutIcon,
61
- onChange = _defaultProps$props.onChange,
62
- onFocus = _defaultProps$props.onFocus,
63
- onBlur = _defaultProps$props.onBlur,
64
- onClear = _defaultProps$props.onClear,
65
- onSearch = _defaultProps$props.onSearch,
66
- onClickInput = _defaultProps$props.onClickInput,
67
- onClickLeftinIcon = _defaultProps$props.onClickLeftinIcon,
68
- onClickLeftoutIcon = _defaultProps$props.onClickLeftoutIcon,
69
- onClickRightinIcon = _defaultProps$props.onClickRightinIcon,
70
- onClickRightoutIcon = _defaultProps$props.onClickRightoutIcon,
71
- iconClassPrefix = _defaultProps$props.iconClassPrefix,
72
- iconFontClassName = _defaultProps$props.iconFontClassName;
73
-
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;
74
66
  var alignClass = "".concat(align);
75
-
76
67
  var change = function change(event) {
77
68
  var value = event.target.value;
78
69
  onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(value, event));
79
70
  setValue(value);
80
71
  };
81
-
82
72
  var focus = function focus(event) {
83
73
  var value = event.target.value;
84
74
  onFocus && (onFocus === null || onFocus === void 0 ? void 0 : onFocus(value, event));
85
75
  };
86
-
87
76
  var blur = function blur(event) {
88
77
  var searchSelf = searchRef.current;
89
78
  searchSelf && searchSelf.blur();
90
79
  var value = event.target.value;
91
80
  onBlur && (onBlur === null || onBlur === void 0 ? void 0 : onBlur(value, event));
92
81
  };
93
-
94
82
  useEffect(function () {
95
83
  setValue(props.value);
96
84
  }, [props.value]);
@@ -100,7 +88,6 @@ var SearchBar = function SearchBar(props) {
100
88
  searchSelf && searchSelf.focus();
101
89
  }
102
90
  }, [autoFocus]);
103
-
104
91
  var renderField = function renderField() {
105
92
  return React__default.createElement("input", {
106
93
  className: "".concat(searchbarBem('input'), " ").concat(searchbarBem(alignClass), " ").concat(shape === 'round' ? searchbarBem('round') : '', " ").concat(clearable ? searchbarBem('input-clear') : ''),
@@ -113,6 +100,7 @@ var SearchBar = function SearchBar(props) {
113
100
  disabled: disabled,
114
101
  readOnly: readOnly,
115
102
  maxLength: maxLength,
103
+ onKeyPress: onKeypress,
116
104
  onChange: function onChange(e) {
117
105
  return change(e);
118
106
  },
@@ -127,11 +115,9 @@ var SearchBar = function SearchBar(props) {
127
115
  }
128
116
  });
129
117
  };
130
-
131
118
  var clickInput = function clickInput(e) {
132
119
  onClickInput && onClickInput(e);
133
120
  };
134
-
135
121
  var renderLeftinIcon = function renderLeftinIcon() {
136
122
  if (!leftinIcon) return null;
137
123
  return React__default.createElement("div", {
@@ -141,7 +127,6 @@ var SearchBar = function SearchBar(props) {
141
127
  }
142
128
  }, leftinIcon);
143
129
  };
144
-
145
130
  var renderLeftoutIcon = function renderLeftoutIcon() {
146
131
  if (!leftoutIcon) return null;
147
132
  return React__default.createElement("div", {
@@ -151,7 +136,6 @@ var SearchBar = function SearchBar(props) {
151
136
  }
152
137
  }, leftoutIcon);
153
138
  };
154
-
155
139
  var clickLeftIcon = function clickLeftIcon(flag, event) {
156
140
  if (flag === 'in-left') {
157
141
  onClickLeftinIcon && onClickLeftinIcon(value, event);
@@ -159,7 +143,6 @@ var SearchBar = function SearchBar(props) {
159
143
  onClickLeftoutIcon && onClickLeftoutIcon(value, event);
160
144
  }
161
145
  };
162
-
163
146
  var renderRightinIcon = function renderRightinIcon() {
164
147
  if (!rightinIcon) return null;
165
148
  return React__default.createElement("div", {
@@ -169,7 +152,6 @@ var SearchBar = function SearchBar(props) {
169
152
  }
170
153
  }, rightinIcon);
171
154
  };
172
-
173
155
  var renderRightoutIcon = function renderRightoutIcon() {
174
156
  if (!rightoutIcon) return null;
175
157
  return React__default.createElement("div", {
@@ -179,7 +161,6 @@ var SearchBar = function SearchBar(props) {
179
161
  }
180
162
  }, rightoutIcon);
181
163
  };
182
-
183
164
  var clickRightIcon = function clickRightIcon(flag, event) {
184
165
  if (flag === 'in-left') {
185
166
  onClickRightinIcon && onClickRightinIcon(value, event);
@@ -187,7 +168,6 @@ var SearchBar = function SearchBar(props) {
187
168
  onClickRightoutIcon && onClickRightoutIcon(value, event);
188
169
  }
189
170
  };
190
-
191
171
  var handleClear = function handleClear() {
192
172
  return React__default.createElement("div", {
193
173
  className: "".concat(searchbarBem('clear'), " ").concat(rightinIcon ? 'pos-right' : ''),
@@ -202,51 +182,56 @@ var SearchBar = function SearchBar(props) {
202
182
  color: "#555"
203
183
  }));
204
184
  };
205
-
206
185
  var clearaVal = function clearaVal(event) {
207
186
  if (disabled || readOnly) {
208
187
  return;
209
188
  }
210
-
211
189
  setValue('');
212
190
  onClear && onClear(event);
213
191
  };
214
-
215
192
  var renderRightLabel = function renderRightLabel() {
216
193
  if (actionText) {
217
194
  return React__default.createElement("div", {
218
195
  className: searchbarBem('action-text'),
219
- onClick: search
196
+ onClick: cancel
220
197
  }, actionText);
221
198
  }
222
-
223
199
  return null;
224
200
  };
225
-
226
- var search = function search() {
227
- onSearch && onSearch(value);
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();
228
212
  };
229
-
230
213
  var renderLabel = function renderLabel() {
231
214
  if (label) {
232
215
  return React__default.createElement("div", {
233
216
  className: searchbarBem('label')
234
217
  }, label);
235
218
  }
236
-
237
219
  return null;
238
220
  };
239
-
221
+ var envClass = function envClass() {
222
+ return Taro.getEnv() === 'WEB' ? 'nut-searchbar-taro' : '';
223
+ };
240
224
  return React__default.createElement("div", {
241
- className: "".concat(searchbarBem(), " ").concat(disabled ? searchbarBem('disabled') : '', " ").concat(className || ''),
225
+ className: "".concat(searchbarBem(), " ").concat(envClass(), " ").concat(disabled ? searchbarBem('disabled') : '', " ").concat(className || ''),
242
226
  style: _objectSpread(_objectSpread({}, props.style), {}, {
243
227
  background: props.background
244
228
  })
245
229
  }, renderLeftoutIcon(), renderLabel(), React__default.createElement("div", {
246
230
  className: "".concat(searchbarBem('content'))
247
- }, renderLeftinIcon(), renderField(), renderRightinIcon(), clearable && value && handleClear()), renderRightoutIcon(), renderRightLabel());
231
+ }, renderLeftinIcon(), React__default.createElement("div", {
232
+ className: "nut-searchbar__input-box"
233
+ }, renderField()), renderRightinIcon(), clearable && value && handleClear()), renderRightoutIcon(), renderRightLabel());
248
234
  };
249
-
250
235
  SearchBar.defaultProps = defaultProps;
251
236
  SearchBar.displayName = 'NutSearchBar';
252
237
  export { SearchBar as S };
@@ -3,18 +3,14 @@ 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 { P as Popup } from './popup.taro-33d0bbc8.js';
14
11
  import { I as Icon } from './icon.taro-1d0d4fb7.js';
15
12
  import { u as useConfig } from './configprovider.taro-6c7b3056.js';
16
13
  import { C as ComponentDefaults } from './typings-1c5f2628.js';
17
-
18
14
  var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
19
15
  title: '',
20
16
  desc: '',
@@ -33,54 +29,46 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
33
29
  onTips: function onTips() {},
34
30
  onComplete: function onComplete(value) {}
35
31
  });
36
-
37
32
  var ShortPassword = function ShortPassword(props) {
38
33
  var _useConfig = useConfig(),
39
- locale = _useConfig.locale;
40
-
34
+ locale = _useConfig.locale;
41
35
  var title = props.title,
42
- desc = props.desc,
43
- tips = props.tips,
44
- visible = props.visible,
45
- modelValue = props.modelValue,
46
- errorMsg = props.errorMsg,
47
- noButton = props.noButton,
48
- closeOnClickOverlay = props.closeOnClickOverlay,
49
- length = props.length,
50
- style = props.style,
51
- className = props.className,
52
- onChange = props.onChange,
53
- onOk = props.onOk,
54
- onTips = props.onTips,
55
- onCancel = props.onCancel,
56
- onClose = props.onClose,
57
- onComplete = props.onComplete,
58
- iconClassPrefix = props.iconClassPrefix,
59
- iconFontClassName = props.iconFontClassName,
60
- reset = _objectWithoutProperties(props, _excluded);
61
-
36
+ desc = props.desc,
37
+ tips = props.tips,
38
+ visible = props.visible,
39
+ modelValue = props.modelValue,
40
+ errorMsg = props.errorMsg,
41
+ noButton = props.noButton,
42
+ closeOnClickOverlay = props.closeOnClickOverlay,
43
+ length = props.length,
44
+ style = props.style,
45
+ className = props.className,
46
+ onChange = props.onChange,
47
+ onOk = props.onOk,
48
+ onTips = props.onTips,
49
+ onCancel = props.onCancel,
50
+ onClose = props.onClose,
51
+ onComplete = props.onComplete,
52
+ iconClassPrefix = props.iconClassPrefix,
53
+ iconFontClassName = props.iconFontClassName,
54
+ reset = _objectWithoutProperties(props, _excluded);
62
55
  var b = cn('shortpassword');
63
56
  var textInput = useRef(null);
64
-
65
57
  var range = function range(val) {
66
58
  return Math.min(Math.max(4, val), 6);
67
59
  };
68
-
69
60
  var _useState = useState(visible),
70
- _useState2 = _slicedToArray(_useState, 2),
71
- innerVisible = _useState2[0],
72
- setInnerVisible = _useState2[1];
73
-
61
+ _useState2 = _slicedToArray(_useState, 2),
62
+ innerVisible = _useState2[0],
63
+ setInnerVisible = _useState2[1];
74
64
  var _useState3 = useState(range(Number(length))),
75
- _useState4 = _slicedToArray(_useState3, 2),
76
- comLen = _useState4[0],
77
- setComLen = _useState4[1];
78
-
65
+ _useState4 = _slicedToArray(_useState3, 2),
66
+ comLen = _useState4[0],
67
+ setComLen = _useState4[1];
79
68
  var _useState5 = useState(''),
80
- _useState6 = _slicedToArray(_useState5, 2),
81
- inputValue = _useState6[0],
82
- setInputValue = _useState6[1];
83
-
69
+ _useState6 = _slicedToArray(_useState5, 2),
70
+ inputValue = _useState6[0],
71
+ setInputValue = _useState6[1];
84
72
  useEffect(function () {
85
73
  setInnerVisible(visible);
86
74
  }, [visible]);
@@ -89,58 +77,44 @@ var ShortPassword = function ShortPassword(props) {
89
77
  setInputValue(modelValue);
90
78
  }
91
79
  }, [modelValue]);
92
-
93
80
  var changeValue = function changeValue(e) {
94
81
  var inputValue = e.target.value;
95
-
96
82
  if (String(inputValue).length > comLen) {
97
83
  inputValue = inputValue.slice(0, comLen);
98
84
  }
99
-
100
85
  setInputValue(inputValue);
101
-
102
86
  if (String(inputValue).length === comLen) {
103
87
  onComplete && onComplete(inputValue);
104
88
  }
105
-
106
89
  onChange && onChange(inputValue);
107
90
  };
108
-
109
91
  var systemStyle = function systemStyle() {
110
92
  var u = navigator.userAgent;
111
93
  var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; // g
112
-
113
94
  var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
114
-
115
95
  var style = {};
116
96
  console.log(isIOS, isAndroid);
117
-
118
97
  if (isIOS) {
119
98
  style = {
120
99
  paddingRight: '1200px'
121
100
  };
122
101
  }
123
-
124
102
  if (isAndroid) {
125
103
  style = {
126
104
  opacity: 0,
127
105
  zIndex: 10
128
106
  };
129
107
  }
130
-
131
108
  return style;
132
109
  };
133
-
134
110
  var focus = function focus() {
135
111
  if (textInput.current) {
136
112
  textInput.current.focus();
137
113
  }
138
114
  };
139
-
140
115
  var sure = function sure() {
141
116
  onOk && onOk(inputValue);
142
117
  };
143
-
144
118
  return React__default.createElement("div", null, React__default.createElement(Popup, {
145
119
  style: {
146
120
  padding: '32px 24px 28px 24px',
@@ -211,7 +185,6 @@ var ShortPassword = function ShortPassword(props) {
211
185
  }
212
186
  }, locale.confirm)) : null)));
213
187
  };
214
-
215
188
  ShortPassword.defaultProps = defaultProps;
216
189
  ShortPassword.displayName = 'NutShortPassword';
217
190
  export { ShortPassword as S };
@@ -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 { u as useConfig } from './configprovider.taro-6c7b3056.js';
11
8
  import { P as Popup } from './popup.taro-33d0bbc8.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
- title = _defaultProps$props.title,
24
- visible = _defaultProps$props.visible,
25
- width = _defaultProps$props.width,
26
- position = _defaultProps$props.position,
27
- children = _defaultProps$props.children,
28
- className = _defaultProps$props.className,
29
- showhead = _defaultProps$props.showhead,
30
- handleClose = _defaultProps$props.handleClose,
31
- rest = _objectWithoutProperties(_defaultProps$props, _excluded);
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 S };
@@ -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
- ikey = props.ikey,
14
- children = props.children,
15
- click = props.click,
16
- rest = _objectWithoutProperties(props, _excluded);
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 S };
@@ -0,0 +1,146 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["canvasId", "type", "lineWidth", "strokeStyle", "unSupportTpl", "className"];
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; }
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; }
7
+ import React__default, { useRef, useState } from 'react';
8
+ import Taro, { useReady } from '@tarojs/taro';
9
+ import { B as Button } from './button.taro-a9ebb937.js';
10
+ import { c as cn } from './bem-893ad28d.js';
11
+ import { u as useConfig } from './configprovider.taro-6c7b3056.js';
12
+ var defaultProps = {
13
+ canvasId: 'weappCanvas',
14
+ type: 'png',
15
+ lineWidth: 2,
16
+ strokeStyle: '#000',
17
+ className: ''
18
+ };
19
+ var Signature = function Signature(props) {
20
+ var _useConfig = useConfig(),
21
+ locale = _useConfig.locale;
22
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
23
+ canvasId = _defaultProps$props.canvasId,
24
+ type = _defaultProps$props.type,
25
+ lineWidth = _defaultProps$props.lineWidth,
26
+ strokeStyle = _defaultProps$props.strokeStyle,
27
+ unSupportTpl = _defaultProps$props.unSupportTpl,
28
+ className = _defaultProps$props.className,
29
+ rest = _objectWithoutProperties(_defaultProps$props, _excluded);
30
+ var b = cn('signature');
31
+ useRef(null);
32
+ var wrapRef = useRef(null);
33
+ var _useState = useState(0),
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ canvasHeight = _useState2[0],
36
+ setCanvasHeight = _useState2[1];
37
+ var _useState3 = useState(0),
38
+ _useState4 = _slicedToArray(_useState3, 2),
39
+ canvasWidth = _useState4[0],
40
+ setCanvasWidth = _useState4[1];
41
+ var ctx = useRef(null);
42
+ var startEventHandler = function startEventHandler(event) {
43
+ event.preventDefault();
44
+ if (ctx.current) {
45
+ ctx.current.beginPath();
46
+ ctx.current.lineWidth = lineWidth;
47
+ ctx.current.strokeStyle = strokeStyle;
48
+ }
49
+ };
50
+ var moveEventHandler = function moveEventHandler(event) {
51
+ event.preventDefault();
52
+ if (ctx.current) {
53
+ ctx.current.lineTo(event.changedTouches[0].x, event.changedTouches[0].y);
54
+ ctx.current.stroke();
55
+ }
56
+ };
57
+ var endEventHandler = function endEventHandler(event) {
58
+ event.preventDefault();
59
+ };
60
+ var clear = function clear() {
61
+ if (ctx.current) {
62
+ ctx.current.clearRect(0, 0, canvasWidth, canvasHeight);
63
+ ctx.current.closePath();
64
+ }
65
+ props.clear && props.clear();
66
+ };
67
+ var confirm = function confirm() {
68
+ onSave();
69
+ };
70
+ var onSave = function onSave() {
71
+ Taro.createSelectorQuery().select("#".concat(canvasId)).fields({
72
+ node: true,
73
+ size: true
74
+ }).exec(function (res) {
75
+ Taro.canvasToTempFilePath({
76
+ canvas: res[0].node,
77
+ fileType: props.type,
78
+ success: function success(res) {
79
+ clear();
80
+ props.confirm && props.confirm(res.tempFilePath);
81
+ },
82
+ fail: function fail(res) {
83
+ console.log('保存失败');
84
+ }
85
+ });
86
+ });
87
+ };
88
+ useReady(function () {
89
+ initCanvas();
90
+ });
91
+ // useEffect(() => {
92
+ // eventCenter.once((getCurrentInstanceTaro() as any).router.onReady, () => {
93
+ var initCanvas = function initCanvas() {
94
+ Taro.createSelectorQuery().select("#".concat(canvasId)).fields({
95
+ node: true,
96
+ size: true
97
+ }, function (res) {
98
+ var canvas = res.node;
99
+ canvas.current = canvas;
100
+ ctx.current = canvas.getContext('2d');
101
+ setCanvasWidth(res.width);
102
+ setCanvasHeight(res.height);
103
+ if (ctx.current) {
104
+ ctx.current.clearRect(0, 0, canvasWidth, canvasHeight);
105
+ ctx.current.beginPath();
106
+ ctx.current.lineWidth = lineWidth;
107
+ ctx.current.strokeStyle = strokeStyle;
108
+ }
109
+ }).exec();
110
+ };
111
+ // })
112
+ // }, [])
113
+ return React__default.createElement("div", _objectSpread({
114
+ className: "".concat(b(), " ").concat(className)
115
+ }, rest), React__default.createElement("div", {
116
+ className: "".concat(b('inner')),
117
+ ref: wrapRef
118
+ }, React__default.createElement("canvas", {
119
+ id: canvasId,
120
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
121
+ // @ts-ignore
122
+ // eslint-disable-next-line react/no-unknown-property
123
+ canvasId: canvasId,
124
+ // eslint-disable-next-line react/no-unknown-property
125
+ disableScroll: true,
126
+ type: "2d",
127
+ onTouchStart: startEventHandler,
128
+ onTouchMove: moveEventHandler,
129
+ onTouchEnd: endEventHandler
130
+ })), React__default.createElement(Button, {
131
+ className: "".concat(b('btn')),
132
+ type: "default",
133
+ onClick: function onClick() {
134
+ return clear();
135
+ }
136
+ }, locale.signature.reSign), React__default.createElement(Button, {
137
+ className: "".concat(b('btn')),
138
+ type: "primary",
139
+ onClick: function onClick() {
140
+ return confirm();
141
+ }
142
+ }, locale.confirm));
143
+ };
144
+ Signature.defaultProps = defaultProps;
145
+ Signature.displayName = 'NutSignature';
146
+ export { Signature as S };