@nutui/nutui-react-taro 2.0.16 → 2.0.17

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 (85) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/esm/Address.js +2 -2
  3. package/dist/esm/Audio.js +3 -3
  4. package/dist/esm/Avatar.js +1 -1
  5. package/dist/esm/Cascader.js +1 -1
  6. package/dist/esm/DatePicker.js +3 -3
  7. package/dist/esm/Ellipsis.js +2 -2
  8. package/dist/esm/Form/style/style.css +1 -1
  9. package/dist/esm/Form.js +53 -3
  10. package/dist/esm/FormItem/style/style.css +1 -1
  11. package/dist/esm/FormItem.js +1 -1
  12. package/dist/esm/InputNumber.js +1 -1
  13. package/dist/esm/Menu.js +3 -3
  14. package/dist/esm/MenuItem.js +2 -2
  15. package/dist/esm/NoticeBar.js +3 -2
  16. package/dist/esm/Picker.js +2 -2
  17. package/dist/esm/Popover.js +2 -2
  18. package/dist/esm/PullToRefresh.js +1 -1
  19. package/dist/esm/Range.js +3 -2
  20. package/dist/esm/Skeleton.js +2 -2
  21. package/dist/esm/Sticky.js +2 -2
  22. package/dist/esm/Swipe.js +2 -2
  23. package/dist/esm/Table.js +1 -1
  24. package/dist/esm/Toast.js +2 -1
  25. package/dist/esm/Tour.js +3 -3
  26. package/dist/esm/TrendArrow.js +1 -1
  27. package/dist/esm/VirtualList.js +1 -1
  28. package/dist/esm/{address.taro-6d420871.js → address.taro-319deb0d.js} +1 -1
  29. package/dist/esm/{audio.taro-ef39c1d9.js → audio.taro-f0ec6410.js} +2 -3
  30. package/dist/esm/{avatar.taro-47abbb9f.js → avatar.taro-0e574535.js} +1 -1
  31. package/dist/esm/{cascader.taro-01ffbfb1.js → cascader.taro-8d41895a.js} +2 -1
  32. package/dist/esm/{datepicker.taro-288d64bb.js → datepicker.taro-4da6a538.js} +1 -1
  33. package/dist/esm/{ellipsis.taro-21b13b31.js → ellipsis.taro-cd36ab2d.js} +4 -4
  34. package/dist/esm/{formitem.taro-bb63ac0a.js → formitem.taro-d69dce1e.js} +28 -10
  35. package/dist/esm/{use-client-rect-2bb6c562.js → get-rect-by-taro-fe02fe2b.js} +21 -3
  36. package/dist/esm/{inputnumber.taro-2f6f30d7.js → inputnumber.taro-d2fc26bd.js} +2 -2
  37. package/dist/esm/{menu.taro-4cde3e7f.js → menu.taro-0727ce5f.js} +1 -1
  38. package/dist/esm/{menuitem.taro-8a60a655.js → menuitem.taro-a4d83b53.js} +1 -1
  39. package/dist/esm/{noticebar.taro-d95c13b6.js → noticebar.taro-4e1d882b.js} +2 -2
  40. package/dist/esm/nutui-react.es.js +24 -24
  41. package/dist/esm/{picker.taro-0770a67f.js → picker.taro-47d1c716.js} +4 -4
  42. package/dist/esm/{popover.taro-7a482b85.js → popover.taro-43e96169.js} +1 -1
  43. package/dist/esm/{pulltorefresh.taro-d35571e8.js → pulltorefresh.taro-f3ab76c2.js} +4 -6
  44. package/dist/esm/{range.taro-fbbf5522.js → range.taro-4028c748.js} +1 -1
  45. package/dist/esm/{skeleton.taro-1896ff37.js → skeleton.taro-1f829d87.js} +1 -1
  46. package/dist/esm/{sticky.taro-2d78a04e.js → sticky.taro-dbacaf76.js} +1 -1
  47. package/dist/esm/{swipe.taro-2fa2479c.js → swipe.taro-385eece1.js} +1 -1
  48. package/dist/esm/{table.taro-072907bf.js → table.taro-a7dcb564.js} +5 -5
  49. package/dist/esm/{toast.taro-44ebc833.js → toast.taro-50ee73e6.js} +30 -19
  50. package/dist/esm/{tour.taro-3299d7a2.js → tour.taro-5185292f.js} +1 -1
  51. package/dist/esm/{trendarrow.taro-53d6e250.js → trendarrow.taro-e6b635ae.js} +1 -1
  52. package/dist/esm/types/src/packages/cascader/cascader.d.ts +2 -1
  53. package/dist/esm/types/src/packages/cascader/cascader.taro.d.ts +2 -1
  54. package/dist/esm/types/src/packages/form/types.d.ts +1 -0
  55. package/dist/esm/types/src/packages/formitem/formitem.d.ts +1 -0
  56. package/dist/esm/types/src/packages/formitem/formitem.taro.d.ts +1 -0
  57. package/dist/esm/types/src/packages/table/types.d.ts +1 -1
  58. package/dist/esm/types/src/packages/toast/toast.taro.d.ts +3 -6
  59. package/dist/esm/types/src/packages/virtuallist/utils.d.ts +1 -1
  60. package/dist/esm/types/src/utils/get-rect-by-taro.d.ts +12 -0
  61. package/dist/esm/types/src/utils/use-client-rect.d.ts +3 -9
  62. package/dist/esm/types/src/utils/use-uuid.d.ts +1 -0
  63. package/dist/esm/{virtuallist.taro-e552d954.js → virtuallist.taro-c75a4e71.js} +2 -2
  64. package/dist/locales/base.js +1 -1
  65. package/dist/locales/en-US.js +1 -1
  66. package/dist/locales/id-ID.js +1 -1
  67. package/dist/locales/tr-TR.js +1 -1
  68. package/dist/locales/zh-CN.js +1 -1
  69. package/dist/locales/zh-TW.js +1 -1
  70. package/dist/locales/zh-UG.js +1 -1
  71. package/dist/nutui.react.es.js +187 -78
  72. package/dist/nutui.react.umd.js +186 -77
  73. package/dist/packages/form/form.scss +9 -1
  74. package/dist/packages/formitem/formitem.scss +0 -11
  75. package/dist/style.css +1 -1
  76. package/dist/style.mjs +1 -1
  77. package/dist/types/packages/cascader/cascader.taro.d.ts +2 -1
  78. package/dist/types/packages/form/types.d.ts +1 -0
  79. package/dist/types/packages/formitem/formitem.taro.d.ts +5 -0
  80. package/dist/types/packages/table/types.d.ts +1 -1
  81. package/dist/types/packages/toast/toast.taro.d.ts +3 -6
  82. package/dist/types/packages/virtuallist/utils.d.ts +1 -1
  83. package/dist/types/utils/get-rect-by-taro.d.ts +12 -0
  84. package/dist/types/utils/use-client-rect.d.ts +3 -9
  85. package/package.json +1 -1
@@ -1,3 +1,5 @@
1
+ import { createSelectorQuery } from "@tarojs/taro";
2
+ const inBrowser = typeof document !== "undefined" && !!document.scripts;
1
3
  function isWindow(val) {
2
4
  return val === window;
3
5
  }
@@ -27,12 +29,28 @@ const getRect = (elementRef) => {
27
29
  height: 0
28
30
  };
29
31
  };
32
+ function makeRect(width, height) {
33
+ return {
34
+ top: 0,
35
+ left: 0,
36
+ right: width,
37
+ bottom: height,
38
+ width,
39
+ height
40
+ };
41
+ }
30
42
  const getRectByTaro = async (element) => {
31
43
  if (element) {
32
- const res = await element.getBoundingClientRect();
33
- return res;
44
+ if (inBrowser) {
45
+ return Promise.resolve(getRect(element));
46
+ }
47
+ return new Promise((resolve, reject) => {
48
+ createSelectorQuery().select(`#${element.uid}`).boundingClientRect().exec(([rects]) => {
49
+ resolve(rects);
50
+ });
51
+ });
34
52
  }
35
- return Promise.resolve({});
53
+ return Promise.resolve(makeRect(0, 0));
36
54
  };
37
55
  export {
38
56
  getRect as a,
@@ -118,7 +118,7 @@ const InputNumber = (props) => {
118
118
  };
119
119
  const changeFormatValue = (e) => {
120
120
  const input = e.target.value;
121
- const numReg = new RegExp("^[0-9]*$");
121
+ const numReg = /^[0-9]*$/;
122
122
  const numValue = input.replace(/[^0-9|.]/gi, "");
123
123
  if (formatter) {
124
124
  if (!numReg.test(input[0]) && numValue) {
@@ -137,7 +137,7 @@ const InputNumber = (props) => {
137
137
  };
138
138
  const burFormatValue = (e) => {
139
139
  const input = e.target.value;
140
- const numReg = new RegExp("^[0-9]*$");
140
+ const numReg = /^[0-9]*$/;
141
141
  const numValue = input.replace(/[^0-9|.]/gi, "");
142
142
  if (formatter) {
143
143
  if (formatter(numValue) === input) {
@@ -1,7 +1,7 @@
1
1
  import React__default, { useRef, useState, useEffect } from "react";
2
2
  import classNames from "classnames";
3
3
  import { ArrowUp2, ArrowDown2 } from "@nutui/icons-react-taro";
4
- import { M as MenuItem } from "./menuitem.taro-8a60a655.js";
4
+ import { M as MenuItem } from "./menuitem.taro-a4d83b53.js";
5
5
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
6
6
  const defaultProps = {
7
7
  ...ComponentDefaults,
@@ -5,7 +5,7 @@ import { View } from "@tarojs/components";
5
5
  import { CSSTransition } from "react-transition-group";
6
6
  import { Check } from "@nutui/icons-react-taro";
7
7
  import { O as Overlay } from "./overlay.taro-626840fc.js";
8
- import { g as getRectByTaro } from "./use-client-rect-2bb6c562.js";
8
+ import { g as getRectByTaro } from "./get-rect-by-taro-fe02fe2b.js";
9
9
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
10
10
  const defaultProps = {
11
11
  ...ComponentDefaults,
@@ -1,7 +1,7 @@
1
1
  import React__default, { useRef, useState, useMemo, useEffect } from "react";
2
2
  import { Notice, Close } from "@nutui/icons-react-taro";
3
3
  import classNames from "classnames";
4
- import { g as getRectByTaro } from "./use-client-rect-2bb6c562.js";
4
+ import { g as getRectByTaro } from "./get-rect-by-taro-fe02fe2b.js";
5
5
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
6
6
  const defaultProps = {
7
7
  ...ComponentDefaults,
@@ -265,7 +265,7 @@ const NoticeBar = (props) => {
265
265
  const getStyle = (moveOffset = offset) => {
266
266
  const target = innerRef.current;
267
267
  let _offset = 0;
268
- const val = (rect == null ? void 0 : rect.height) - height;
268
+ const val = ((rect == null ? void 0 : rect.height) || 0) - height;
269
269
  _offset = moveOffset + Number(active === childCount - 1 && val / 2);
270
270
  target.style.transitionDuration = `${swiperRef.current.moving ? 0 : duration}ms`;
271
271
  target.style.height = `${Number(height) * childCount}px`;
@@ -11,7 +11,7 @@ import { G as G2 } from "./griditem.taro-b7abc653.js";
11
11
  import { L } from "./layout.taro-7711a89c.js";
12
12
  import { R } from "./row.taro-a71fbf76.js";
13
13
  import { S } from "./space.taro-a7e4ced4.js";
14
- import { S as S2 } from "./sticky.taro-2d78a04e.js";
14
+ import { S as S2 } from "./sticky.taro-dbacaf76.js";
15
15
  import { B as B2 } from "./backtop.taro-61b1eeaf.js";
16
16
  import { E } from "./elevator.taro-cdf3dba7.js";
17
17
  import { F } from "./fixednav.taro-0d998d65.js";
@@ -23,22 +23,22 @@ import { T } from "./tabbar.taro-4397646a.js";
23
23
  import { T as T2 } from "./tabbaritem.taro-1d27af28.js";
24
24
  import { T as T3 } from "./tabpane.taro-d0eea168.js";
25
25
  import { T as T4 } from "./tabs.taro-3ece2221.js";
26
- import { A } from "./address.taro-6d420871.js";
26
+ import { A } from "./address.taro-319deb0d.js";
27
27
  import { C as C5 } from "./calendar.taro-c8ddf452.js";
28
28
  import { C as C6 } from "./calendaritem.taro-0bd17638.js";
29
- import { C as C7 } from "./cascader.taro-01ffbfb1.js";
29
+ import { C as C7 } from "./cascader.taro-8d41895a.js";
30
30
  import { C as C8, a } from "./checkbox.taro-22cd35c4.js";
31
- import { D as D2 } from "./datepicker.taro-288d64bb.js";
31
+ import { D as D2 } from "./datepicker.taro-4da6a538.js";
32
32
  import { default as default2 } from "./Form.js";
33
- import { F as F2 } from "./formitem.taro-bb63ac0a.js";
33
+ import { F as F2 } from "./formitem.taro-d69dce1e.js";
34
34
  import { I as I2 } from "./input.taro-fbcb7090.js";
35
- import { I as I3 } from "./inputnumber.taro-2f6f30d7.js";
36
- import { M } from "./menu.taro-4cde3e7f.js";
37
- import { M as M2 } from "./menuitem.taro-8a60a655.js";
35
+ import { I as I3 } from "./inputnumber.taro-d2fc26bd.js";
36
+ import { M } from "./menu.taro-0727ce5f.js";
37
+ import { M as M2 } from "./menuitem.taro-a4d83b53.js";
38
38
  import { N as N2 } from "./numberkeyboard.taro-f19c44a8.js";
39
- import { P } from "./picker.taro-0770a67f.js";
39
+ import { P } from "./picker.taro-47d1c716.js";
40
40
  import { R as R2, a as a2 } from "./radio.taro-d1d370be.js";
41
- import { R as R3 } from "./range.taro-fbbf5522.js";
41
+ import { R as R3 } from "./range.taro-4028c748.js";
42
42
  import { R as R4 } from "./rate.taro-61bbf5a7.js";
43
43
  import { S as S6 } from "./searchbar.taro-7daf43fc.js";
44
44
  import { S as S7 } from "./shortpassword.taro-86563915.js";
@@ -53,24 +53,24 @@ import { D as D3 } from "./drag.taro-ce333e51.js";
53
53
  import { E as E2 } from "./empty.taro-05f15f93.js";
54
54
  import { I as I4 } from "./infiniteloading.taro-cb3b949e.js";
55
55
  import { L as L2 } from "./loading.taro-0799622f.js";
56
- import { N as N3 } from "./noticebar.taro-d95c13b6.js";
56
+ import { N as N3 } from "./noticebar.taro-4e1d882b.js";
57
57
  import { N as N4 } from "./notify.taro-6798c31f.js";
58
- import { P as P2 } from "./popover.taro-7a482b85.js";
58
+ import { P as P2 } from "./popover.taro-43e96169.js";
59
59
  import { P as P3 } from "./popup.taro-487eb86e.js";
60
- import { P as P4 } from "./pulltorefresh.taro-d35571e8.js";
61
- import { S as S10 } from "./skeleton.taro-1896ff37.js";
62
- import { S as S11 } from "./swipe.taro-2fa2479c.js";
63
- import { T as T6 } from "./toast.taro-44ebc833.js";
60
+ import { P as P4 } from "./pulltorefresh.taro-f3ab76c2.js";
61
+ import { S as S10 } from "./skeleton.taro-1f829d87.js";
62
+ import { S as S11 } from "./swipe.taro-385eece1.js";
63
+ import { T as T6 } from "./toast.taro-50ee73e6.js";
64
64
  import { A as A3 } from "./animate.taro-37bf4eab.js";
65
65
  import { default as default3 } from "./AnimatingNumbers.js";
66
- import { A as A4 } from "./audio.taro-ef39c1d9.js";
67
- import { A as A5 } from "./avatar.taro-47abbb9f.js";
66
+ import { A as A4 } from "./audio.taro-f0ec6410.js";
67
+ import { A as A5 } from "./avatar.taro-0e574535.js";
68
68
  import { A as A6 } from "./avatargroup.taro-1f8b7174.js";
69
69
  import { C as C9 } from "./circleprogress.taro-417e1d3f.js";
70
70
  import { C as C10 } from "./collapse.taro-4a3e417c.js";
71
71
  import { C as C11 } from "./collapseitem.taro-e99fb1a2.js";
72
72
  import { C as C12 } from "./countdown.taro-7caa9578.js";
73
- import { E as E3 } from "./ellipsis.taro-21b13b31.js";
73
+ import { E as E3 } from "./ellipsis.taro-cd36ab2d.js";
74
74
  import { I as I5 } from "./imagepreview.taro-bc96904b.js";
75
75
  import { I as I6 } from "./indicator.taro-4ed0d6da.js";
76
76
  import { P as P5 } from "./pagination.taro-47fad28d.js";
@@ -80,16 +80,16 @@ import { S as S12 } from "./step.taro-dd522794.js";
80
80
  import { S as S13 } from "./steps.taro-0680ae4f.js";
81
81
  import { default as default4 } from "./Swiper.js";
82
82
  import { S as S14 } from "./swiperitem.taro-da39a67b.js";
83
- import { T as T7 } from "./table.taro-072907bf.js";
83
+ import { T as T7 } from "./table.taro-a7dcb564.js";
84
84
  import { T as T8 } from "./tag.taro-518b9c70.js";
85
- import { T as T9 } from "./tour.taro-3299d7a2.js";
85
+ import { T as T9 } from "./tour.taro-5185292f.js";
86
86
  import { V } from "./video.taro-672ca6b8.js";
87
- import { V as V2 } from "./virtuallist.taro-e552d954.js";
87
+ import { V as V2 } from "./virtuallist.taro-c75a4e71.js";
88
88
  import { B as B5 } from "./barrage.taro-d77c34b4.js";
89
89
  import { C as C13 } from "./card.taro-c0e9cfba.js";
90
90
  import { T as T10 } from "./timedetail.taro-958b8c07.js";
91
91
  import { T as T11 } from "./timeselect.taro-6e9fc4d4.js";
92
- import { T as T12 } from "./trendarrow.taro-53d6e250.js";
92
+ import { T as T12 } from "./trendarrow.taro-e6b635ae.js";
93
93
  import { W } from "./watermark.taro-311b59d2.js";
94
94
  import "react";
95
95
  import "classnames";
@@ -100,7 +100,7 @@ import "./index-21e61675.js";
100
100
  import "@tarojs/components";
101
101
  import "react-transition-group";
102
102
  import "./UserContext-ab42ba7f.js";
103
- import "./use-client-rect-2bb6c562.js";
103
+ import "./get-rect-by-taro-fe02fe2b.js";
104
104
  import "./can-use-dom-0e539bd3.js";
105
105
  import "./context-f32a9246.js";
106
106
  import "./use-props-value-c78cbf9b.js";
@@ -4,7 +4,7 @@ import Taro from "@tarojs/taro";
4
4
  import { View, PickerView, PickerViewColumn } from "@tarojs/components";
5
5
  import { P as Popup } from "./popup.taro-487eb86e.js";
6
6
  import { u as useTouch } from "./use-touch-ff43512c.js";
7
- import { g as getRectByTaro } from "./use-client-rect-2bb6c562.js";
7
+ import { g as getRectByTaro } from "./get-rect-by-taro-fe02fe2b.js";
8
8
  import { c as canUseDom } from "./can-use-dom-0e539bd3.js";
9
9
  import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
10
10
  import { u as usePropsValue } from "./use-props-value-c78cbf9b.js";
@@ -48,7 +48,7 @@ const InternalPickerPanel = (props, ref) => {
48
48
  }
49
49
  return false;
50
50
  };
51
- const setTransform = (translateY = 0, type, time = DEFAULT_DURATION, deg) => {
51
+ const setTransform = (type, deg, time = DEFAULT_DURATION, translateY = 0) => {
52
52
  let nTime = time;
53
53
  if (type !== "end") {
54
54
  nTime = 0;
@@ -68,7 +68,7 @@ const InternalPickerPanel = (props, ref) => {
68
68
  }
69
69
  const endMove = Math.round(updateMove / lineSpacing.current) * lineSpacing.current;
70
70
  const deg = `${(Math.abs(Math.round(endMove / lineSpacing.current)) + 1) * rotation}deg`;
71
- setTransform(endMove, type, time, deg);
71
+ setTransform(type, deg, time, endMove);
72
72
  setCurrIndex(Math.abs(Math.round(endMove / lineSpacing.current)) + 1);
73
73
  } else {
74
74
  let deg = 0;
@@ -77,7 +77,7 @@ const InternalPickerPanel = (props, ref) => {
77
77
  const minDeg = 0;
78
78
  deg = Math.min(Math.max(currentDeg, minDeg), maxDeg);
79
79
  if (minDeg < deg && deg < maxDeg) {
80
- setTransform(updateMove, "", void 0, `${deg}deg`);
80
+ setTransform("", `${deg}deg`, void 0, updateMove);
81
81
  setCurrIndex(Math.abs(Math.round(updateMove / lineSpacing.current)) + 1);
82
82
  }
83
83
  }
@@ -2,7 +2,7 @@ import React__default, { useRef, useState, useEffect } from "react";
2
2
  import classNames from "classnames";
3
3
  import Taro, { createSelectorQuery } from "@tarojs/taro";
4
4
  import { P as Popup } from "./popup.taro-487eb86e.js";
5
- import { a as getRect, g as getRectByTaro } from "./use-client-rect-2bb6c562.js";
5
+ import { a as getRect, g as getRectByTaro } from "./get-rect-by-taro-fe02fe2b.js";
6
6
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
7
7
  const defaultProps = {
8
8
  ...ComponentDefaults,
@@ -76,7 +76,6 @@ const PullToRefresh = (p) => {
76
76
  };
77
77
  const handleTouchStart = (e) => {
78
78
  touch.start(e);
79
- pullingRef.current = true;
80
79
  };
81
80
  const handleTouchMove = (e) => {
82
81
  if (props.scrollTop > 0) {
@@ -85,12 +84,11 @@ const PullToRefresh = (p) => {
85
84
  if (status === "refreshing" || status === "complete")
86
85
  return;
87
86
  touch.move(e);
88
- if (e.cancelable) {
89
- e.preventDefault();
87
+ if (touch.isVertical()) {
88
+ pullingRef.current = true;
89
+ setHeight(Math.max(rubberbandIfOutOfBounds(touch.deltaY, 0, 0, headHeight * 5, 0.5), 0));
90
+ setStatus(height > threshold ? "canRelease" : "pulling");
90
91
  }
91
- e.stopPropagation();
92
- setHeight(Math.max(rubberbandIfOutOfBounds(touch.deltaY, 0, 0, headHeight * 5, 0.5), 0));
93
- setStatus(height > threshold ? "canRelease" : "pulling");
94
92
  };
95
93
  async function doRefresh() {
96
94
  setHeight(headHeight);
@@ -2,9 +2,9 @@ import React__default, { useState, useRef, useEffect, useCallback } from "react"
2
2
  import classNames from "classnames";
3
3
  import { View } from "@tarojs/components";
4
4
  import { u as useTouch } from "./use-touch-ff43512c.js";
5
- import { g as getRectByTaro } from "./use-client-rect-2bb6c562.js";
6
5
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
7
6
  import { u as usePropsValue } from "./use-props-value-c78cbf9b.js";
7
+ import { g as getRectByTaro } from "./get-rect-by-taro-fe02fe2b.js";
8
8
  const defaultProps = {
9
9
  ...ComponentDefaults,
10
10
  range: false,
@@ -1,6 +1,6 @@
1
1
  import React__default from "react";
2
2
  import classNames from "classnames";
3
- import { A as Avatar } from "./avatar.taro-47abbb9f.js";
3
+ import { A as Avatar } from "./avatar.taro-0e574535.js";
4
4
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
5
5
  const defaultProps = {
6
6
  ...ComponentDefaults,
@@ -2,7 +2,7 @@ import React__default, { useRef, useEffect, useState, useMemo, useCallback } fro
2
2
  import classNames from "classnames";
3
3
  import { getEnv, usePageScroll, getSystemInfoSync } from "@tarojs/taro";
4
4
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
5
- import { g as getRectByTaro } from "./use-client-rect-2bb6c562.js";
5
+ import { g as getRectByTaro } from "./get-rect-by-taro-fe02fe2b.js";
6
6
  import { c as canUseDom } from "./can-use-dom-0e539bd3.js";
7
7
  function useWatch(dep, callback, config = { immediate: false }) {
8
8
  const { immediate } = config;
@@ -3,7 +3,7 @@ import classNames from "classnames";
3
3
  import { View } from "@tarojs/components";
4
4
  import { useReady, nextTick } from "@tarojs/taro";
5
5
  import { u as useTouch } from "./use-touch-ff43512c.js";
6
- import { g as getRectByTaro } from "./use-client-rect-2bb6c562.js";
6
+ import { g as getRectByTaro } from "./get-rect-by-taro-fe02fe2b.js";
7
7
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
8
8
  function preventDefault(event, isStopPropagation) {
9
9
  if (typeof event.cancelable !== "boolean" || event.cancelable) {
@@ -65,14 +65,14 @@ const Table = (props) => {
65
65
  return [columns2.key, columns2.render];
66
66
  });
67
67
  };
68
- const renderBodyTds = (item) => {
69
- return sortDataItem().map(([value, render], index) => {
70
- return React__default.createElement("span", { className: classNames(`${bodyClassPrefix}__td`, cellClasses(getColumnItem(value))), key: value }, typeof item[value] === "function" || typeof render === "function" ? React__default.createElement("div", null, render ? render(item) : item[value](item)) : item[value]);
68
+ const renderBodyTds = (item, rowIndex) => {
69
+ return sortDataItem().map(([value, render]) => {
70
+ return React__default.createElement("span", { className: classNames(`${bodyClassPrefix}__td`, cellClasses(getColumnItem(value))), key: value }, typeof item[value] === "function" || typeof render === "function" ? React__default.createElement("div", null, render ? render(item, rowIndex) : item[value](item)) : item[value]);
71
71
  });
72
72
  };
73
73
  const renderBoyTrs = () => {
74
- return curData.map((item, index) => {
75
- return React__default.createElement("div", { className: bodyClassPrefix, key: index }, renderBodyTds(item));
74
+ return curData.map((item, rowIndex) => {
75
+ return React__default.createElement("div", { className: bodyClassPrefix, key: rowIndex }, renderBodyTds(item, rowIndex));
76
76
  });
77
77
  };
78
78
  return React__default.createElement(
@@ -1,9 +1,10 @@
1
- import React__default, { useState, useEffect } from "react";
1
+ import React__default, { useRef, useEffect } from "react";
2
2
  import classNames from "classnames";
3
3
  import { Success, Failure, Tips, Loading } from "@nutui/icons-react-taro";
4
4
  import { O as Overlay } from "./overlay.taro-626840fc.js";
5
5
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
6
6
  import { u as useParams, a as useCustomEvent, b as useCustomEventsPath, c as customEvents } from "./use-custom-event-bb9c7f2e.js";
7
+ import { u as usePropsValue } from "./use-props-value-c78cbf9b.js";
7
8
  const defaultProps = {
8
9
  ...ComponentDefaults,
9
10
  id: "",
@@ -25,39 +26,49 @@ const defaultProps = {
25
26
  };
26
27
  const classPrefix = "nut-toast";
27
28
  const Toast = (props) => {
28
- const { params: { id, position, contentStyle, icon, iconSize, msg, duration, type, title, closeOnOverlayClick, lockScroll, contentClassName, size, visible, className, style, onClose }, setParams } = useParams({ ...defaultProps, ...props });
29
- let timer;
30
- const [openState, SetOpenState] = useState(false);
29
+ const { params: { id, position, contentStyle, icon, iconSize, msg, duration, type, title, closeOnOverlayClick, lockScroll, contentClassName, visible, size, className, style, onClose }, setParams } = useParams({ ...defaultProps, ...props });
30
+ const timer = useRef(-1);
31
+ const [innerVisible, setInnerVisible] = usePropsValue({
32
+ value: visible,
33
+ defaultValue: void 0,
34
+ finalValue: false,
35
+ onChange: (v) => {
36
+ !v && (onClose == null ? void 0 : onClose());
37
+ }
38
+ });
31
39
  useEffect(() => {
32
- if (visible) {
33
- show2();
34
- } else {
35
- hide2();
40
+ if (innerVisible) {
41
+ autoClose();
36
42
  }
37
- }, [visible]);
43
+ }, [innerVisible, duration]);
38
44
  useCustomEvent(id, ({ status, options }) => {
39
45
  if (status) {
46
+ options.visible = true;
40
47
  setParams(options);
41
48
  show2();
42
49
  } else {
50
+ setParams({ visible: false });
43
51
  hide2();
44
52
  }
45
53
  });
46
54
  const clearTimer = () => {
47
- if (timer) {
48
- clearTimeout(timer);
49
- timer = null;
55
+ if (timer.current) {
56
+ clearTimeout(timer.current);
57
+ timer.current = -1;
50
58
  }
51
59
  };
60
+ const show2 = () => {
61
+ setInnerVisible(true);
62
+ };
52
63
  const hide2 = () => {
53
- SetOpenState(false);
54
- onClose == null ? void 0 : onClose();
64
+ clearTimer();
65
+ setInnerVisible(false);
55
66
  };
56
- const show2 = () => {
67
+ const autoClose = () => {
57
68
  clearTimer();
58
- SetOpenState(true);
59
69
  if (duration) {
60
- timer = window.setTimeout(() => {
70
+ timer.current = window.setTimeout(() => {
71
+ setParams({ visible: false });
61
72
  hide2();
62
73
  }, duration * 1e3);
63
74
  }
@@ -88,9 +99,9 @@ const Toast = (props) => {
88
99
  "nut-toast-has-icon": icon,
89
100
  [`nut-toast-${size}`]: true
90
101
  });
91
- return React__default.createElement(React__default.Fragment, null, openState ? React__default.createElement(
102
+ return React__default.createElement(React__default.Fragment, null, innerVisible ? React__default.createElement(
92
103
  Overlay,
93
- { visible: openState, style, className: `${classPrefix}__overlay-default ${className}`, closeOnOverlayClick, lockScroll, onClick: () => {
104
+ { visible: innerVisible, style, className: `${classPrefix}__overlay-default ${className}`, closeOnOverlayClick, lockScroll, onClick: () => {
94
105
  clickCover();
95
106
  } },
96
107
  React__default.createElement(
@@ -1,7 +1,7 @@
1
1
  import React__default, { useState, useEffect } from "react";
2
2
  import { Close } from "@nutui/icons-react-taro";
3
3
  import classNames from "classnames";
4
- import { P as Popover } from "./popover.taro-7a482b85.js";
4
+ import { P as Popover } from "./popover.taro-43e96169.js";
5
5
  import Taro from "@tarojs/taro";
6
6
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
7
7
  import { useConfig } from "./ConfigProvider.js";
@@ -24,7 +24,7 @@ const TrendArrow = (props) => {
24
24
  return console.warn(`传入的值:${num}不是一个数字`);
25
25
  }
26
26
  num = parseFloat(num);
27
- const numPow = Math.pow(10, digit);
27
+ const numPow = 10 ** digit;
28
28
  return (Math.round((num + Number.EPSILON) * numPow) / numPow).toFixed(digit);
29
29
  };
30
30
  const calcStyle = (() => {
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { PopupProps } from '@/packages/popup/popup';
3
3
  import { CascaderOption, CascaderValue, CascaderOptionKey } from './types';
4
- export interface CascaderProps extends PopupProps {
4
+ export interface CascaderProps extends Pick<PopupProps, 'className' | 'style' | 'closeIcon' | 'closeable' | 'title' | 'left' | 'closeIconPosition' | 'onClose'> {
5
5
  popup: boolean;
6
+ popupProps: Partial<Omit<PopupProps, 'closeIcon' | 'closeable' | 'title' | 'left' | 'closeIconPosition' | 'onClose'>>;
6
7
  visible: boolean;
7
8
  activeColor: string;
8
9
  activeIcon: string;
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { PopupProps } from '@/packages/popup/popup.taro';
3
3
  import { CascaderOption, CascaderValue, CascaderOptionKey } from './types';
4
- export interface CascaderProps extends PopupProps {
4
+ export interface CascaderProps extends Pick<PopupProps, 'className' | 'style' | 'closeIcon' | 'closeable' | 'title' | 'left' | 'closeIconPosition' | 'onClose'> {
5
5
  popup: boolean;
6
+ popupProps: Partial<Omit<PopupProps, 'closeIcon' | 'closeable' | 'title' | 'left' | 'closeIconPosition' | 'onClose'>>;
6
7
  visible: boolean;
7
8
  activeColor: string;
8
9
  activeIcon: string;
@@ -17,6 +17,7 @@ export interface Store {
17
17
  export interface FormInstance<Values = any> {
18
18
  registerField: (entity: FieldEntity) => () => void;
19
19
  getFieldValue: (name: NamePath) => StoreValue;
20
+ getFieldsValue: (name: NamePath) => StoreValue;
20
21
  setInitialValues: (values: any, init: boolean) => void;
21
22
  setFieldsValue: (value: any) => void;
22
23
  resetFields: (fields?: NamePath[]) => void;
@@ -11,6 +11,7 @@ export interface FormItemProps extends BasicComponent, BaseFormField {
11
11
  getValueFromEvent: (...args: any) => any;
12
12
  onClick: (event: React.MouseEvent, componentRef: React.MutableRefObject<any>) => void;
13
13
  errorMessageAlign: TextAlign;
14
+ validateTrigger: string | string[];
14
15
  }
15
16
  export declare class FormItem extends React.Component<Partial<FormItemProps>, {
16
17
  resetCount: number;
@@ -11,6 +11,7 @@ export interface FormItemProps extends BasicComponent, BaseFormField {
11
11
  getValueFromEvent: (...args: any) => any;
12
12
  onClick: (event: React.MouseEvent, componentRef: React.MutableRefObject<any>) => void;
13
13
  errorMessageAlign: TextAlign;
14
+ validateTrigger: string | string[];
14
15
  }
15
16
  export declare class FormItem extends React.Component<Partial<FormItemProps>, {
16
17
  resetCount: number;
@@ -16,5 +16,5 @@ export interface TableColumnProps {
16
16
  title?: string;
17
17
  align?: string;
18
18
  sorter?: ((a: any, b: any) => number) | boolean | string;
19
- render?: (rowData?: any, rowIndex?: number) => string | React.ReactNode;
19
+ render?: (rowData: any, rowIndex: number) => string | React.ReactNode;
20
20
  }
@@ -1,6 +1,7 @@
1
1
  import React, { FunctionComponent } from 'react';
2
2
  import { BasicComponent } from '@/utils/typings';
3
3
  export type ToastPositionType = 'top' | 'bottom' | 'center';
4
+ export type ToastSize = 'small' | 'base' | 'large';
4
5
  export interface ToastProps extends BasicComponent {
5
6
  id?: string;
6
7
  maskClassName?: string;
@@ -15,7 +16,7 @@ export interface ToastProps extends BasicComponent {
15
16
  title: string;
16
17
  closeOnOverlayClick: boolean;
17
18
  lockScroll: boolean;
18
- size: string | number;
19
+ size: ToastSize;
19
20
  visible: boolean;
20
21
  onClose: () => void;
21
22
  }
@@ -23,11 +24,7 @@ export declare const Toast: FunctionComponent<Partial<ToastProps> & React.HTMLAt
23
24
  show: typeof show;
24
25
  hide: typeof hide;
25
26
  };
26
- export interface ToastOptions {
27
- title: string;
28
- msg?: string;
29
- type?: string;
30
- duration?: number;
27
+ export interface ToastOptions extends Partial<Omit<ToastProps, 'visible'>> {
31
28
  }
32
29
  export declare function show(selector: string, options: ToastOptions): void;
33
30
  export declare function hide(selector: string): void;
@@ -1,7 +1,7 @@
1
1
  import { PositionType, Data } from './type';
2
2
  declare const initPositinoCache: (reaItemSize: number, length?: number) => PositionType[];
3
3
  declare const getListTotalSize: (positions: Array<PositionType>, horizontal: true | false) => number;
4
- declare const binarySearch: (positionsList: Array<PositionType>, value: number | undefined, horizontal: true | false) => number;
4
+ declare const binarySearch: (positionsList: Array<PositionType>, horizontal: true | false, value?: number) => number;
5
5
  declare const getEndIndex: ({ list, startIndex, visibleCount, itemEqual, positions, offSetSize, overscan, sizeKey, }: {
6
6
  list: Array<Data>;
7
7
  startIndex: number;
@@ -0,0 +1,12 @@
1
+ export interface Rect {
2
+ dataset: Record<string, any>;
3
+ id: string;
4
+ top: number;
5
+ right: number;
6
+ bottom: number;
7
+ left: number;
8
+ width: number;
9
+ height: number;
10
+ }
11
+ export declare function makeRect(width: number, height: number): Rect;
12
+ export declare const getRectByTaro: (element: any) => Promise<Rect>;
@@ -1,3 +1,5 @@
1
+ export declare const inBrowser: boolean;
2
+ export declare function isWindow(val: unknown): val is Window;
1
3
  /**
2
4
  获取元素的大小及其相对于视口的位置,等价于 Element.getBoundingClientRect。
3
5
  width 宽度 number
@@ -7,12 +9,4 @@
7
9
  right 右侧与视图窗口左上角的距离 number
8
10
  bottom 底部与视图窗口左上角的距离 number
9
11
  */
10
- export declare const getRect: (elementRef: Element | Window | undefined) => DOMRect | {
11
- top: number;
12
- left: number;
13
- right: number;
14
- bottom: number;
15
- width: number;
16
- height: number;
17
- };
18
- export declare const getRectByTaro: (element: any) => Promise<any>;
12
+ export declare const getRect: (elementRef: Element | Window | undefined) => any;
@@ -0,0 +1 @@
1
+ export default function useUuid(): string;
@@ -19,7 +19,7 @@ const initPositinoCache = (reaItemSize, length = 0) => {
19
19
  }
20
20
  return positions;
21
21
  };
22
- const binarySearch = (positionsList, value = 0, horizontal) => {
22
+ const binarySearch = (positionsList, horizontal, value = 0) => {
23
23
  let start = 0;
24
24
  let end = positionsList.length - 1;
25
25
  let tempIndex = null;
@@ -149,7 +149,7 @@ const VirtualList = (props) => {
149
149
  const listScroll = (e) => {
150
150
  const scrollTop = e.detail ? e.detail.scrollTop : e.target.scrollTop;
151
151
  const scrollSize = Math.floor(scrollTop);
152
- const startIndex = binarySearch(positions, scrollSize, false);
152
+ const startIndex = binarySearch(positions, false, scrollSize);
153
153
  const overStart = startIndex - overscan > -1 ? startIndex - overscan : 0;
154
154
  const endIndex = end();
155
155
  if (!itemEqual) {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.0.16 Wed Sep 06 2023 15:52:38 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.17 Wed Sep 13 2023 17:18:36 GMT+0800 (中国标准时间)
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 v2.0.16 Wed Sep 06 2023 15:52:38 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.17 Wed Sep 13 2023 17:18:36 GMT+0800 (中国标准时间)
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 v2.0.16 Wed Sep 06 2023 15:52:38 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.17 Wed Sep 13 2023 17:18:36 GMT+0800 (中国标准时间)
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 v2.0.16 Wed Sep 06 2023 15:52:38 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.17 Wed Sep 13 2023 17:18:36 GMT+0800 (中国标准时间)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */