@nutui/nutui-react-taro 1.4.2 → 1.4.3-beta.0

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 (82) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/esm/ActionSheet.js +4 -4
  3. package/dist/esm/Address.js +4 -4
  4. package/dist/esm/Audio.js +4 -4
  5. package/dist/esm/Badge.js +2 -2
  6. package/dist/esm/Barrage.js +2 -2
  7. package/dist/esm/Calendar.js +5 -5
  8. package/dist/esm/CalendarItem.js +2 -2
  9. package/dist/esm/Cascader.js +4 -4
  10. package/dist/esm/CircleProgress.js +2 -2
  11. package/dist/esm/DatePicker.js +5 -5
  12. package/dist/esm/Dialog.js +2 -2
  13. package/dist/esm/Drag.js +2 -2
  14. package/dist/esm/FixedNav.js +3 -3
  15. package/dist/esm/ImagePreview.js +4 -4
  16. package/dist/esm/InputNumber.js +2 -2
  17. package/dist/esm/MenuItem.js +3 -3
  18. package/dist/esm/NoticeBar.js +2 -2
  19. package/dist/esm/Notify.js +2 -2
  20. package/dist/esm/NumberKeyboard.js +4 -4
  21. package/dist/esm/Overlay.js +2 -2
  22. package/dist/esm/Picker.js +4 -4
  23. package/dist/esm/Popover.js +3 -3
  24. package/dist/esm/Popup.js +3 -3
  25. package/dist/esm/Range.js +3 -3
  26. package/dist/esm/ShortPassword.js +4 -4
  27. package/dist/esm/SideNavBar.js +4 -4
  28. package/dist/esm/Signature.js +2 -2
  29. package/dist/esm/TimeSelect.js +4 -4
  30. package/dist/esm/Toast.js +2 -2
  31. package/dist/esm/WaterMark.js +2 -2
  32. package/dist/esm/{actionsheet.taro-360d8d34.js → actionsheet.taro-a58d3d12.js} +1 -1
  33. package/dist/esm/{address.taro-c03b8b16.js → address.taro-1e2aea24.js} +22 -24
  34. package/dist/esm/{audio.taro-20890c93.js → audio.taro-fddcdfc0.js} +1 -1
  35. package/dist/esm/{badge.taro-9f72d846.js → badge.taro-fe9171ec.js} +1 -1
  36. package/dist/esm/{barrage.taro-d86c367a.js → barrage.taro-0e157b5e.js} +25 -23
  37. package/dist/esm/{calendar.taro-93b14945.js → calendar.taro-72974415.js} +2 -2
  38. package/dist/esm/{calendaritem.taro-85a8c4fc.js → calendaritem.taro-84e889eb.js} +19 -17
  39. package/dist/esm/{cascader.taro-459f7d45.js → cascader.taro-d8cb1c3e.js} +245 -235
  40. package/dist/esm/{circleprogress.taro-3c89a157.js → circleprogress.taro-47db537c.js} +2 -13
  41. package/dist/esm/{datepicker.taro-7de67b85.js → datepicker.taro-7199f521.js} +1 -1
  42. package/dist/esm/{dialog.taro-cf9e3087.js → dialog.taro-f54cfbf0.js} +1 -1
  43. package/dist/esm/{drag.taro-0717c783.js → drag.taro-82b6b27a.js} +4 -8
  44. package/dist/esm/ellipsis.taro-c0de6ff4.js +84 -76
  45. package/dist/esm/{fixednav.taro-005765f4.js → fixednav.taro-9e759320.js} +1 -1
  46. package/dist/esm/{imagepreview.taro-68e776f5.js → imagepreview.taro-3400ea03.js} +1 -1
  47. package/dist/esm/{inputnumber.taro-0a01f6e1.js → inputnumber.taro-dc39b853.js} +1 -0
  48. package/dist/esm/{menuitem.taro-2f8e69a4.js → menuitem.taro-216e9f7d.js} +17 -15
  49. package/dist/esm/{noticebar.taro-43c18dc9.js → noticebar.taro-94002898.js} +35 -33
  50. package/dist/esm/{notify.taro-d9c48fae.js → notify.taro-308e5892.js} +1 -1
  51. package/dist/esm/{numberkeyboard.taro-9635ecc9.js → numberkeyboard.taro-5e8f0ddf.js} +1 -1
  52. package/dist/esm/nutui-react.es.js +30 -30
  53. package/dist/esm/{overlay.taro-be45fed5.js → overlay.taro-98367bc1.js} +1 -1
  54. package/dist/esm/{picker.taro-9b7263ca.js → picker.taro-3b5cc054.js} +14 -12
  55. package/dist/esm/{popover.taro-7e5dff8c.js → popover.taro-46d813e8.js} +18 -16
  56. package/dist/esm/{popup.taro-33d0bbc8.js → popup.taro-cb777e09.js} +1 -1
  57. package/dist/esm/pulltorefresh.taro-f26a20dd.js +81 -75
  58. package/dist/esm/{range.taro-4cbe2469.js → range.taro-c41e9b90.js} +72 -68
  59. package/dist/esm/{shortpassword.taro-4bd513ae.js → shortpassword.taro-3a3bf412.js} +1 -1
  60. package/dist/esm/{sidenavbar.taro-3b1f1218.js → sidenavbar.taro-06026f31.js} +1 -1
  61. package/dist/esm/{signature.taro-504357dc.js → signature.taro-17648cac.js} +79 -39
  62. package/dist/esm/swipe.taro-83bc248f.js +37 -35
  63. package/dist/esm/swiper.taro-852f6615.js +28 -26
  64. package/dist/esm/{timeselect.taro-000060af.js → timeselect.taro-fc7ec6ee.js} +1 -1
  65. package/dist/esm/{toast.taro-86862dff.js → toast.taro-0804b6b4.js} +1 -1
  66. package/dist/esm/useClientRect-bf69d7b3.js +12 -10
  67. package/dist/esm/{watermark.taro-d1f38563.js → watermark.taro-323d1cf3.js} +53 -41
  68. package/dist/locales/base.js +1 -1
  69. package/dist/locales/en-US.js +1 -1
  70. package/dist/locales/id-ID.js +1 -1
  71. package/dist/locales/zh-CN.js +1 -1
  72. package/dist/locales/zh-TW.js +1 -1
  73. package/dist/locales/zh-UG.js +1 -1
  74. package/dist/nutui.react.es.js +160 -111
  75. package/dist/nutui.react.umd.js +159 -110
  76. package/dist/packages/drag/drag.scss +1 -0
  77. package/dist/packages/inputnumber/inputnumber.scss +4 -1
  78. package/dist/packages/signature/signature.scss +10 -3
  79. package/dist/style.css +1 -1
  80. package/dist/style.es.js +1 -1
  81. package/dist/styles/variables.scss +1 -1
  82. package/package.json +1 -1
@@ -398,32 +398,34 @@ var Swiper = React__default.forwardRef(function (props, ref) {
398
398
  targetOffset,
399
399
  _args = arguments;
400
400
  return _regeneratorRuntime.wrap(function _callee$(_context) {
401
- while (1) switch (_context.prev = _context.next) {
402
- case 0:
403
- active = _args.length > 0 && _args[0] !== undefined ? _args[0] : +propSwiper.initPage;
404
- _context.next = 3;
405
- return queryRect(container.current);
406
- case 3:
407
- rect = _context.sent;
408
- _active = Math.max(Math.min(childCount - 1, active), 0);
409
- _width = propSwiper.width ? +propSwiper.width : rect === null || rect === void 0 ? void 0 : rect.width;
410
- _height = propSwiper.height ? +propSwiper.height : rect === null || rect === void 0 ? void 0 : rect.height;
411
- size = isVertical ? _height : _width;
412
- trackSize = childCount * Number(size);
413
- targetOffset = getOffset(_active);
414
- _swiper.current.moving = true;
415
- if (ready) {
416
- _swiper.current.moving = false;
417
- }
418
- setRect(rect);
419
- setActive(_active);
420
- setWidth(_width);
421
- setHeight(_height);
422
- setOffset(targetOffset);
423
- setReady(true);
424
- case 18:
425
- case "end":
426
- return _context.stop();
401
+ while (1) {
402
+ switch (_context.prev = _context.next) {
403
+ case 0:
404
+ active = _args.length > 0 && _args[0] !== undefined ? _args[0] : +propSwiper.initPage;
405
+ _context.next = 3;
406
+ return queryRect(container.current);
407
+ case 3:
408
+ rect = _context.sent;
409
+ _active = Math.max(Math.min(childCount - 1, active), 0);
410
+ _width = propSwiper.width ? +propSwiper.width : rect === null || rect === void 0 ? void 0 : rect.width;
411
+ _height = propSwiper.height ? +propSwiper.height : rect === null || rect === void 0 ? void 0 : rect.height;
412
+ size = isVertical ? _height : _width;
413
+ trackSize = childCount * Number(size);
414
+ targetOffset = getOffset(_active);
415
+ _swiper.current.moving = true;
416
+ if (ready) {
417
+ _swiper.current.moving = false;
418
+ }
419
+ setRect(rect);
420
+ setActive(_active);
421
+ setWidth(_width);
422
+ setHeight(_height);
423
+ setOffset(targetOffset);
424
+ setReady(true);
425
+ case 18:
426
+ case "end":
427
+ return _context.stop();
428
+ }
427
429
  }
428
430
  }, _callee);
429
431
  }));
@@ -4,7 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
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; }
5
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; }
6
6
  import React__default, { useState, useEffect } from 'react';
7
- import { P as Popup } from './popup.taro-33d0bbc8.js';
7
+ import { P as Popup } from './popup.taro-cb777e09.js';
8
8
  import { T as TimePannel } from './timepannel.taro-c66c63dd.js';
9
9
  import { T as TimeDetail } from './timedetail.taro-105f5380.js';
10
10
  import { c as cn } from './bem-893ad28d.js';
@@ -80,7 +80,7 @@ var Toast = function Toast(props) {
80
80
  var show = function show() {
81
81
  clearTimer();
82
82
  if (duration) {
83
- timer = setTimeout(function () {
83
+ timer = window.setTimeout(function () {
84
84
  hide();
85
85
  }, duration * 1000);
86
86
  }
@@ -13,16 +13,18 @@ var getRectByTaro = /*#__PURE__*/function () {
13
13
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(element) {
14
14
  var res;
15
15
  return _regeneratorRuntime.wrap(function _callee$(_context) {
16
- while (1) switch (_context.prev = _context.next) {
17
- case 0:
18
- _context.next = 2;
19
- return element.getBoundingClientRect();
20
- case 2:
21
- res = _context.sent;
22
- return _context.abrupt("return", res);
23
- case 4:
24
- case "end":
25
- return _context.stop();
16
+ while (1) {
17
+ switch (_context.prev = _context.next) {
18
+ case 0:
19
+ _context.next = 2;
20
+ return element.getBoundingClientRect();
21
+ case 2:
22
+ res = _context.sent;
23
+ return _context.abrupt("return", res);
24
+ case 4:
25
+ case "end":
26
+ return _context.stop();
27
+ }
26
28
  }
27
29
  }, _callee);
28
30
  }));
@@ -61,50 +61,62 @@ var WaterMark = function WaterMark(props) {
61
61
  }, []);
62
62
  var init = function init() {
63
63
  var ratio = 1;
64
- Taro.getSystemInfo({
65
- success: function success(res) {
66
- ratio = res.pixelRatio;
64
+ Taro.getSystemInfo().then(function (res) {
65
+ ratio = res.pixelRatio;
66
+ var canvasWidth = "".concat((gapX + width) * ratio, "px");
67
+ var canvasHeight = "".concat((gapY + height) * ratio, "px");
68
+ var markWidth = width * ratio;
69
+ var markHeight = height * ratio;
70
+ var ctx;
71
+ var canvas;
72
+ if (process.env.TARO_ENV === 'h5') {
73
+ canvas = document.createElement('canvas');
74
+ ctx = canvas.getContext('2d');
75
+ canvas.setAttribute('width', canvasWidth);
76
+ canvas.setAttribute('height', canvasHeight);
77
+ } else {
78
+ canvas = Taro.createOffscreenCanvas({
79
+ type: '2d',
80
+ width: Number(canvasWidth),
81
+ height: Number(canvasHeight)
82
+ });
83
+ ctx = canvas.getContext('2d');
67
84
  }
68
- });
69
- var canvasWidth = "".concat((gapX + width) * ratio, "px");
70
- var canvasHeight = "".concat((gapY + height) * ratio, "px");
71
- var markWidth = width * ratio;
72
- var markHeight = height * ratio;
73
- var canvas = Taro.createOffscreenCanvas({
74
- type: '2d',
75
- width: Number(canvasWidth),
76
- height: Number(canvasHeight)
77
- });
78
- var ctx = canvas.getContext('2d');
79
- if (ctx) {
80
- if (image) {
81
- ctx.translate(markWidth / 2, markHeight / 2);
82
- ctx.rotate(Math.PI / 180 * Number(rotate));
83
- var img = canvas.createImage();
84
- img.crossOrigin = 'anonymous';
85
- img.referrerPolicy = 'no-referrer';
86
- img.src = image;
87
- img.onload = function () {
88
- ctx.drawImage(img, -imageWidth * ratio / 2, -imageHeight * ratio / 2, imageWidth * ratio, imageHeight * ratio);
89
- ctx.restore();
85
+ if (ctx) {
86
+ if (image) {
87
+ ctx.translate(markWidth / 2, markHeight / 2);
88
+ ctx.rotate(Math.PI / 180 * Number(rotate));
89
+ var img;
90
+ if (process.env.TARO_ENV === 'h5') {
91
+ img = new Image();
92
+ } else {
93
+ img = canvas.createImage();
94
+ }
95
+ img.crossOrigin = 'anonymous';
96
+ img.referrerPolicy = 'no-referrer';
97
+ img.src = image;
98
+ img.onload = function () {
99
+ ctx.drawImage(img, -imageWidth * ratio / 2, -imageHeight * ratio / 2, imageWidth * ratio, imageHeight * ratio);
100
+ ctx.restore();
101
+ setBase64Url(canvas.toDataURL());
102
+ };
103
+ } else if (content) {
104
+ ctx.textBaseline = 'middle'; // 设置或返回在绘制文本时使用的当前文本基线。(正中)
105
+ ctx.textAlign = 'center'; // 设置或返回文本内容的当前对齐方式。
106
+ // 文字绕中间旋转
107
+ ctx.translate(markWidth / 2, markHeight / 2);
108
+ ctx.rotate(Math.PI / 180 * Number(rotate));
109
+ var markSize = Number(fontSize) * ratio;
110
+ ctx.font = "".concat(fontStyle, " normal ").concat(fontWeight, " ").concat(markSize, "px/").concat(markHeight, "px ").concat(fontFamily);
111
+ ctx.fillStyle = fontColor;
112
+ ctx.fillText(content, 0, 0); // 在画布上绘制"被填充的"文本。
113
+ ctx.restore(); // 返回之前保存过的路径状态和属性。
90
114
  setBase64Url(canvas.toDataURL());
91
- };
92
- } else if (content) {
93
- ctx.textBaseline = 'middle'; // 设置或返回在绘制文本时使用的当前文本基线。(正中)
94
- ctx.textAlign = 'center'; // 设置或返回文本内容的当前对齐方式。
95
- // 文字绕中间旋转
96
- ctx.translate(markWidth / 2, markHeight / 2);
97
- ctx.rotate(Math.PI / 180 * Number(rotate));
98
- var markSize = Number(fontSize) * ratio;
99
- ctx.font = "".concat(fontStyle, " normal ").concat(fontWeight, " ").concat(markSize, "px/").concat(markHeight, "px ").concat(fontFamily);
100
- ctx.fillStyle = fontColor;
101
- ctx.fillText(content, 0, 0); // 在画布上绘制"被填充的"文本。
102
- ctx.restore(); // 返回之前保存过的路径状态和属性。
103
- setBase64Url(canvas.toDataURL());
115
+ }
116
+ } else {
117
+ throw new Error(locale.watermark.errorCanvasTips);
104
118
  }
105
- } else {
106
- throw new Error(locale.watermark.errorCanvasTips);
107
- }
119
+ });
108
120
  };
109
121
  return React__default.createElement("div", {
110
122
  className: cls,
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v1.4.2-beta.0 Wed Jan 04 2023 15:06:39 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v1.4.3-beta.0 Wed Jan 11 2023 14:53:33 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v1.4.2-beta.0 Wed Jan 04 2023 15:06:39 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v1.4.3-beta.0 Wed Jan 11 2023 14:53:33 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v1.4.2-beta.0 Wed Jan 04 2023 15:06:39 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v1.4.3-beta.0 Wed Jan 11 2023 14:53:33 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v1.4.2-beta.0 Wed Jan 04 2023 15:06:39 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v1.4.3-beta.0 Wed Jan 11 2023 14:53:33 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v1.4.2-beta.0 Wed Jan 04 2023 15:06:39 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v1.4.3-beta.0 Wed Jan 11 2023 14:53:33 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v1.4.2-beta.0 Wed Jan 04 2023 15:06:39 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v1.4.3-beta.0 Wed Jan 11 2023 14:53:33 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */