taro-react-uilib 1.3.2-2 → 1.3.2

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 (141) hide show
  1. package/CHANGELOG.md +5 -106
  2. package/dist/components/AmountKeyboard/index.js +1 -1
  3. package/dist/components/AmountKeyboard/index.js.map +1 -1
  4. package/dist/components/Button/index.js +1 -1
  5. package/dist/components/Button/index.js.map +1 -1
  6. package/dist/components/Captcha/index.js +1 -1
  7. package/dist/components/Captcha/index.js.map +1 -1
  8. package/dist/components/Dialog/Alert/index.js +1 -1
  9. package/dist/components/Dialog/Alert/index.js.map +1 -1
  10. package/dist/components/Dialog/Confirm/index.js +1 -1
  11. package/dist/components/Dialog/Confirm/index.js.map +1 -1
  12. package/dist/components/DialogComponent/index.js.map +1 -1
  13. package/dist/components/DialogRef/index.js +1 -1
  14. package/dist/components/DialogRef/index.js.map +1 -1
  15. package/dist/components/FormInput/index.js +1 -1
  16. package/dist/components/FormInput/index.js.map +1 -1
  17. package/dist/components/NumberKeyboard/index.js +1 -1
  18. package/dist/components/NumberKeyboard/index.js.map +1 -1
  19. package/dist/components/Radio/index.js +1 -1
  20. package/dist/components/Radio/index.js.map +1 -1
  21. package/dist/components/Step/Steps/index.js +1 -1
  22. package/dist/components/Step/Steps/index.js.map +1 -1
  23. package/dist/components/Step/index.js +1 -1
  24. package/dist/components/Step/index.js.map +1 -1
  25. package/dist/components/Tabbar/index.js.map +1 -1
  26. package/dist/components/Tabbar/tabbar/TabItem.js.map +1 -1
  27. package/dist/components/Tabbar/tabbar/Tabbar.js +1 -1
  28. package/dist/components/Tabbar/tabbar/Tabbar.js.map +1 -1
  29. package/dist/components/src/index.js +1 -1
  30. package/dist/index.js +6 -6
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.umd.js +6 -6
  33. package/dist/index.umd.js.map +1 -1
  34. package/dist/styles/components/amountinput.scss +6 -5
  35. package/dist/styles/components/amountkeyboard.scss +12 -30
  36. package/dist/styles/components/badge.scss +1 -0
  37. package/dist/styles/components/bankicon.scss +1 -1
  38. package/dist/styles/components/button.scss +5 -7
  39. package/dist/styles/components/captcha.scss +3 -9
  40. package/dist/styles/components/checkbox.scss +5 -4
  41. package/dist/styles/components/dialog.scss +14 -14
  42. package/dist/styles/components/dialogref.scss +30 -14
  43. package/dist/styles/components/font/iconfont.ttf +0 -0
  44. package/dist/styles/components/font/iconfont.woff +0 -0
  45. package/dist/styles/components/font/iconfont.woff2 +0 -0
  46. package/dist/styles/components/forminput.scss +28 -40
  47. package/dist/styles/components/icon.scss +14 -3
  48. package/dist/styles/components/images/backspace.png +0 -0
  49. package/dist/styles/components/images/closeKeyboard.png +0 -0
  50. package/dist/styles/components/images/icon-arrow-right.png +0 -0
  51. package/dist/styles/components/images/loading.png +0 -0
  52. package/dist/styles/components/index.scss +0 -5
  53. package/dist/styles/components/list.scss +5 -17
  54. package/dist/styles/components/loading.scss +9 -1
  55. package/dist/styles/components/mask.scss +1 -1
  56. package/dist/styles/components/navbar.scss +0 -1
  57. package/dist/styles/components/numberkeyboard.scss +36 -47
  58. package/dist/styles/components/page.scss +2 -2
  59. package/dist/styles/components/passwordinput.scss +1 -1
  60. package/dist/styles/components/picker.scss +1 -0
  61. package/dist/styles/components/popup.scss +3 -2
  62. package/dist/styles/components/progress.scss +2 -2
  63. package/dist/styles/components/radio.scss +6 -5
  64. package/dist/styles/components/step.scss +1 -9
  65. package/dist/styles/components/tabbar.scss +0 -3
  66. package/dist/styles/components/toast.scss +1 -0
  67. package/dist/styles/themes/default.scss +8 -17
  68. package/dist/styles/themes/variable.scss +0 -8
  69. package/lib/components/AmountKeyboard/index.js +9 -7
  70. package/lib/components/AmountKeyboard/index.js.map +1 -1
  71. package/lib/components/Button/index.js +2 -2
  72. package/lib/components/Button/index.js.map +1 -1
  73. package/lib/components/Captcha/index.js +2 -2
  74. package/lib/components/Captcha/index.js.map +1 -1
  75. package/lib/components/Dialog/Alert/index.js +3 -3
  76. package/lib/components/Dialog/Alert/index.js.map +1 -1
  77. package/lib/components/Dialog/Confirm/index.js +2 -2
  78. package/lib/components/Dialog/Confirm/index.js.map +1 -1
  79. package/lib/components/DialogComponent/index.js +2 -0
  80. package/lib/components/DialogComponent/index.js.map +1 -1
  81. package/lib/components/DialogRef/index.js +14 -6
  82. package/lib/components/DialogRef/index.js.map +1 -1
  83. package/lib/components/FormInput/index.js +2 -3
  84. package/lib/components/FormInput/index.js.map +1 -1
  85. package/lib/components/Icon/index.js +2 -3
  86. package/lib/components/Icon/index.js.map +1 -1
  87. package/lib/components/NumberKeyboard/index.js +2 -4
  88. package/lib/components/NumberKeyboard/index.js.map +1 -1
  89. package/lib/components/Radio/index.js +1 -1
  90. package/lib/components/Radio/index.js.map +1 -1
  91. package/lib/components/Step/Steps/index.js +0 -1
  92. package/lib/components/Step/Steps/index.js.map +1 -1
  93. package/lib/components/Step/index.js +1 -2
  94. package/lib/components/Step/index.js.map +1 -1
  95. package/lib/components/Tabbar/index.js +0 -1
  96. package/lib/components/Tabbar/index.js.map +1 -1
  97. package/lib/components/Tabbar/tabbar/TabItem.js +1 -0
  98. package/lib/components/Tabbar/tabbar/TabItem.js.map +1 -1
  99. package/lib/components/Tabbar/tabbar/Tabbar.js +8 -9
  100. package/lib/components/Tabbar/tabbar/Tabbar.js.map +1 -1
  101. package/lib/index.js +0 -6
  102. package/lib/index.js.map +1 -1
  103. package/package.json +1 -1
  104. package/types/components/AmountKeyboard/index.d.ts +1 -0
  105. package/types/components/Button/index.d.ts +1 -2
  106. package/types/components/Captcha/index.d.ts +1 -1
  107. package/types/components/DialogRef/index.d.ts +0 -2
  108. package/types/components/Icon/index.d.ts +1 -3
  109. package/types/components/NumberKeyboard/index.d.ts +0 -2
  110. package/types/components/Step/index.d.ts +0 -1
  111. package/types/components/Tabbar/index.d.ts +0 -1
  112. package/types/components/Tabbar/tabbar/TabItem.d.ts +1 -0
  113. package/types/components/Tabbar/tabbar/Tabbar.d.ts +2 -3
  114. package/types/index.d.ts +0 -6
  115. package/dist/components/ActionSheet/index.js +0 -2
  116. package/dist/components/ActionSheet/index.js.map +0 -1
  117. package/dist/components/ActivityIndicator/index.js +0 -2
  118. package/dist/components/ActivityIndicator/index.js.map +0 -1
  119. package/dist/components/Cell/index.js +0 -2
  120. package/dist/components/Cell/index.js.map +0 -1
  121. package/dist/components/Icon/index.js +0 -2
  122. package/dist/components/Icon/index.js.map +0 -1
  123. package/dist/components/Rank/index.js +0 -2
  124. package/dist/components/Rank/index.js.map +0 -1
  125. package/dist/components/Switch/index.js +0 -2
  126. package/dist/components/Switch/index.js.map +0 -1
  127. package/dist/styles/components/actionsheet.scss +0 -121
  128. package/dist/styles/components/activityindicator.scss +0 -43
  129. package/dist/styles/components/cell.scss +0 -113
  130. package/dist/styles/components/rank.scss +0 -50
  131. package/dist/styles/components/switch.scss +0 -40
  132. package/lib/components/ActionSheet/index.js +0 -57
  133. package/lib/components/ActionSheet/index.js.map +0 -1
  134. package/lib/components/ActivityIndicator/index.js +0 -14
  135. package/lib/components/ActivityIndicator/index.js.map +0 -1
  136. package/lib/components/Cell/index.js +0 -27
  137. package/lib/components/Cell/index.js.map +0 -1
  138. package/lib/components/Rank/index.js +0 -22
  139. package/lib/components/Rank/index.js.map +0 -1
  140. package/lib/components/Switch/index.js +0 -26
  141. package/lib/components/Switch/index.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,61 +1,9 @@
1
- ## [1.3.2-2](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.2-1...v1.3.2-2) (2023-07-06)
1
+ ## [1.3.2](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.2-0...v1.3.2) (2023-07-10)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
- * Switch组件、组件优化 ([ec81a39](https://code.xhdev.xyz/h5group/taro-uilib/commits/ec81a39876c3755113c78289b030216e22e2375d))
7
- * tabbar组件新增属性 ([77f16c7](https://code.xhdev.xyz/h5group/taro-uilib/commits/77f16c7d57cd8ecb3e03310ffae8bd9238c5afc0))
8
- * 修改radio、checkbox disble样式 ([0249cb3](https://code.xhdev.xyz/h5group/taro-uilib/commits/0249cb31e5582e4f098e8fd5d3c3154f61068381))
9
-
10
-
11
-
12
- ## [1.3.2-1](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.2-0...v1.3.2-1) (2023-07-03)
13
-
14
-
15
- ### Bug Fixes
16
-
17
- * cell content固定宽度 ([6d998c4](https://code.xhdev.xyz/h5group/taro-uilib/commits/6d998c47e90ebda8d0afe7f502625b3a2d6d05a0))
18
- * 去掉所有图片改用icon ([f87d12d](https://code.xhdev.xyz/h5group/taro-uilib/commits/f87d12d39264aeacae35220a7760dd573d18a559))
19
-
20
-
21
- ### Features
22
-
23
- * actionsheet inline模式 ([d6b4ac5](https://code.xhdev.xyz/h5group/taro-uilib/commits/d6b4ac56bcdc57af9092d847d4c5bc58f1a3edf8))
24
- * add Cell ([6f79e20](https://code.xhdev.xyz/h5group/taro-uilib/commits/6f79e20acba10d7db41de78a826b0c4f33655c27))
25
- * alert样式修改 ([d1dab6d](https://code.xhdev.xyz/h5group/taro-uilib/commits/d1dab6d4c9b4b709bd0377d8b62da48aea65f7b3))
26
- * button 变量修改 ([54d9198](https://code.xhdev.xyz/h5group/taro-uilib/commits/54d9198388022d66afe0a96850acd0706e6d9833))
27
- * 增加cell、activityindicator、button优化 ([177fb35](https://code.xhdev.xyz/h5group/taro-uilib/commits/177fb3537bd25bb67f152e3570c88950c377019b))
28
-
29
-
30
-
31
- # [1.3.0-9](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0...v1.3.0-9) (2023-06-16)
32
-
33
-
34
- ### Bug Fixes
35
-
36
- * 抖音小程序上的兼容问题 ([1ccdae1](https://code.xhdev.xyz/h5group/taro-uilib/commits/1ccdae18e5bb7c8b36420d3c9d5c66af770e6c43))
37
-
38
-
39
-
40
- # [1.3.0-8](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0-7...v1.3.0-8) (2023-06-14)
41
-
42
-
43
- ### Bug Fixes
44
-
45
- * numberkeyboard ([6633cc8](https://code.xhdev.xyz/h5group/taro-uilib/commits/6633cc8676d71a564d7416a08b7ceda037844c51))
46
-
47
-
48
- ### Features
49
-
50
- * actionsheet组件、、rank组件 ([46b5dcd](https://code.xhdev.xyz/h5group/taro-uilib/commits/46b5dcd09300006ba12cc9adb1ea899aa61aa0a9))
51
- * radio 默认圆形 ([c070363](https://code.xhdev.xyz/h5group/taro-uilib/commits/c070363288a1032cbcaa3c4b5d6d77dfab54290c))
52
- * 主色调更新、优化captcha组件 ([680707e](https://code.xhdev.xyz/h5group/taro-uilib/commits/680707ef5e5e8c35be01125a1a567ea9070b8a2a))
53
- * 增加action组件、增加icon ([db09cdd](https://code.xhdev.xyz/h5group/taro-uilib/commits/db09cddee336cdfb4965c4dc39c9907bdd95f8ea))
54
-
55
-
56
- ### Performance Improvements
57
-
58
- * button ghost diaddialog优化 ([628ed11](https://code.xhdev.xyz/h5group/taro-uilib/commits/628ed11cac10014cd47776f98abfac0b401fda79))
6
+ * 键盘增加站位、icon优化 ([b3444ff](https://code.xhdev.xyz/h5group/taro-uilib/commits/b3444ff50e82c746fd8e1e5a39d529be2aa08dee))
59
7
 
60
8
 
61
9
 
@@ -68,7 +16,7 @@
68
16
 
69
17
 
70
18
 
71
- ## [1.3.1](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0-9...v1.3.1) (2023-06-16)
19
+ ## [1.3.1](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0...v1.3.1) (2023-06-16)
72
20
 
73
21
 
74
22
  ### Bug Fixes
@@ -77,67 +25,18 @@
77
25
 
78
26
 
79
27
 
80
- # [1.3.0-9](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0...v1.3.0-9) (2023-06-16)
81
-
82
-
83
- ### Bug Fixes
84
-
85
- * 抖音小程序上的兼容问题 ([1ccdae1](https://code.xhdev.xyz/h5group/taro-uilib/commits/1ccdae18e5bb7c8b36420d3c9d5c66af770e6c43))
86
-
87
-
88
-
89
- # [1.3.0-8](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0-7...v1.3.0-8) (2023-06-14)
90
-
91
-
92
- ### Bug Fixes
93
-
94
- * numberkeyboard ([6633cc8](https://code.xhdev.xyz/h5group/taro-uilib/commits/6633cc8676d71a564d7416a08b7ceda037844c51))
95
-
96
-
97
- ### Features
98
-
99
- * actionsheet组件、、rank组件 ([46b5dcd](https://code.xhdev.xyz/h5group/taro-uilib/commits/46b5dcd09300006ba12cc9adb1ea899aa61aa0a9))
100
- * radio 默认圆形 ([c070363](https://code.xhdev.xyz/h5group/taro-uilib/commits/c070363288a1032cbcaa3c4b5d6d77dfab54290c))
101
- * 主色调更新、优化captcha组件 ([680707e](https://code.xhdev.xyz/h5group/taro-uilib/commits/680707ef5e5e8c35be01125a1a567ea9070b8a2a))
102
- * 增加action组件、增加icon ([db09cdd](https://code.xhdev.xyz/h5group/taro-uilib/commits/db09cddee336cdfb4965c4dc39c9907bdd95f8ea))
103
-
104
-
105
- ### Performance Improvements
106
-
107
- * button ghost diaddialog优化 ([628ed11](https://code.xhdev.xyz/h5group/taro-uilib/commits/628ed11cac10014cd47776f98abfac0b401fda79))
108
-
109
-
110
-
111
- # [1.3.0](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0-8...v1.3.0) (2023-06-15)
112
-
113
-
114
- ### Features
115
-
116
- * badge、amountkeyboard在抖音上的边框问题 ([b7d1179](https://code.xhdev.xyz/h5group/taro-uilib/commits/b7d117931cb355f402bc28b1da174a8e51617286))
117
-
118
-
119
-
120
- # [1.3.0-8](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0-7...v1.3.0-8) (2023-06-14)
28
+ # [1.3.0](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0-7...v1.3.0) (2023-06-15)
121
29
 
122
30
 
123
31
  ### Bug Fixes
124
32
 
125
33
  * navbar arrow ([085dd2b](https://code.xhdev.xyz/h5group/taro-uilib/commits/085dd2bc98df7a1249b86808378e7933e0fcdab2))
126
- * numberkeyboard ([6633cc8](https://code.xhdev.xyz/h5group/taro-uilib/commits/6633cc8676d71a564d7416a08b7ceda037844c51))
127
34
 
128
35
 
129
36
  ### Features
130
37
 
131
- * actionsheet组件、、rank组件 ([46b5dcd](https://code.xhdev.xyz/h5group/taro-uilib/commits/46b5dcd09300006ba12cc9adb1ea899aa61aa0a9))
38
+ * badge、amountkeyboard在抖音上的边框问题 ([b7d1179](https://code.xhdev.xyz/h5group/taro-uilib/commits/b7d117931cb355f402bc28b1da174a8e51617286))
132
39
  * navbar适配 ([ee6ab17](https://code.xhdev.xyz/h5group/taro-uilib/commits/ee6ab17e766d849c9223582e8e3431315163b289))
133
- * radio 默认圆形 ([c070363](https://code.xhdev.xyz/h5group/taro-uilib/commits/c070363288a1032cbcaa3c4b5d6d77dfab54290c))
134
- * 主色调更新、优化captcha组件 ([680707e](https://code.xhdev.xyz/h5group/taro-uilib/commits/680707ef5e5e8c35be01125a1a567ea9070b8a2a))
135
- * 增加action组件、增加icon ([db09cdd](https://code.xhdev.xyz/h5group/taro-uilib/commits/db09cddee336cdfb4965c4dc39c9907bdd95f8ea))
136
-
137
-
138
- ### Performance Improvements
139
-
140
- * button ghost diaddialog优化 ([628ed11](https://code.xhdev.xyz/h5group/taro-uilib/commits/628ed11cac10014cd47776f98abfac0b401fda79))
141
40
 
142
41
 
143
42
 
@@ -1,2 +1,2 @@
1
- import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{useState as n,useEffect as a,useCallback as o}from"react";import r from"classnames";import{View as l}from"@tarojs/components";import{pxTransform as m}from"../src/utils/index.js";import u from"../Badge/index.js";import c from"../Space/index.js";import s from"../node_modules/react-transition-group/esm/CSSTransition.js";var i=[{text:1,value:1,type:"number"},{text:2,value:2,type:"number"},{text:3,value:3,type:"number"},{text:"",value:"",type:"delete"},{text:4,value:4,type:"number"},{text:5,value:5,type:"number"},{text:6,value:6,type:"number"},{text:"",value:"",type:"none"},{text:7,value:7,type:"number"},{text:8,value:8,type:"number"},{text:9,value:9,type:"number"},{text:"",value:"",type:"none"},{text:"00",value:"00",type:"number"},{text:0,value:0,type:"number"},{text:"",value:"",type:"close"},{text:"",value:"",type:"none"}],p=function(p){var d=p.onBlur,y=p.show,v=p.maxLength,x=void 0===v?Number.MAX_SAFE_INTEGER:v,f=p.closeOnClickSpace,b=void 0===f||f,k=p.onClose,h=p.onChange,E=p.value,g=p.className,N=p.onConfirm,C=p.recommend,j=void 0===C?[]:C,S=p.header,_=p.disabled,L=void 0!==_&&_,w=e(n(E),2),A=w[0],O=w[1];function P(e){k&&k(e),d&&d(e)}a((function(){return b&&document.addEventListener("click",P),function(){document.removeEventListener("click",P)}}),[]),a((function(){O(E)}),[E]);var T=o((function(e,t){var n=t.type,a=t.value;if("h5"===process.env.TARO_ENV&&e.stopImmediatePropagation(),!L&&"none"!==n)if("close"!==n){var o=A;"delete"===n?o=A.slice(0,A.length-1):o.replace(/^0+/g,"").length<x&&(o=A+a),o!==A&&(O(o),null==h||h(o))}else P(e)}),[A,L]),B=r("xh-amount-keyboard",g);return t.createElement(s,{classNames:"slide-up",in:y,unmountOnExit:!0,timeout:200},t.createElement(l,{className:B},t.createElement(l,{className:"xh-amount-keyboard-header"},t.createElement(l,{className:"xh-amount-keyboard-header-wrapper"},S||j.length>0&&t.createElement(l,{className:"xh-amount-keyboard-header-wrapper-text"},"猜您想借"," ",t.createElement(c,{style:{marginLeft:m(24)}},null==j?void 0:j.map((function(e,n){return t.createElement(l,{key:n,onClick:function(t){return function(e,t){e.stopPropagation(),null==N||N("".concat(t))}(t,e)}},t.createElement(u,{content:"¥".concat(e),key:n}))})))))),t.createElement(l,{className:"xh-amount-keyboard-body"},i.map((function(e,n){return t.createElement(l,{key:n,className:r("xh-amount-keyboard-body-key",{none:"none"===e.type,delete:"delete"===e.type,close:"close"===e.type}),onClick:function(t){T(t,e)}},e.text)})),t.createElement(l,{className:"xh-amount-keyboard-body-key confirm-fake",onClick:function(e){e.stopPropagation(),null==N||N(A)}},"确定"))))};export{p as default};
1
+ import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{useState as n,useEffect as a,useCallback as o}from"react";import r from"classnames";import{View as l}from"@tarojs/components";import{pxTransform as m}from"../src/utils/index.js";import u from"../Badge/index.js";import c from"../Space/index.js";import i from"../node_modules/react-transition-group/esm/CSSTransition.js";var s=[{text:1,value:1,type:"number"},{text:2,value:2,type:"number"},{text:3,value:3,type:"number"},{text:"",value:"",type:"delete"},{text:4,value:4,type:"number"},{text:5,value:5,type:"number"},{text:6,value:6,type:"number"},{text:"",value:"",type:"none"},{text:7,value:7,type:"number"},{text:8,value:8,type:"number"},{text:9,value:9,type:"number"},{text:"",value:"",type:"none"},{text:"00",value:"00",type:"number"},{text:0,value:0,type:"number"},{text:"",value:"",type:"close"},{text:"",value:"",type:"none"}],p=function(p){var d=p.onBlur,y=p.show,v=p.maxLength,x=void 0===v?Number.MAX_SAFE_INTEGER:v,f=p.closeOnClickSpace,b=void 0===f||f,k=p.onClose,h=p.onChange,E=p.value,g=p.className,N=p.onConfirm,C=p.recommend,j=void 0===C?[]:C,S=p.header,_=p.disabled,L=void 0!==_&&_,w=p.tip,A=e(n(E),2),O=A[0],P=A[1];function T(e){k&&k(e),d&&d(e)}a((function(){return b&&document.addEventListener("click",T),function(){document.removeEventListener("click",T)}}),[]),a((function(){P(E)}),[E]);var B=o((function(e,t){var n=t.type,a=t.value;if("h5"===process.env.TARO_ENV&&e.stopImmediatePropagation(),!L&&"none"!==n)if("close"!==n){var o=O;"delete"===n?o=O.slice(0,O.length-1):o.replace(/^0+/g,"").length<x&&(o=O+a),o!==O&&(P(o),null==h||h(o))}else T(e)}),[O,L]),I=r("xh-amount-keyboard",g);return t.createElement(i,{classNames:"slide-up",in:y,unmountOnExit:!0,timeout:200},t.createElement(l,{className:I},t.createElement(l,{className:"xh-amount-keyboard-header"},t.createElement(l,{className:"xh-amount-keyboard-header-wrapper"},S||j.length>0&&t.createElement(l,{className:"xh-amount-keyboard-header-wrapper-text"},"猜您想借"," ",t.createElement(c,{style:{marginLeft:m(24)}},null==j?void 0:j.map((function(e,n){return t.createElement(l,{key:n,onClick:function(t){return function(e,t){e.stopPropagation(),null==N||N("".concat(t))}(t,e)}},t.createElement(u,{content:"¥".concat(e),key:n}))})))),w)),t.createElement(l,{className:"xh-amount-keyboard-body"},s.map((function(e,n){return t.createElement(l,{key:n,className:r("xh-amount-keyboard-body-key",{none:"none"===e.type,delete:"delete"===e.type,close:"close"===e.type}),onClick:function(t){B(t,e)}},e.text)})),t.createElement(l,{className:"xh-amount-keyboard-body-key confirm-fake",onClick:function(e){e.stopPropagation(),null==N||N(O)}},"确定"))))};export{p as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/AmountKeyboard/index.tsx"],"sourcesContent":["import React, {\n FC,\n useState,\n useEffect,\n MouseEvent,\n ReactNode,\n useCallback,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { ITouchEvent, View } from \"@tarojs/components\";\nimport { pxTransform } from \"@/utils\";\n\nimport Badge from \"../Badge\";\nimport \"./index.scss\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Space from \"../Space\";\n\nexport type NumberKeyboardProps = {\n show: boolean;\n showClose?: boolean;\n closeOnClickSpace?: boolean;\n maxLength?: number;\n onBlur?: (e: MouseEvent | Event) => void;\n onClose?: (e: MouseEvent | Event) => void;\n onChange?: (value: string) => void;\n value: string;\n header?: ReactNode;\n onConfirm?: (value: string) => void;\n recommend?: Array<number | string>;\n disabled?: boolean;\n} & XHComponentCommonProps;\n\nexport type KeyType = \"number\" | \"delete\" | \"string\" | \"none\" | \"close\";\n\nexport interface IKey {\n text: number | string;\n value: number | string;\n type: KeyType;\n}\n\nconst XHAmountKeys: IKey[] = [\n { text: 1, value: 1, type: \"number\" },\n { text: 2, value: 2, type: \"number\" },\n { text: 3, value: 3, type: \"number\" },\n { text: \"\", value: \"\", type: \"delete\" },\n { text: 4, value: 4, type: \"number\" },\n { text: 5, value: 5, type: \"number\" },\n { text: 6, value: 6, type: \"number\" },\n { text: \"\", value: \"\", type: \"none\" },\n { text: 7, value: 7, type: \"number\" },\n { text: 8, value: 8, type: \"number\" },\n { text: 9, value: 9, type: \"number\" },\n { text: \"\", value: \"\", type: \"none\" },\n { text: \"00\", value: \"00\", type: \"number\" },\n { text: 0, value: 0, type: \"number\" },\n { text: \"\", value: \"\", type: \"close\" },\n { text: \"\", value: \"\", type: \"none\" },\n];\n\nconst AmountKeyboard: FC<NumberKeyboardProps> = props => {\n const {\n onBlur,\n show,\n maxLength = Number.MAX_SAFE_INTEGER,\n closeOnClickSpace = true,\n onClose,\n onChange,\n value,\n className,\n onConfirm,\n recommend = [],\n header,\n disabled = false,\n } = props;\n const [input, setInput] = useState(value);\n\n useEffect(() => {\n if (closeOnClickSpace) {\n document.addEventListener(\"click\", handleClose);\n }\n\n return () => {\n document.removeEventListener(\"click\", handleClose);\n };\n }, []);\n\n useEffect(() => {\n setInput(value);\n }, [value]);\n\n function handleClose(e): void {\n onClose && onClose(e);\n onBlur && onBlur(e);\n }\n\n const handleOnRecommand = (e: ITouchEvent, amount: number | string) => {\n e.stopPropagation();\n onConfirm?.(`${amount}`);\n };\n\n const handleKeyPress = useCallback(\n (e, { type, value }: IKey): void => {\n if (process.env.TARO_ENV === \"h5\") {\n e.stopImmediatePropagation();\n }\n if (disabled) return;\n if (type === \"none\") return;\n\n if (type === \"close\") {\n handleClose(e);\n return;\n }\n let newInput = input;\n\n if (type === \"delete\") {\n newInput = input.slice(0, input.length - 1);\n } else if (newInput.replace(/^0+/g, \"\").length < maxLength) {\n newInput = input + value;\n }\n\n // 前后两个值相等就不触发onchange\n if (newInput === input) return;\n setInput(newInput);\n onChange?.(newInput);\n },\n [input, disabled]\n );\n\n const handleConfirm = (e: ITouchEvent) => {\n e.stopPropagation();\n onConfirm?.(input);\n };\n const keyboardcls = classNames(\"xh-amount-keyboard\", className);\n\n return (\n <CSSTransition classNames=\"slide-up\" in={show} unmountOnExit timeout={200}>\n <View className={keyboardcls}>\n <View className=\"xh-amount-keyboard-header\">\n <View className=\"xh-amount-keyboard-header-wrapper\">\n {header ||\n (recommend.length > 0 && (\n <View className=\"xh-amount-keyboard-header-wrapper-text\">\n 猜您想借{\" \"}\n <Space style={{ marginLeft: pxTransform(24) }}>\n {recommend?.map((amount, index) => (\n <View\n key={index}\n onClick={e => handleOnRecommand(e, amount)}\n >\n <Badge content={`¥${amount}`} key={index} />\n </View>\n ))}\n </Space>\n </View>\n ))}\n </View>\n </View>\n <View className=\"xh-amount-keyboard-body\">\n {XHAmountKeys.map((key, index) => (\n <View\n key={index}\n className={classNames(\"xh-amount-keyboard-body-key\", {\n none: key.type === \"none\",\n delete: key.type === \"delete\",\n close: key.type === \"close\",\n })}\n onClick={e => {\n handleKeyPress(e, key);\n }}\n >\n {key.text}\n </View>\n ))}\n <View\n className=\"xh-amount-keyboard-body-key confirm-fake\"\n onClick={handleConfirm}\n >\n 确定\n </View>\n </View>\n </View>\n </CSSTransition>\n );\n};\n\nexport default AmountKeyboard;\n"],"names":["XHAmountKeys","text","value","type","AmountKeyboard","props","onBlur","show","_a","maxLength","Number","MAX_SAFE_INTEGER","_b","closeOnClickSpace","onClose","onChange","className","onConfirm","_c","recommend","header","_d","disabled","_e","__read","useState","input","setInput","handleClose","e","useEffect","document","addEventListener","removeEventListener","handleKeyPress","useCallback","process","env","TARO_ENV","stopImmediatePropagation","newInput","slice","length","replace","keyboardcls","classNames","React","createElement","CSSTransition","in","unmountOnExit","timeout","View","Space","style","marginLeft","pxTransform","map","amount","index","key","onClick","stopPropagation","concat","handleOnRecommand","Badge","content","none","delete","close"],"mappings":"qYAyCA,IAAMA,EAAuB,CAC3B,CAAEC,KAAM,EAAGC,MAAO,EAAGC,KAAM,UAC3B,CAAEF,KAAM,EAAGC,MA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pC,UAAU,2BACbhB,EAAayD,KAAI,SAACG,EAAKD,GAAU,OAChCb,EAAAC,cAACK,EACC,CAAAQ,IAAKD,EACL3C,UAAW6B,EAAW,8BAA+B,CACnDsB,KAAmB,SAAbP,EAAIzD,KACViE,OAAqB,WAAbR,EAAIzD,KACZkE,MAAoB,UAAbT,EAAIzD,OAEb0D,QAAS,SAAAhC,GACPK,EAAeL,EAAG+B,EACnB,GAEAA,EAAI3D,SAGT6C,EAAAC,cAACK,EAAI,CACHpC,UAAU,2CACV6C,QA/CY,SAAChC,GACrBA,EAAEiC,kBACF7C,SAAAA,EAAYS,EACd,GA+Ce,QAKjB"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/AmountKeyboard/index.tsx"],"sourcesContent":["import React, {\n FC,\n useState,\n useEffect,\n MouseEvent,\n ReactNode,\n useCallback,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { ITouchEvent, View } from \"@tarojs/components\";\nimport { pxTransform } from \"@/utils\";\n\nimport Badge from \"../Badge\";\nimport \"./index.scss\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Space from \"../Space\";\n\nexport type NumberKeyboardProps = {\n show: boolean;\n showClose?: boolean;\n closeOnClickSpace?: boolean;\n maxLength?: number;\n onBlur?: (e: MouseEvent | Event) => void;\n onClose?: (e: MouseEvent | Event) => void;\n onChange?: (value: string) => void;\n value: string;\n header?: ReactNode;\n onConfirm?: (value: string) => void;\n recommend?: Array<number | string>;\n tip?: ReactNode;\n disabled?: boolean;\n} & XHComponentCommonProps;\n\nexport type KeyType = \"number\" | \"delete\" | \"string\" | \"none\" | \"close\";\n\nexport interface IKey {\n text: number | string;\n value: number | string;\n type: KeyType;\n}\n\nconst XHAmountKeys: IKey[] = [\n { text: 1, value: 1, type: \"number\" },\n { text: 2, value: 2, type: \"number\" },\n { text: 3, value: 3, type: \"number\" },\n { text: \"\", value: \"\", type: \"delete\" },\n { text: 4, value: 4, type: \"number\" },\n { text: 5, value: 5, type: \"number\" },\n { text: 6, value: 6, type: \"number\" },\n { text: \"\", value: \"\", type: \"none\" },\n { text: 7, value: 7, type: \"number\" },\n { text: 8, value: 8, type: \"number\" },\n { text: 9, value: 9, type: \"number\" },\n { text: \"\", value: \"\", type: \"none\" },\n { text: \"00\", value: \"00\", type: \"number\" },\n { text: 0, value: 0, type: \"number\" },\n { text: \"\", value: \"\", type: \"close\" },\n { text: \"\", value: \"\", type: \"none\" },\n];\n\nconst AmountKeyboard: FC<NumberKeyboardProps> = props => {\n const {\n onBlur,\n show,\n maxLength = Number.MAX_SAFE_INTEGER,\n closeOnClickSpace = true,\n onClose,\n onChange,\n value,\n className,\n onConfirm,\n recommend = [],\n header,\n disabled = false,\n tip,\n } = props;\n const [input, setInput] = useState(value);\n\n useEffect(() => {\n if (closeOnClickSpace) {\n document.addEventListener(\"click\", handleClose);\n }\n\n return () => {\n document.removeEventListener(\"click\", handleClose);\n };\n }, []);\n\n useEffect(() => {\n setInput(value);\n }, [value]);\n\n function handleClose(e): void {\n onClose && onClose(e);\n onBlur && onBlur(e);\n }\n\n const handleOnRecommand = (e: ITouchEvent, amount: number | string) => {\n e.stopPropagation();\n onConfirm?.(`${amount}`);\n };\n\n const handleKeyPress = useCallback(\n (e, { type, value }: IKey): void => {\n if (process.env.TARO_ENV === \"h5\") {\n e.stopImmediatePropagation();\n }\n if (disabled) return;\n if (type === \"none\") return;\n\n if (type === \"close\") {\n handleClose(e);\n return;\n }\n let newInput = input;\n\n if (type === \"delete\") {\n newInput = input.slice(0, input.length - 1);\n } else if (newInput.replace(/^0+/g, \"\").length < maxLength) {\n newInput = input + value;\n }\n\n // 前后两个值相等就不触发onchange\n if (newInput === input) return;\n setInput(newInput);\n onChange?.(newInput);\n },\n [input, disabled]\n );\n\n const handleConfirm = (e: ITouchEvent) => {\n e.stopPropagation();\n onConfirm?.(input);\n };\n const keyboardcls = classNames(\"xh-amount-keyboard\", className);\n\n return (\n <CSSTransition classNames=\"slide-up\" in={show} unmountOnExit timeout={200}>\n <View className={keyboardcls}>\n <View className=\"xh-amount-keyboard-header\">\n <View className=\"xh-amount-keyboard-header-wrapper\">\n {header ||\n (recommend.length > 0 && (\n <View className=\"xh-amount-keyboard-header-wrapper-text\">\n 猜您想借{\" \"}\n <Space style={{ marginLeft: pxTransform(24) }}>\n {recommend?.map((amount, index) => (\n <View\n key={index}\n onClick={e => handleOnRecommand(e, amount)}\n >\n <Badge content={`¥${amount}`} key={index} />\n </View>\n ))}\n </Space>\n </View>\n ))}\n {tip}\n </View>\n </View>\n <View className=\"xh-amount-keyboard-body\">\n {XHAmountKeys.map((key, index) => (\n <View\n key={index}\n className={classNames(\"xh-amount-keyboard-body-key\", {\n none: key.type === \"none\",\n delete: key.type === \"delete\",\n close: key.type === \"close\",\n })}\n onClick={e => {\n handleKeyPress(e, key);\n }}\n >\n {key.text}\n </View>\n ))}\n <View\n className=\"xh-amount-keyboard-body-key confirm-fake\"\n onClick={handleConfirm}\n >\n 确定\n </View>\n </View>\n </View>\n </CSSTransition>\n );\n};\n\nexport default AmountKeyboard;\n"],"names":["XHAmountKeys","text","value","type","AmountKeyboard","props","onBlur","show","_a","maxLength","Number","MAX_SAFE_INTEGER","_b","closeOnClickSpace","onClose","onChange","className","onConfirm","_c","recommend","header","_d","disabled","tip","_e","__read","useState","input","setInput","handleClose","e","useEffect","document","addEventListener","removeEventListener","handleKeyPress","useCallback","process","env","TARO_ENV","stopImmediatePropagation","newInput","slice","length","replace","keyboardcls","classNames","React","createElement","CSSTransition","in","unmountOnExit","timeout","View","Space","style","marginLeft","pxTransform","map","amount","index","key","onClick","stopPropagation","concat","handleOnRecommand","Badge","content","none","delete","close"],"mappings":"qYA0CA,IAAMA,EAAuB,CAC3B,CAAEC,KAAM,EAAGC,MAAO,EAAGC,KAAM,UAC3B,CAAEF,KAAM,EAAGC,MAAO,EAAGC,KAAM,UAC3B,CAAEF,KAAM,EAAGC,MAAO,EAAGC,KAAM,UAC3B,CAAEF,K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GAAU,OAChCb,EAAAC,cAACK,EACC,CAAAQ,IAAKD,EACL5C,UAAW8B,EAAW,8BAA+B,CACnDsB,KAAmB,SAAbP,EAAI1D,KACVkE,OAAqB,WAAbR,EAAI1D,KACZmE,MAAoB,UAAbT,EAAI1D,OAEb2D,QAAS,SAAAhC,GACPK,EAAeL,EAAG+B,EACnB,GAEAA,EAAI5D,SAGT8C,EAAAC,cAACK,EAAI,CACHrC,UAAU,2CACV8C,QAhDY,SAAChC,GACrBA,EAAEiC,kBACF9C,SAAAA,EAAYU,EACd,GAgDe,QAKjB"}
@@ -1,2 +1,2 @@
1
- import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{useState as o,useRef as n,useEffect as r}from"react";import a from"classnames";import{Button as s}from"@tarojs/components";import{useTaroEnv as i}from"../src/hooks/index.js";import l from"./DotJump.js";var m=function(m){var u=m.disabled,d=void 0!==u&&u,p=m.type,c=void 0===p?"default":p,h=m.size,b=void 0===h?"normal":h,g=m.shape,f=void 0===g?"round":g,x=m.children,y=m.className,v=m.htmlType,P=m.formType,T=m.text,E=m.openType,M=m.lang,C=m.sessionFrom,w=m.sendMessageTitle,I=m.sendMessagePath,N=m.sendMessageImg,j=m.showMessageCard,k=m.appParameter,G=m.onGetUserInfo,S=m.onGetPhoneNumber,W=m.onOpenSetting,q=m.onError,A=m.onContact,D=m.onClick,F=m.preventTime,O=void 0===F?2500:F,U=m.style,z=m.loading,B=m.loadingStyle,J=m.loadingSpace,_=m.ghost,H=void 0!==_&&_,K=i(),L=e(o(!1),2),Q=L[0],R=L[1],V=n(),X=a("xh-button",{"xh-button-default":"default"===c,"xh-button-primary":"primary"===c,"xh-button-secondary":"secondary"===c,"xh-button-ghost":H,"xh-button-warn":"warn"===c,"xh-button-square":"square"===f,"xh-button-round":"round"===f,"xh-button-rectangle":"rectangle"===f,"xh-button-normal":"normal"===b,"xh-button-small":"mini"===b,"xh-button-full":"full"===b,"xh-button-disabled":d,"xh-button-webutton":"WEAPP"===K},y),Y=function(e){"WEB"===K&&e.nativeEvent.stopImmediatePropagation(),e.preventDefault(),Q&&0!==O||(0!==O&&(V.current=setTimeout((function(){R(!1),clearTimeout(V.current)}),O)),0!==O&&R(!0),D&&D(e))};r((function(){return function(){clearTimeout(V.current)}}),[]);var Z=t.createElement(s,{className:X,formType:P,openType:E,lang:M,type:c,sessionFrom:C,sendMessageTitle:w,sendMessagePath:I,sendMessageImg:N,showMessageCard:j,appParameter:k,onGetUserInfo:G,onGetPhoneNumber:S,onOpenSetting:W,onError:q,onContact:A,onClick:Y,disabled:d,style:U,loading:z},x);return"WEAPP"===K?Z:t.createElement("button",{className:X,disabled:d,type:v,onClick:d?void 0:Y,style:U},x||T,z&&t.createElement(l,{style:B,space:J}))};export{m as default};
1
+ import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{useState as o,useRef as n,useEffect as r}from"react";import a from"classnames";import{Button as s}from"@tarojs/components";import{useTaroEnv as i}from"../src/hooks/index.js";import l from"./DotJump.js";var m=function(m){var u=m.disabled,d=void 0!==u&&u,p=m.type,c=void 0===p?"default":p,h=m.size,b=void 0===h?"normal":h,g=m.shape,f=void 0===g?"round":g,x=m.children,y=m.className,v=m.htmlType,P=m.formType,T=m.text,E=m.openType,M=m.lang,C=m.sessionFrom,w=m.sendMessageTitle,I=m.sendMessagePath,N=m.sendMessageImg,j=m.showMessageCard,k=m.appParameter,G=m.onGetUserInfo,S=m.onGetPhoneNumber,W=m.onOpenSetting,q=m.onError,A=m.onContact,D=m.onClick,F=m.preventTime,O=void 0===F?2500:F,U=m.style,z=m.loading,B=m.loadingStyle,J=m.loadingSpace,_=i(),H=e(o(!1),2),K=H[0],L=H[1],Q=n(),R=a("xh-button",{"xh-button-default":"default"===c,"xh-button-primary":"primary"===c,"xh-button-secondary":"secondary"===c,"xh-button-ghost":"ghost"===c,"xh-button-warn":"warn"===c,"xh-button-square":"square"===f,"xh-button-round":"round"===f,"xh-button-rectangle":"rectangle"===f,"xh-button-normal":"normal"===b,"xh-button-small":"mini"===b,"xh-button-full":"full"===b,"xh-button-disabled":d,"xh-button-webutton":"WEAPP"===_},y),V=function(e){"WEB"===_&&e.nativeEvent.stopImmediatePropagation(),e.preventDefault(),K&&0!==O||(0!==O&&(Q.current=setTimeout((function(){L(!1),clearTimeout(Q.current)}),O)),0!==O&&L(!0),D&&D(e))};r((function(){return function(){clearTimeout(Q.current)}}),[]);var X=t.createElement(s,{className:R,formType:P,openType:E,lang:M,type:c,sessionFrom:C,sendMessageTitle:w,sendMessagePath:I,sendMessageImg:N,showMessageCard:j,appParameter:k,onGetUserInfo:G,onGetPhoneNumber:S,onOpenSetting:W,onError:q,onContact:A,onClick:V,disabled:d,style:U,loading:z},x);return"WEAPP"===_?X:t.createElement("button",{className:R,disabled:d,type:v,onClick:d?void 0:V,style:U},x||T,z&&t.createElement(l,{style:B,space:J}))};export{m as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import React, {\n FC,\n MouseEventHandler,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { Button } from \"@tarojs/components\";\nimport { ButtonProps } from \"@tarojs/components/types/Button\";\nimport {\n ITouchEvent,\n TouchEventFunction,\n} from \"@tarojs/components/types/common\";\n\nimport { useTaroEnv } from \"../../hooks\";\nimport \"./index.scss\";\nimport DotJump from \"./DotJump\";\n\nexport type ButtonType = \"default\" | \"secondary\" | \"primary\" | \"warn\";\n\nexport type ButtonShape = \"square\" | \"round\" | \"rectangle\";\n\nexport type ButtonSize = \"default\" | \"mini\" | \"full\";\n\nexport type WechatOpenType =\n | \"contact\"\n /** 触发用户转发,使用前建议先阅读使用指引\n * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%BC%95\n */\n | \"share\"\n /** 获取用户手机号,可以从 bindgetphonenumber 回调中获取到用户信息\n * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html\n */\n | \"getPhoneNumber\"\n /** 获取用户信息,可以从 bindgetuserinfo 回调中获取到用户信息 */\n | \"getUserInfo\"\n /** 用户实名信息授权,已经弃用 */\n | \"getRealnameAuthInfo\"\n /** 打开APP,可以通过app-parameter属性设定向APP传的参数\n * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/launchApp.html\n */\n | \"launchApp\"\n /** 打开授权设置页 */\n | \"openSetting\"\n /** 打开“意见反馈”页面,用户可提交反馈内容并上传日志,开发者可以登录小程序管理后台后进入左侧菜单“客服反馈”页面获取到反馈内容 */\n | \"feedback\";\nexport type XhButtonProps = {\n htmlType?: \"button\" | \"submit\" | \"reset\";\n type?: ButtonType;\n size?: ButtonSize;\n shape?: ButtonShape;\n disabled?: boolean;\n className?: string;\n styleName?: string;\n text?: string;\n preventTime?: number;\n onClick?: (e: ITouchEvent | MouseEvent) => void;\n style?: React.CSSProperties;\n loading?: boolean;\n loadingStyle?: React.CSSProperties;\n loadingSpace?: number;\n ghost?: boolean;\n} & Omit<ButtonProps, \"type\" | \"size\">;\n\nconst XhButton: FC<XhButtonProps> = props => {\n const {\n disabled = false,\n type = \"default\",\n size = \"normal\",\n shape = \"round\",\n children,\n className,\n htmlType,\n formType,\n text,\n openType,\n lang,\n sessionFrom,\n sendMessageTitle,\n sendMessagePath,\n sendMessageImg,\n showMessageCard,\n appParameter,\n onGetUserInfo,\n onGetPhoneNumber,\n onOpenSetting,\n onError,\n onContact,\n onClick,\n preventTime = 2500,\n style,\n loading,\n loadingStyle,\n loadingSpace,\n ghost = false,\n } = props;\n const state = useTaroEnv();\n const [preventClick, setPreventClick] = useState(false);\n const timer = useRef<NodeJS.Timeout | undefined>();\n const classObj = classNames(\n \"xh-button\",\n {\n \"xh-button-default\": type === \"default\",\n \"xh-button-primary\": type === \"primary\",\n \"xh-button-secondary\": type === \"secondary\",\n \"xh-button-ghost\": ghost,\n \"xh-button-warn\": type === \"warn\",\n \"xh-button-square\": shape === \"square\",\n \"xh-button-round\": shape === \"round\",\n \"xh-button-rectangle\": shape === \"rectangle\",\n \"xh-button-normal\": size === \"normal\",\n \"xh-button-small\": size === \"mini\",\n \"xh-button-full\": size === \"full\",\n \"xh-button-disabled\": disabled,\n \"xh-button-webutton\": state === \"WEAPP\",\n },\n className\n );\n\n const handleClick: MouseEventHandler & TouchEventFunction = e => {\n state === \"WEB\" && e.nativeEvent.stopImmediatePropagation();\n e.preventDefault();\n\n if (preventClick && preventTime !== 0) {\n console.log(\"重复点击\");\n return;\n }\n if (preventTime !== 0) {\n timer.current = setTimeout(() => {\n setPreventClick(false);\n clearTimeout(timer.current);\n }, preventTime);\n }\n if (preventTime !== 0) setPreventClick(true);\n console.log(\"正常点击\");\n onClick && onClick(e);\n };\n\n useEffect(() => {\n return () => {\n clearTimeout(timer.current);\n };\n }, []);\n\n const weButton = (\n <Button\n className={classObj}\n formType={formType}\n openType={openType}\n lang={lang}\n type={type as ButtonProps[\"type\"]}\n sessionFrom={sessionFrom}\n sendMessageTitle={sendMessageTitle}\n sendMessagePath={sendMessagePath}\n sendMessageImg={sendMessageImg}\n showMessageCard={showMessageCard}\n appParameter={appParameter}\n onGetUserInfo={onGetUserInfo}\n onGetPhoneNumber={onGetPhoneNumber}\n onOpenSetting={onOpenSetting}\n onError={onError}\n onContact={onContact}\n onClick={handleClick}\n disabled={disabled}\n style={style}\n loading={loading}\n >\n {children}\n </Button>\n );\n\n if (state === \"WEAPP\") {\n return weButton;\n }\n\n return (\n // eslint-disable-next-line react/button-has-type\n <button\n className={classObj}\n disabled={disabled}\n type={htmlType}\n onClick={disabled ? undefined : handleClick}\n style={style}\n >\n {children || text}\n {loading && <DotJump style={loadingStyle} space={loadingSpace} />}\n </button>\n );\n};\n\nexport default XhButton;\n"],"names":["XhButton","props","_a","disabled","_b","type","_c","size","_d","shape","children","className","htmlType","formType","text","openType","lang","sessionFrom","sendMessageTitle","sendMessagePath","sendMessageImg","showMessageCard","appParameter","onGetUserInfo","onGetPhoneNumber","onOpenSetting","onError","onContact","onClick","_e","preventTime","style","loading","loadingStyle","loadingSpace","_f","ghost","state","useTaroEnv","_g","__read","useState","preventClick","setPreventClick","timer","useRef","classObj","classNames","handleClick","e","nativeEvent","stopImmediatePropagation","preventDefault","current","setTimeout","clearTimeout","useEffect","weButton","React","Button","createElement","undefined","DotJump","space"],"mappings":"gRAiEM,IAAAA,EAA8B,SAAAC,GAEhC,IAAAC,EA6BED,EAAKE,SA7BPA,cAAgBD,EAChBE,EA4BEH,EA5BcI,KAAhBA,OAAO,IAAAD,EAAA,YACPE,EA2BEL,EAAKM,KA3BPA,OAAI,IAAAD,EAAG,SAAQA,EACfE,EA0BEP,EAAKQ,MA1BPA,aAAQ,QAAOD,EACfE,EAyBET,EAzBMS,SACRC,EAwBEV,EAxBOU,UACTC,EAuBEX,EAvBMW,SACRC,EAsBEZ,EAtBMY,SACRC,EAqBEb,OApBFc,EAoBEd,WAnBFe,EAmBEf,EAAKe,KAlBPC,EAkBEhB,EAAKgB,YAjBPC,EAiBEjB,EAjBciB,iBAChBC,EAgBElB,EAhBakB,gBACfC,EAeEnB,EAfYmB,eACdC,EAcEpB,EAdaoB,gBACfC,EAaErB,eAZFsB,EAYEtB,EAAKsB,cAXPC,EAWEvB,EAAKuB,iBAVPC,EAUExB,EAVWwB,cACbC,EASEzB,EATKyB,QACPC,EAQE1B,YAPF2B,EAOE3B,UANF4B,EAME5B,EAAK6B,YANPA,OAAW,IAAAD,EAAG,KAAIA,EAClBE,EAKE9B,EALG8B,MACLC,EAIE/B,EAJK+B,QACPC,EAGEhC,eAFFiC,EAEEjC,EAAKiC,aADPC,EACElC,EADWmC,MAAbA,OAAQ,IAAAD,KAEJE,EAAQC,IACRC,EAAAC,EAAkCC,GAAS,GAAM,GAAhDC,EAAYH,EAAA,GAAEI,OACfC,EAAQC,IACRC,EAAWC,EACf,YACA,CACE,oBAA8B,YAAT1C,EACrB,oBAA8B,YAATA,EACrB,sBAAgC,cAATA,EACvB,kBAAmB+B,EACnB,iBAA2B,SAAT/B,EAClB,mBAA8B,WAAVI,EACpB,kBAA6B,UAAVA,EACnB,sBAAiC,cAAVA,EACvB,mBAA6B,WAATF,EACpB,kBAA4B,SAATA,EACnB,iBAA2B,SAATA,EAClB,qBAAsBJ,EACtB,qBAAgC,UAAVkC,GAExB1B,GAGIqC,EAAsD,SAAAC,GAChD,QAAVZ,GAAmBY,EAAEC,YAAYC,2BACjCF,EAAEG,iBAEEV,GAAgC,IAAhBZ,IAIA,IAAhBA,IACFc,EAAMS,QAAUC,YAAW,WACzBX,GAAgB,GAChBY,aAAaX,EAAMS,QACpB,GAAEvB,IAEe,IAAhBA,GAAmBa,GAAgB,GAEvCf,GAAWA,EAAQqB,GACrB,EAEAO,GAAU,WACR,OAAO,WACLD,aAAaX,EAAMS,QACrB,CACD,GAAE,IAEH,IAAMI,EACJC,gBAACC,EAAM,CACLhD,UAAWmC,EACXjC,SAAUA,EACVE,SAAUA,EACVC,KAAMA,EACNX,KAAMA,EACNY,YAAaA,EACbC,iBAAkBA,EAClBC,gBAAiBA,EACjBC,eAAgBA,EAChBC,gBAAiBA,EACjBC,aAAcA,EACdC,cAAeA,EACfC,iBAAkBA,EAClBC,cAAeA,EACfC,QAASA,EACTC,UAAWA,EACXC,QAASoB,EACT7C,SAAUA,EACV4B,MAAOA,EACPC,QAASA,GAERtB,GAIL,MAAc,UAAV2B,EACKoB,EAKPC,EACEE,cAAA,SAAA,CAAAjD,UAAWmC,EACX3C,SAAUA,EACVE,KAAMO,EACNgB,QAASzB,OAAW0D,EAAYb,EAChCjB,MAAOA,GAENrB,GAAYI,EACZkB,GAAW0B,EAAAE,cAACE,EAAO,CAAC/B,MAAOE,EAAc8B,MAAO7B,IAGvD"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import React, {\n FC,\n MouseEventHandler,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { Button } from \"@tarojs/components\";\nimport { ButtonProps } from \"@tarojs/components/types/Button\";\nimport {\n ITouchEvent,\n TouchEventFunction,\n} from \"@tarojs/components/types/common\";\n\nimport { useTaroEnv } from \"../../hooks\";\nimport \"./index.scss\";\nimport DotJump from \"./DotJump\";\n\nexport type ButtonType = \"default\" | \"secondary\" | \"primary\" | \"warn\" | \"ghost\";\n\nexport type ButtonShape = \"square\" | \"round\" | \"rectangle\";\n\nexport type ButtonSize = \"default\" | \"mini\" | \"full\";\n\nexport type WechatOpenType =\n | \"contact\"\n /** 触发用户转发,使用前建议先阅读使用指引\n * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%BC%95\n */\n | \"share\"\n /** 获取用户手机号,可以从 bindgetphonenumber 回调中获取到用户信息\n * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html\n */\n | \"getPhoneNumber\"\n /** 获取用户信息,可以从 bindgetuserinfo 回调中获取到用户信息 */\n | \"getUserInfo\"\n /** 用户实名信息授权,已经弃用 */\n | \"getRealnameAuthInfo\"\n /** 打开APP,可以通过app-parameter属性设定向APP传的参数\n * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/launchApp.html\n */\n | \"launchApp\"\n /** 打开授权设置页 */\n | \"openSetting\"\n /** 打开“意见反馈”页面,用户可提交反馈内容并上传日志,开发者可以登录小程序管理后台后进入左侧菜单“客服反馈”页面获取到反馈内容 */\n | \"feedback\";\nexport type XhButtonProps = {\n htmlType?: \"button\" | \"submit\" | \"reset\";\n type?: ButtonType;\n size?: ButtonSize;\n shape?: ButtonShape;\n disabled?: boolean;\n className?: string;\n styleName?: string;\n text?: string;\n preventTime?: number;\n onClick?: (e: ITouchEvent | MouseEvent) => void;\n style?: React.CSSProperties;\n loading?: boolean;\n loadingStyle?: React.CSSProperties;\n loadingSpace?: number;\n} & Omit<ButtonProps, \"type\" | \"size\">;\n\nconst XhButton: FC<XhButtonProps> = props => {\n const {\n disabled = false,\n type = \"default\",\n size = \"normal\",\n shape = \"round\",\n children,\n className,\n htmlType,\n formType,\n text,\n openType,\n lang,\n sessionFrom,\n sendMessageTitle,\n sendMessagePath,\n sendMessageImg,\n showMessageCard,\n appParameter,\n onGetUserInfo,\n onGetPhoneNumber,\n onOpenSetting,\n onError,\n onContact,\n onClick,\n preventTime = 2500,\n style,\n loading,\n loadingStyle,\n loadingSpace,\n } = props;\n const state = useTaroEnv();\n const [preventClick, setPreventClick] = useState(false);\n const timer = useRef<NodeJS.Timeout | undefined>();\n const classObj = classNames(\n \"xh-button\",\n {\n \"xh-button-default\": type === \"default\",\n \"xh-button-primary\": type === \"primary\",\n \"xh-button-secondary\": type === \"secondary\",\n \"xh-button-ghost\": type === \"ghost\",\n \"xh-button-warn\": type === \"warn\",\n \"xh-button-square\": shape === \"square\",\n \"xh-button-round\": shape === \"round\",\n \"xh-button-rectangle\": shape === \"rectangle\",\n \"xh-button-normal\": size === \"normal\",\n \"xh-button-small\": size === \"mini\",\n \"xh-button-full\": size === \"full\",\n \"xh-button-disabled\": disabled,\n \"xh-button-webutton\": state === \"WEAPP\",\n },\n className\n );\n\n const handleClick: MouseEventHandler & TouchEventFunction = e => {\n state === \"WEB\" && e.nativeEvent.stopImmediatePropagation();\n e.preventDefault();\n\n if (preventClick && preventTime !== 0) {\n console.log(\"重复点击\");\n return;\n }\n if (preventTime !== 0) {\n timer.current = setTimeout(() => {\n setPreventClick(false);\n clearTimeout(timer.current);\n }, preventTime);\n }\n if (preventTime !== 0) setPreventClick(true);\n console.log(\"正常点击\");\n onClick && onClick(e);\n };\n\n useEffect(() => {\n return () => {\n clearTimeout(timer.current);\n };\n }, []);\n\n const weButton = (\n <Button\n className={classObj}\n formType={formType}\n openType={openType}\n lang={lang}\n type={type as ButtonProps[\"type\"]}\n sessionFrom={sessionFrom}\n sendMessageTitle={sendMessageTitle}\n sendMessagePath={sendMessagePath}\n sendMessageImg={sendMessageImg}\n showMessageCard={showMessageCard}\n appParameter={appParameter}\n onGetUserInfo={onGetUserInfo}\n onGetPhoneNumber={onGetPhoneNumber}\n onOpenSetting={onOpenSetting}\n onError={onError}\n onContact={onContact}\n onClick={handleClick}\n disabled={disabled}\n style={style}\n loading={loading}\n >\n {children}\n </Button>\n );\n\n if (state === \"WEAPP\") {\n return weButton;\n }\n\n return (\n // eslint-disable-next-line react/button-has-type\n <button\n className={classObj}\n disabled={disabled}\n type={htmlType}\n onClick={disabled ? undefined : handleClick}\n style={style}\n >\n {children || text}\n {loading && <DotJump style={loadingStyle} space={loadingSpace} />}\n </button>\n );\n};\n\nexport default XhButton;\n"],"names":["XhButton","props","_a","disabled","_b","type","_c","size","_d","shape","children","className","htmlType","formType","text","openType","lang","sessionFrom","sendMessageTitle","sendMessagePath","sendMessageImg","showMessageCard","appParameter","onGetUserInfo","onGetPhoneNumber","onOpenSetting","onError","onContact","onClick","_e","preventTime","style","loading","loadingStyle","loadingSpace","state","useTaroEnv","_f","__read","useState","preventClick","setPreventClick","timer","useRef","classObj","classNames","handleClick","e","nativeEvent","stopImmediatePropagation","preventDefault","current","setTimeout","clearTimeout","useEffect","weButton","React","Button","createElement","undefined","DotJump","space"],"mappings":"gRAgEM,IAAAA,EAA8B,SAAAC,GAEhC,IAAAC,EA4BED,EAAKE,SA5BPA,cAAgBD,EAChBE,EA2BEH,EA3BcI,KAAhBA,OAAI,IAAAD,EAAG,UAASA,EAChBE,EA0BEL,OA1BFM,OAAO,IAAAD,EAAA,WACPE,EAyBEP,EAAKQ,MAzBPA,OAAK,IAAAD,EAAG,QAAOA,EACfE,EAwBET,EAAKS,SAvBPC,EAuBEV,EAAKU,UAtBPC,EAsBEX,EAAKW,SArBPC,EAqBEZ,EAAKY,SApBPC,EAoBEb,EAAKa,KAnBPC,EAmBEd,EAAKc,SAlBPC,EAkBEf,EAAKe,KAjBPC,EAiBEhB,EAjBSgB,YACXC,EAgBEjB,EAhBciB,iBAChBC,EA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A,EACjBC,aAAcA,EACdC,cAAeA,EACfC,iBAAkBA,EAClBC,cAAeA,EACfC,QAASA,EACTC,UAAWA,EACXC,QAASkB,EACT3C,SAAUA,EACV4B,MAAOA,EACPC,QAASA,GAERtB,GAIL,MAAc,UAAVyB,EACKoB,EAKPC,EACEE,cAAA,SAAA,CAAA/C,UAAWiC,EACXzC,SAAUA,EACVE,KAAMO,EACNgB,QAASzB,OAAWwD,EAAYb,EAChCf,MAAOA,GAENrB,GAAYI,EACZkB,GAAWwB,EAAAE,cAACE,EAAO,CAAC7B,MAAOE,EAAc4B,MAAO3B,IAGvD"}
@@ -1,2 +1,2 @@
1
- import{__rest as t,__read as e,__assign as n}from"../node_modules/tslib/tslib.es6.js";import r,{forwardRef as a,useRef as c,useState as o,useImperativeHandle as i,useEffect as u,useMemo as l}from"react";import s from"classnames";import m from"../Button/index.js";var f=a((function(a,f){var v=a.timeout,d=void 0===v?59:v,h=a.text,p=void 0===h?"获取验证码":h,x=a.onClick,I=a.className,b=a.ingText,g=void 0===b?"s重新获取":b,k=a.onEnd,C=a.shape,E=void 0===C?"square":C,N=t(a,["timeout","text","onClick","className","ingText","onEnd","shape"]),j=c(),w=e(o(0),2),y=w[0],D=w[1],M=e(o(!1),2),T=M[0],q=M[1],B=function(){j.current&&clearInterval(j.current),D(0),q(!1)};i(f,(function(){return{reset:B,begin:z,beginning:T}}),[T]),u((function(){return j.current&&clearInterval(j.current),function(){j.current&&clearInterval(j.current)}}),[]);var _=l((function(){return y?"".concat(y).concat(g):p}),[y,p,g]),z=function(){var t=Date.now(),e=t;q(!0),j.current&&clearInterval(j.current),D(d),j.current=setInterval((function(){e=Date.now();var n=t+1e3*d+100,r=Math.max(Math.floor((n-e)/1e3),0);0===r&&(j.current&&clearInterval(j.current),q(!1),k&&k()),D(r)}),1e3)};return r.createElement(m,n({},a,{className:s("xh-captcha",I),disabled:T,onClick:function(){var t=x();t&&t.then&&t.then(z).catch((function(){q(!1)}))},type:"secondary",shape:E},N),_)}));export{f as default};
1
+ import{__rest as n,__read as t,__assign as e}from"../node_modules/tslib/tslib.es6.js";import r,{forwardRef as c,useRef as a,useState as o,useImperativeHandle as i,useEffect as u,useMemo as l}from"react";import s from"classnames";import m from"../Button/index.js";var f=c((function(c,f){var v=c.timeout,d=void 0===v?59:v,h=c.text,p=void 0===h?"获取验证码":h,x=c.onClick,I=c.className,b=c.ingText,g=void 0===b?"s重新获取":b,k=c.onEnd,C=n(c,["timeout","text","onClick","className","ingText","onEnd"]),E=a(),N=t(o(0),2),j=N[0],w=N[1],y=t(o(!1),2),D=y[0],M=y[1],T=function(){E.current&&clearInterval(E.current),w(0),M(!1)};i(f,(function(){return{reset:T,begin:z,beginning:D}}),[D]),u((function(){return E.current&&clearInterval(E.current),function(){E.current&&clearInterval(E.current)}}),[]);var q=l((function(){return j?"".concat(j).concat(g):p}),[j,p,g]),z=function(){var n=Date.now(),t=n;M(!0),E.current&&clearInterval(E.current),w(d),E.current=setInterval((function(){t=Date.now();var e=n+1e3*d+100,r=Math.max(Math.floor((e-t)/1e3),0);0===r&&(E.current&&clearInterval(E.current),M(!1),k&&k()),w(r)}),1e3)};return r.createElement(m,e({},c,{className:s("xh-captcha",I),disabled:D,onClick:function(){var n=x();n&&n.then&&n.then(z).catch((function(){M(!1)}))},type:"secondary",shape:"square",size:"mini"},C),q)}));export{f as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Captcha/index.tsx"],"sourcesContent":["import React, {\n useRef,\n useState,\n useEffect,\n useImperativeHandle,\n forwardRef,\n Ref,\n useMemo,\n} from \"react\";\nimport classnames from \"classnames\";\n\nimport Button, { XhButtonProps } from \"../Button\";\n\nimport \"./index.scss\";\n\nexport type refMe = {\n reset: () => void;\n begin: () => void;\n beginning: boolean;\n};\n\nexport interface CaptchaProps extends XhButtonProps {\n timeout?: number;\n className?: string;\n styleName?: string;\n text?: string;\n onClick: () => Promise<boolean>;\n ref: Ref<refMe>;\n timeingTemp?: string;\n ingText?: string;\n onEnd?: () => void;\n}\n\nconst CountdownButton = forwardRef<refMe, CaptchaProps>((props, fromRef) => {\n const {\n timeout = 59,\n text = \"获取验证码\",\n onClick,\n className,\n ingText = \"s重新获取\",\n onEnd,\n shape = \"square\",\n ...rest\n } = props;\n const intervalRef = useRef<NodeJS.Timeout | null>();\n const [time, setTime] = useState(0);\n const [disabled, setDisabled] = useState(false);\n\n const reset = (): void => {\n intervalRef.current && clearInterval(intervalRef.current);\n setTime(0);\n setDisabled(false);\n };\n\n useImperativeHandle(\n fromRef,\n () => ({\n reset,\n begin: counter,\n beginning: disabled,\n }),\n [disabled]\n );\n\n useEffect(() => {\n intervalRef.current && clearInterval(intervalRef.current);\n return () => {\n intervalRef.current && clearInterval(intervalRef.current);\n };\n }, []);\n\n // 倒计时\n const buttonText = useMemo((): string | number => {\n if (time) {\n return `${time}${ingText}`;\n }\n return text;\n }, [time, text, ingText]);\n\n const counter = () => {\n const now = Date.now();\n let nowStamp = now;\n\n setDisabled(true);\n\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n }\n\n setTime(timeout);\n\n intervalRef.current = setInterval(() => {\n nowStamp = Date.now();\n const overTimeStamp = now + timeout * 1000 + 100;\n const leftTime = Math.max(\n Math.floor((overTimeStamp - nowStamp) / 1000),\n 0\n );\n\n if (leftTime === 0) {\n intervalRef.current && clearInterval(intervalRef.current);\n setDisabled(false);\n onEnd && onEnd();\n }\n\n setTime(leftTime);\n }, 1000);\n };\n\n const handleClick = (): any => {\n const promise = onClick();\n if (promise && promise.then) {\n promise.then(counter).catch(() => {\n console.log(\"callback reject....\");\n setDisabled(false);\n });\n }\n };\n\n return (\n <Button\n {...props}\n className={classnames(\"xh-captcha\", className)}\n disabled={disabled}\n onClick={handleClick}\n type=\"secondary\"\n shape={shape}\n {...rest}\n >\n {buttonText}\n </Button>\n );\n});\nexport default CountdownButton;\n"],"names":["CountdownButton","forwardRef","props","fromRef","_a","timeout","_b","text","onClick","className","_c","ingText","onEnd","_d","shape","rest","__rest","intervalRef","useRef","_e","__read","useState","time","setTime","_f","disabled","setDisabled","reset","current","clearInterval","useImperativeHandle","begin","counter","beginning","useEffect","buttonText","useMemo","concat","now","Date","nowStamp","setInterval","overTimeStamp","leftTime","Math","max","floor","React","createElement","Button","__assign","classnames","promise","then","catch","type"],"mappings":"uQAiCA,IAAMA,EAAkBC,GAAgC,SAACC,EAAOC,GAE5D,IAAAC,EAQEF,EAAKG,QARPA,OAAU,IAAAD,EAAA,GAAEA,EACZE,EAOEJ,EAPYK,KAAdA,OAAO,IAAAD,EAAA,QAAOA,EACdE,EAMEN,EAAKM,QALPC,EAKEP,EALOO,UACTC,EAIER,EAAKS,QAJPA,OAAU,IAAAD,EAAA,QAAOA,EACjBE,EAGEV,EAAKU,MAFPC,EAEEX,EAAKY,MAFPA,OAAQ,IAAAD,EAAA,SAAQA,EACbE,EAAIC,EACLd,EATE,CASL,UAAA,OAAA,UAAA,YAAA,UAAA,QAAA,UACKe,EAAcC,IACdC,EAAAC,EAAkBC,EAAS,GAAE,GAA5BC,EAAIH,EAAA,GAAEI,OACPC,EAAAJ,EAA0BC,GAAS,GAAM,GAAxCI,EAAQD,EAAA,GAAEE,OAEXC,EAAQ,WACZV,EAAYW,SAAWC,cAAcZ,EAAYW,SACjDL,EAAQ,GACRG,GAAY,EACd,EAEAI,EACE3B,GACA,WAAM,MAAC,CACLwB,MAAKA,EACLI,MAAOC,EACPC,UAAWR,EACX,GACF,CAACA,IAGHS,GAAU,WAER,OADAjB,EAAYW,SAAWC,cAAcZ,EAAYW,SAC1C,WACLX,EAAYW,SAAWC,cAAcZ,EAAYW,QACnD,CACD,GAAE,IAGH,IAAMO,EAAaC,GAAQ,WACzB,OAAId,EACK,GAAGe,OAAAf,GAAOe,OAAA1B,GAEZJ,CACR,GAAE,CAACe,EAAMf,EAAMI,IAEVqB,EAAU,WACd,IAAMM,EAAMC,KAAKD,MACbE,EAAWF,EAEfZ,GAAY,GAERT,EAAYW,SACdC,cAAcZ,EAAYW,SAG5BL,EAAQlB,GAERY,EAAYW,QAAUa,aAAY,WAChCD,EAAWD,KAAKD,MAChB,IAAMI,EAAgBJ,EAAgB,IAAVjC,EAAiB,IACvCsC,EAAWC,KAAKC,IACpBD,KAAKE,OAAOJ,EAAgBF,GAAY,KACxC,GAGe,IAAbG,IACF1B,EAAYW,SAAWC,cAAcZ,EAAYW,SACjDF,GAAY,GACZd,GAASA,KAGXW,EAAQoB,EACT,GAAE,IACL,EAYA,OACEI,EAACC,cAAAC,EACKC,EAAA,CAAA,EAAAhD,GACJO,UAAW0C,EAAW,aAAc1C,GACpCgB,SAAUA,EACVjB,QAfgB,WAClB,IAAM4C,EAAU5C,IACZ4C,GAAWA,EAAQC,MACrBD,EAAQC,KAAKrB,GAASsB,OAAM,WAE1B5B,GAAY,EACd,GAEJ,EAQI6B,KAAK,YACLzC,MAAOA,GACHC,GAEHoB,EAGP"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Captcha/index.tsx"],"sourcesContent":["import React, {\n useRef,\n useState,\n useEffect,\n useImperativeHandle,\n forwardRef,\n Ref,\n useMemo,\n} from \"react\";\nimport classnames from \"classnames\";\n\nimport Button, { XhButtonProps } from \"../Button\";\n\nimport \"./index.scss\";\n\nexport type refMe = {\n reset: () => void;\n begin: () => void;\n beginning: boolean;\n};\n\nexport interface CaptchaProps extends XhButtonProps {\n timeout?: number;\n className?: string;\n styleName?: string;\n text?: string;\n onClick: () => Promise<boolean>;\n ref: Ref<refMe>;\n timeingTemp?: string;\n ingText?: string;\n onEnd?: () => void;\n}\n\nconst CountdownButton = forwardRef<refMe, CaptchaProps>((props, fromRef) => {\n const {\n timeout = 59,\n text = \"获取验证码\",\n onClick,\n className,\n ingText = \"s重新获取\",\n onEnd,\n ...rest\n } = props;\n const intervalRef = useRef<NodeJS.Timeout | null>();\n const [time, setTime] = useState(0);\n const [disabled, setDisabled] = useState(false);\n\n const reset = (): void => {\n intervalRef.current && clearInterval(intervalRef.current);\n setTime(0);\n setDisabled(false);\n };\n\n useImperativeHandle(\n fromRef,\n () => ({\n reset,\n begin: counter,\n beginning: disabled,\n }),\n [disabled]\n );\n\n useEffect(() => {\n intervalRef.current && clearInterval(intervalRef.current);\n return () => {\n intervalRef.current && clearInterval(intervalRef.current);\n };\n }, []);\n\n // 倒计时\n const buttonText = useMemo((): string | number => {\n if (time) {\n return `${time}${ingText}`;\n }\n return text;\n }, [time, text, ingText]);\n\n const counter = () => {\n const now = Date.now();\n let nowStamp = now;\n\n setDisabled(true);\n\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n }\n\n setTime(timeout);\n\n intervalRef.current = setInterval(() => {\n nowStamp = Date.now();\n const overTimeStamp = now + timeout * 1000 + 100;\n const leftTime = Math.max(\n Math.floor((overTimeStamp - nowStamp) / 1000),\n 0\n );\n\n if (leftTime === 0) {\n intervalRef.current && clearInterval(intervalRef.current);\n setDisabled(false);\n onEnd && onEnd();\n }\n\n setTime(leftTime);\n }, 1000);\n };\n\n const handleClick = (): any => {\n const promise = onClick();\n if (promise && promise.then) {\n promise.then(counter).catch(() => {\n console.log(\"callback reject....\");\n setDisabled(false);\n });\n }\n };\n\n return (\n <Button\n {...props}\n className={classnames(\"xh-captcha\", className)}\n disabled={disabled}\n onClick={handleClick}\n type=\"secondary\"\n shape=\"square\"\n size=\"mini\"\n {...rest}\n >\n {buttonText}\n </Button>\n );\n});\nexport default CountdownButton;\n"],"names":["CountdownButton","forwardRef","props","fromRef","_a","timeout","_b","text","onClick","className","_c","ingText","onEnd","rest","intervalRef","useRef","_d","__read","useState","time","setTime","_e","disabled","setDisabled","reset","current","clearInterval","useImperativeHandle","begin","counter","beginning","useEffect","buttonText","useMemo","concat","now","Date","nowStamp","setInterval","overTimeStamp","leftTime","Math","max","floor","React","createElement","Button","classnames","promise","then","catch","type","shape","size"],"mappings":"uQAiCA,IAAMA,EAAkBC,GAAgC,SAACC,EAAOC,GAE5D,IAAAC,EAOEF,E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UA,EACVd,QAfgB,WAClB,IAAMwC,EAAUxC,IACZwC,GAAWA,EAAQC,MACrBD,EAAQC,KAAKpB,GAASqB,OAAM,WAE1B3B,GAAY,EACd,GAEJ,EAQI4B,KAAK,YACLC,MAAM,SACNC,KAAK,QACDxC,GAEHmB,EAGP"}
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as t}from"../../node_modules/tslib/tslib.es6.js";import o,{createRef as n}from"react";import r from"react-dom";import{showModal as i}from"@tarojs/taro";import m from"../../DialogComponent/index.js";import c from"../../Button/index.js";var a=function(a){var f=a.title,l=void 0===f?"":f,s=a.content,d=a.confirmText,u=void 0===d?"知道了":d,p=e(a,["title","content","confirmText"]);return new Promise((function(e){if("h5"===process.env.TARO_ENV){var a=document.createElement("div"),f=n(),d=o.createElement(c,{ghost:!0,type:"default",shape:"rectangle",className:"xh-alert-button",onClick:function(){r.unmountComponentAtNode(a),e()}},u);r.render(o.createElement(m,{header:l,footer:d,content:s,visible:!0,ref:f}),a)}else i(t({title:l,content:s,showCancel:!1,confirmColor:"#fe5e00",confirmText:u},p)).then((function(){return e()}))}))};export{a as default};
1
+ import{__rest as t,__assign as e}from"../../node_modules/tslib/tslib.es6.js";import o,{createRef as n}from"react";import r from"react-dom";import{showModal as i}from"@tarojs/taro";import m from"../../DialogComponent/index.js";import c from"../../Button/index.js";var a=function(a){var f=a.title,l=void 0===f?"":f,s=a.content,d=a.confirmText,u=void 0===d?"我知道了":d,p=t(a,["title","content","confirmText"]);return new Promise((function(t){if("h5"===process.env.TARO_ENV){var a=document.createElement("div"),f=n(),d=o.createElement(c,{className:"xh-alert-button",type:"primary",onClick:function(){r.unmountComponentAtNode(a),t()}},u);r.render(o.createElement(m,{header:l,footer:d,content:s,visible:!0,ref:f}),a)}else i(e({title:l,content:s,showCancel:!1,confirmColor:"#f6ab00",confirmText:u},p)).then((function(){return t()}))}))};export{a as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Dialog/Alert/index.tsx"],"sourcesContent":["import React, { createRef, ReactNode } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { showModal } from \"@tarojs/taro\";\nimport Dialog, { DialogRef } from \"../../DialogComponent\";\nimport Button from \"../../../../src/components/Button\";\n\nexport type AlertProps = {\n title?: string | ReactNode;\n content?: string | ReactNode;\n confirmText?: string | ReactNode;\n} & {\n /** 取消按钮的文字,最多 4 个字符 */\n cancelText?: string;\n /** 接口调用结束的回调函数(调用成功、失败都会执行) */\n complete?: (res: TaroGeneral.CallbackResult) => void;\n /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */\n confirmColor?: string;\n /** 确认按钮的文字,最多 4 个字符 */\n confirmText?: string;\n /** 提示的内容 */\n content?: string;\n /** 接口调用失败的回调函数 */\n fail?: (res: TaroGeneral.CallbackResult) => void;\n /** 接口调用成功的回调函数 */\n success?: () => void;\n /** 提示的标题 */\n title?: string;\n};\n\nconst Alert = (props: AlertProps): Promise<void> => {\n const { title = \"\", content, confirmText = \"知道了\", ...rest } = props;\n return new Promise(resolve => {\n if (process.env.TARO_ENV === \"h5\") {\n const div = document.createElement(\"div\");\n const dialogRef = createRef<DialogRef>();\n const alertFooter = (\n <Button\n ghost\n type=\"default\"\n shape=\"rectangle\"\n className=\"xh-alert-button\"\n onClick={() => {\n ReactDOM.unmountComponentAtNode(div);\n resolve();\n }}\n >\n {confirmText}\n </Button>\n );\n ReactDOM.render(\n <Dialog\n header={title}\n footer={alertFooter}\n content={content}\n visible\n ref={dialogRef}\n />,\n div\n );\n } else {\n showModal({\n title: title as string,\n content: content as string,\n showCancel: false,\n confirmColor: \"#fe5e00\",\n confirmText: confirmText as string,\n ...rest,\n }).then(() => resolve());\n }\n });\n};\n\nexport default Alert;\n"],"names":["Alert","props","_a","title","content","_b","confirmText","rest","__rest","Promise","resolve","process","env","TARO_ENV","div_1","document","createElement","dialogRef","createRef","alertFooter","React","Button","ghost","type","shape","className","onClick","ReactDOM","unmountComponentAtNode","render","Dialog","header","footer","visible","ref","showModal","__assign","showCancel","confirmColor","then"],"mappings":"uQA6BM,IAAAA,EAAQ,SAACC,GACL,IAAAC,EAAsDD,EAA5CE,MAAVA,OAAK,IAAAD,EAAG,GAAEA,EAAEE,EAA0CH,EAAnCG,QAAEC,EAAiCJ,EAAdK,YAAnBA,OAAW,IAAAD,EAAG,MAAKA,EAAKE,EAASC,EAAAP,EAAxD,CAAA,QAAA,UAAA,gBACN,OAAO,IAAIQ,SAAQ,SAAAC,GACjB,GAA6B,OAAzBC,QAAQC,IAAIC,SAAmB,CACjC,IAAMC,EAAMC,SAASC,cAAc,OAC7BC,EAAYC,IACZC,EACJC,EAAAJ,cAACK,EACC,CAAAC,SACAC,KAAK,UACLC,MAAM,YACNC,UAAU,kBACVC,QAAS,WACPC,EAASC,uBAAuBd,GAChCJ,GACF,GAECJ,GAGLqB,EAASE,OACPT,EAACJ,cAAAc,EACC,CAAAC,OAAQ5B,EACR6B,OAAQb,EACRf,QAASA,EACT6B,SACA,EAAAC,IAAKjB,IAEPH,EAEH,MACCqB,EACEC,EAAA,CAAAjC,MAAOA,EACPC,QAASA,EACTiC,YAAY,EACZC,aAAc,UACdhC,YAAaA,GACVC,IACFgC,MAAK,WAAM,OAAA7B,GAAA,GAElB,GACF"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Dialog/Alert/index.tsx"],"sourcesContent":["import React, { createRef, ReactNode } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { showModal } from \"@tarojs/taro\";\nimport Dialog, { DialogRef } from \"../../DialogComponent\";\nimport Button from \"../../../../src/components/Button\";\n\nexport type AlertProps = {\n title?: string | ReactNode;\n content?: string | ReactNode;\n confirmText?: string | ReactNode;\n} & {\n /** 取消按钮的文字,最多 4 个字符 */\n cancelText?: string;\n /** 接口调用结束的回调函数(调用成功、失败都会执行) */\n complete?: (res: TaroGeneral.CallbackResult) => void;\n /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */\n confirmColor?: string;\n /** 确认按钮的文字,最多 4 个字符 */\n confirmText?: string;\n /** 提示的内容 */\n content?: string;\n /** 接口调用失败的回调函数 */\n fail?: (res: TaroGeneral.CallbackResult) => void;\n /** 接口调用成功的回调函数 */\n success?: () => void;\n /** 提示的标题 */\n title?: string;\n};\n\nconst Alert = (props: AlertProps): Promise<void> => {\n const { title = \"\", content, confirmText = \"我知道了\", ...rest } = props;\n return new Promise(resolve => {\n if (process.env.TARO_ENV === \"h5\") {\n const div = document.createElement(\"div\");\n const dialogRef = createRef<DialogRef>();\n const alertFooter = (\n <Button\n className=\"xh-alert-button\"\n type=\"primary\"\n onClick={() => {\n ReactDOM.unmountComponentAtNode(div);\n resolve();\n }}\n >\n {confirmText}\n </Button>\n );\n ReactDOM.render(\n <Dialog\n header={title}\n footer={alertFooter}\n content={content}\n visible\n ref={dialogRef}\n />,\n div\n );\n } else {\n showModal({\n title: title as string,\n content: content as string,\n showCancel: false,\n confirmColor: \"#f6ab00\",\n confirmText: confirmText as string,\n ...rest,\n }).then(() => resolve());\n }\n });\n};\n\nexport default Alert;\n"],"names":["Alert","props","_a","title","content","_b","confirmText","rest","__rest","Promise","resolve","process","env","TARO_ENV","div_1","document","createElement","dialogRef","createRef","alertFooter","React","Button","className","type","onClick","ReactDOM","unmountComponentAtNode","render","Dialog","header","footer","visible","ref","showModal","__assign","showCancel","confirmColor","then"],"mappings":"uQA6BM,IAAAA,EAAQ,SAACC,GACL,IAAAC,EAAuDD,EAA7CE,MAAVA,OAAK,IAAAD,EAAG,GAAEA,EAAEE,EAA2CH,EAApCG,QAAEC,EAAkCJ,EAAdK,YAApBA,OAAW,IAAAD,EAAG,OAAMA,EAAKE,EAASC,EAAAP,EAAzD,CAAA,QAAA,UAAA,gBACN,OAAO,IAAIQ,SAAQ,SAAAC,GACjB,GAA6B,OAAzBC,QAAQC,IAAIC,SAAmB,CACjC,IAAMC,EAAMC,SAASC,cAAc,OAC7BC,EAAYC,IACZC,EACJC,EAAAJ,cAACK,EACC,CAAAC,UAAU,kBACVC,KAAK,UACLC,QAAS,WACPC,EAASC,uBAAuBZ,GAChCJ,GACF,GAECJ,GAGLmB,EAASE,OACPP,EAACJ,cAAAY,EACC,CAAAC,OAAQ1B,EACR2B,OAAQX,EACRf,QAASA,EACT2B,SACA,EAAAC,IAAKf,IAEPH,EAEH,MACCmB,EACEC,EAAA,CAAA/B,MAAOA,EACPC,QAASA,EACT+B,YAAY,EACZC,aAAc,UACd9B,YAAaA,GACVC,IACF8B,MAAK,WAAM,OAAA3B,GAAA,GAElB,GACF"}
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as o}from"../../node_modules/tslib/tslib.es6.js";import t,{createRef as n}from"react";import r from"react-dom";import{showModal as c}from"@tarojs/taro";import i from"../../DialogComponent/index.js";import m from"../../Button/index.js";var a=function(a){var f=a.title,l=void 0===f?"":f,s=a.content,u=a.confirmText,d=void 0===u?"确定":u,p=a.cancelText,x=void 0===p?"取消":p,h=e(a,["title","content","confirmText","cancelText"]);return new Promise((function(e){if("h5"===process.env.TARO_ENV){var a=document.createElement("div"),f=n(),u=t.createElement("div",{className:"xh-confirm-footer"},t.createElement(m,{ghost:!0,type:"default",shape:"rectangle",className:"xh-confirm-footer-button xh-confirm-footer-cancel-button",onClick:function(){r.unmountComponentAtNode(a),e({errMsg:"ok",confirm:!1,cancel:!0})}},x),t.createElement(m,{ghost:!0,type:"primary",shape:"rectangle",className:"xh-confirm-footer-button xh-confirm-footer-confirm-button",onClick:function(){r.unmountComponentAtNode(a),e({errMsg:"ok",confirm:!0,cancel:!1})}},d));r.render(t.createElement(i,{header:l,footer:u,content:s,visible:!0,ref:f}),a)}else c(o({title:l,content:s,confirmColor:"#f6ab00",cancelText:x,cancelColor:"#666",confirmText:d},h)).then(e)}))};export{a as default};
1
+ import{__rest as e,__assign as o}from"../../node_modules/tslib/tslib.es6.js";import t,{createRef as n}from"react";import r from"react-dom";import{showModal as c}from"@tarojs/taro";import i from"../../DialogComponent/index.js";import m from"../../Button/index.js";var f=function(f){var a=f.title,l=void 0===a?"":a,s=f.content,u=f.confirmText,d=void 0===u?"确定":u,x=f.cancelText,p=void 0===x?"取消":x,v=e(f,["title","content","confirmText","cancelText"]);return new Promise((function(e){if("h5"===process.env.TARO_ENV){var f=document.createElement("div"),a=n(),u=t.createElement("div",{className:"xh-confirm-footer"},t.createElement(m,{className:"xh-confirm-footer-button xh-confirm-footer-cancel-button",onClick:function(){r.unmountComponentAtNode(f),e({errMsg:"ok",confirm:!1,cancel:!0})}},p),t.createElement(m,{type:"primary",className:"xh-confirm-footer-button xh-confirm-footer-confirm-button",onClick:function(){r.unmountComponentAtNode(f),e({errMsg:"ok",confirm:!0,cancel:!1})}},d));r.render(t.createElement(i,{header:l,footer:u,content:s,visible:!0,ref:a}),f)}else c(o({title:l,content:s,confirmColor:"#f6ab00",cancelText:p,cancelColor:"#666",confirmText:d},v)).then(e)}))};export{f as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Dialog/Confirm/index.tsx"],"sourcesContent":["import React, { createRef } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { showModal } from \"@tarojs/taro\";\nimport DialogComponent, { DialogRef } from \"../../DialogComponent\";\nimport Button from \"../../Button\";\n\nexport type ConfirmProps = {\n title?: string;\n header?: string;\n content: string;\n cancelText?: string;\n confirmText?: string;\n} & {\n /** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */\n cancelColor?: string;\n /** 取消按钮的文字,最多 4 个字符 */\n cancelText?: string;\n /** 接口调用结束的回调函数(调用成功、失败都会执行) */\n complete?: (res: TaroGeneral.CallbackResult) => void;\n /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */\n confirmColor?: string;\n /** 确认按钮的文字,最多 4 个字符 */\n confirmText?: string;\n /** 提示的内容 */\n content?: string;\n /** 接口调用失败的回调函数 */\n fail?: (res: TaroGeneral.CallbackResult) => void;\n /** 接口调用成功的回调函数 */\n success?: (result: ConfirmPropsResult) => void;\n /** 提示的标题 */\n title?: string;\n};\n\nexport type ConfirmPropsResult = {\n /** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */\n cancel: boolean;\n /** 为 true 时,表示用户点击了确定按钮 */\n confirm: boolean;\n /** 调用结果 */\n errMsg: string;\n};\nconst Comfirm = (props: ConfirmProps): Promise<ConfirmPropsResult> => {\n const {\n title = \"\",\n content,\n confirmText = \"确定\",\n cancelText = \"取消\",\n ...rest\n } = props;\n return new Promise(resolve => {\n if (process.env.TARO_ENV === \"h5\") {\n const div = document.createElement(\"div\");\n\n const dialogRef = createRef<DialogRef>();\n const alertFooter = (\n <div className=\"xh-confirm-footer\">\n <Button\n ghost\n type=\"default\"\n shape=\"rectangle\"\n className=\"xh-confirm-footer-button xh-confirm-footer-cancel-button\"\n onClick={() => {\n ReactDOM.unmountComponentAtNode(div);\n resolve({ errMsg: \"ok\", confirm: false, cancel: true });\n }}\n >\n {cancelText}\n </Button>\n <Button\n ghost\n type=\"primary\"\n shape=\"rectangle\"\n className=\"xh-confirm-footer-button xh-confirm-footer-confirm-button\"\n onClick={() => {\n ReactDOM.unmountComponentAtNode(div);\n resolve({ errMsg: \"ok\", confirm: true, cancel: false });\n }}\n >\n {confirmText}\n </Button>\n </div>\n );\n ReactDOM.render(\n <DialogComponent\n header={title}\n footer={alertFooter}\n content={content}\n visible\n ref={dialogRef}\n />,\n div\n );\n } else {\n showModal({\n title,\n content,\n confirmColor: \"#f6ab00\",\n cancelText,\n cancelColor: \"#666\",\n confirmText,\n ...rest,\n }).then(resolve);\n }\n });\n};\n\nexport default Comfirm;\n"],"names":["Comfirm","props","_a","title","content","_b","confirmText","_c","cancelText","rest","__rest","Promise","resolve","process","env","TARO_ENV","div_1","document","createElement","dialogRef","createRef","alertFooter","React","className","Button","ghost","type","shape","onClick","ReactDOM","unmountComponentAtNode","errMsg","confirm","cancel","render","DialogComponent","header","footer","visible","ref","showModal","__assign","confirmColor","cancelColor","then"],"mappings":"uQAyCM,IAAAA,EAAU,SAACC,GAEb,IAAAC,EAKED,EAAKE,MALPA,aAAQ,GAAED,EACVE,EAIEH,EAAKG,QAHPC,EAGEJ,cAHFK,OAAc,IAAAD,EAAA,OACdE,EAEEN,EAAKO,WAFPA,OAAU,IAAAD,EAAG,KAAIA,EACdE,EAAIC,EACLT,EANE,CAAA,QAAA,UAAA,cAAA,eAON,OAAO,IAAIU,SAAQ,SAAAC,GACjB,GAA6B,OAAzBC,QAAQC,IAAIC,SAAmB,CACjC,IAAMC,EAAMC,SAASC,cAAc,OAE7BC,EAAYC,IACZC,EACJC,EAAKJ,cAAA,MAAA,CAAAK,UAAU,qBACbD,EAAAJ,cAACM,EACC,CAAAC,OACA,EAAAC,KAAK,UACLC,MAAM,YACNJ,UAAU,2DACVK,QAAS,WACPC,EAASC,uBAAuBd,GAChCJ,EAAQ,CAAEmB,OAAQ,KAAMC,SAAS,EAAOC,QAAQ,GACjD,GAEAzB,GAEHc,EAAAJ,cAACM,EACC,CAAAC,OACA,EAAAC,KAAK,UACLC,MAAM,YACNJ,UAAU,4DACVK,QAAS,WACPC,EAASC,uBAAuBd,GAChCJ,EAAQ,CAAEmB,OAAQ,KAAMC,SAAS,EAAMC,QAAQ,GACjD,GAEC3B,IAIPuB,EAASK,OACPZ,EAACJ,cAAAiB,EACC,CAAAC,OAAQjC,EACRkC,OAAQhB,EACRjB,QAASA,EACTkC,SACA,EAAAC,IAAKpB,IAEPH,EAEH,MACCwB,EACEC,EAAA,CAAAtC,MAAKA,EACLC,QAAOA,EACPsC,aAAc,UACdlC,WAAUA,EACVmC,YAAa,OACbrC,YAAWA,GACRG,IACFmC,KAAKhC,EAEZ,GACF"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Dialog/Confirm/index.tsx"],"sourcesContent":["import React, { createRef } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { showModal } from \"@tarojs/taro\";\nimport DialogComponent, { DialogRef } from \"../../DialogComponent\";\nimport Button from \"../../Button\";\n\nexport type ConfirmProps = {\n title?: string;\n header?: string;\n content: string;\n cancelText?: string;\n confirmText?: string;\n} & {\n /** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */\n cancelColor?: string;\n /** 取消按钮的文字,最多 4 个字符 */\n cancelText?: string;\n /** 接口调用结束的回调函数(调用成功、失败都会执行) */\n complete?: (res: TaroGeneral.CallbackResult) => void;\n /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */\n confirmColor?: string;\n /** 确认按钮的文字,最多 4 个字符 */\n confirmText?: string;\n /** 提示的内容 */\n content?: string;\n /** 接口调用失败的回调函数 */\n fail?: (res: TaroGeneral.CallbackResult) => void;\n /** 接口调用成功的回调函数 */\n success?: (result: ConfirmPropsResult) => void;\n /** 提示的标题 */\n title?: string;\n};\n\nexport type ConfirmPropsResult = {\n /** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */\n cancel: boolean;\n /** 为 true 时,表示用户点击了确定按钮 */\n confirm: boolean;\n /** 调用结果 */\n errMsg: string;\n};\nconst Comfirm = (props: ConfirmProps): Promise<ConfirmPropsResult> => {\n const {\n title = \"\",\n content,\n confirmText = \"确定\",\n cancelText = \"取消\",\n ...rest\n } = props;\n return new Promise(resolve => {\n if (process.env.TARO_ENV === \"h5\") {\n const div = document.createElement(\"div\");\n\n const dialogRef = createRef<DialogRef>();\n const alertFooter = (\n <div className=\"xh-confirm-footer\">\n <Button\n className=\"xh-confirm-footer-button xh-confirm-footer-cancel-button\"\n onClick={() => {\n ReactDOM.unmountComponentAtNode(div);\n resolve({ errMsg: \"ok\", confirm: false, cancel: true });\n }}\n >\n {cancelText}\n </Button>\n <Button\n type=\"primary\"\n className=\"xh-confirm-footer-button xh-confirm-footer-confirm-button\"\n onClick={() => {\n ReactDOM.unmountComponentAtNode(div);\n resolve({ errMsg: \"ok\", confirm: true, cancel: false });\n }}\n >\n {confirmText}\n </Button>\n </div>\n );\n ReactDOM.render(\n <DialogComponent\n header={title}\n footer={alertFooter}\n content={content}\n visible\n ref={dialogRef}\n />,\n div\n );\n } else {\n showModal({\n title,\n content,\n confirmColor: \"#f6ab00\",\n cancelText,\n cancelColor: \"#666\",\n confirmText,\n ...rest,\n }).then(resolve);\n }\n });\n};\n\nexport default Comfirm;\n"],"names":["Comfirm","props","_a","title","content","_b","confirmText","_c","cancelText","rest","__rest","Promise","resolve","process","env","TARO_ENV","div_1","document","createElement","dialogRef","createRef","alertFooter","React","className","Button","onClick","ReactDOM","unmountComponentAtNode","errMsg","confirm","cancel","type","render","DialogComponent","header","footer","visible","ref","showModal","__assign","confirmColor","cancelColor","then"],"mappings":"uQAyCM,IAAAA,EAAU,SAACC,GAEb,IAAAC,EAKED,EAAKE,MALPA,aAAQ,GAAED,EACVE,EAIEH,EAAKG,QAHPC,EAGEJ,cAHFK,OAAc,IAAAD,EAAA,OACdE,EAEEN,EAAKO,WAFPA,OAAU,IAAAD,EAAG,KAAIA,EACdE,EAAIC,EACLT,EANE,CAAA,QAAA,UAAA,cAAA,eAON,OAAO,IAAIU,SAAQ,SAAAC,GACjB,GAA6B,OAAzBC,QAAQC,IAAIC,SAAmB,CACjC,IAAMC,EAAMC,SAASC,cAAc,OAE7BC,EAAYC,IACZC,EACJC,EAAKJ,cAAA,MAAA,CAAAK,UAAU,qBACbD,EAAAJ,cAACM,EACC,CAAAD,UAAU,2DACVE,QAAS,WACPC,EAASC,uBAAuBX,GAChCJ,EAAQ,CAAEgB,OAAQ,KAAMC,SAAS,EAAOC,QAAQ,GACjD,GAEAtB,GAEHc,EAACJ,cAAAM,EACC,CAAAO,KAAK,UACLR,UAAU,4DACVE,QAAS,WACPC,EAASC,uBAAuBX,GAChCJ,EAAQ,CAAEgB,OAAQ,KAAMC,SAAS,EAAMC,QAAQ,GACjD,GAECxB,IAIPoB,EAASM,OACPV,EAACJ,cAAAe,EACC,CAAAC,OAAQ/B,EACRgC,OAAQd,EACRjB,QAASA,EACTgC,SACA,EAAAC,IAAKlB,IAEPH,EAEH,MACCsB,EACEC,EAAA,CAAApC,MAAKA,EACLC,QAAOA,EACPoC,aAAc,UACdhC,WAAUA,EACViC,YAAa,OACbnC,YAAWA,GACRG,IACFiC,KAAK9B,EAEZ,GACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/DialogComponent/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useState,\n useImperativeHandle,\n forwardRef,\n useEffect,\n} from \"react\";\nimport ReactDOM from \"react-dom\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Mask from \"../Mask\";\nimport \"./index.scss\";\n\nexport type DialogProps = {\n header?: string | ReactNode;\n content: string | ReactNode;\n footer?: string | ReactNode;\n visible: boolean;\n} & XHComponentCommonProps;\n\nexport type DialogRef = {\n close: () => void;\n};\nconst DialogCom = forwardRef<DialogRef, DialogProps>((props, fromRef) => {\n const { header, content, footer, className = \"\", visible } = props;\n const [selfVisible, setSelfVisible] = useState(false);\n\n useImperativeHandle(fromRef, () => ({\n close: () => {\n console.log(\"closes\");\n setSelfVisible(false);\n },\n }));\n\n useEffect(() => {\n setSelfVisible(visible);\n }, [visible]);\n\n const dialogcls = classNames(\"xh-dialog\", className, {\n microApp: process.env.TARO_ENV !== \"h5\",\n });\n\n const dialogContent = classNames(\"xh-dialog-content-content\", {\n headless: !header,\n });\n const DialogMain = (\n <View className={dialogcls}>\n <Mask />\n <CSSTransition\n in={selfVisible}\n timeout={200}\n classNames=\"scale\"\n unmountOnExit\n >\n <View className=\"xh-dialog-content\">\n <View className=\"xh-dialog-content-header\">{header}</View>\n <View className={dialogContent}>{content}</View>\n <View className=\"xh-dialog-content-footer\">{footer}</View>\n </View>\n </CSSTransition>\n </View>\n );\n\n return ReactDOM.createPortal(DialogMain, document.body);\n});\n\nexport default DialogCom;\n"],"names":["DialogCom","forwardRef","props","fromRef","header","content","footer","_a","className","visible","_b","__read","useState","selfVisible","setSelfVisible","useImperativeHandle","close","useEffect","dialogcls","classNames","microApp","process","env","TARO_ENV","dialogContent","headless","DialogMain","React","createElement","View","Mask","CSSTransition","in","timeout","unmountOnExit","ReactDOM","createPortal","document","body"],"mappings":"gWAyBA,IAAMA,EAAYC,GAAmC,SAACC,EAAOC,GACnD,IAAAC,EAAqDF,EAAKE,OAAlDC,EAA6CH,EAAtCG,QAAEC,EAAoCJ,EAAKI,OAAjCC,EAA4BL,EAAKM,UAAjCA,OAAY,IAAAD,EAAA,GAAEA,EAAEE,EAAYP,EAAKO,QAC5DC,EAAAC,EAAgCC,GAAS,GAAM,GAA9CC,EAAWH,EAAA,GAAEI,OAEpBC,EAAoBZ,GAAS,WAAM,MAAC,CAClCa,MAAO,WAELF,GAAe,EAChB,EACD,IAEFG,GAAU,WACRH,EAAeL,EACjB,GAAG,CAACA,IAEJ,IAAMS,EAAYC,EAAW,YAAaX,EAAW,CACnDY,SAAmC,OAAzBC,QAAQC,IAAIC,WAGlBC,EAAgBL,EAAW,4BAA6B,CAC5DM,UAAWrB,IAEPsB,EACJC,EAAAC,cAACC,EAAK,CAAArB,UAAWU,GACfS,EAAAC,cAACE,EAAO,MACRH,EAAAC,cAACG,EAAa,CACZC,GAAInB,EACJoB,QAAS,IACTd,WAAW,QACXe,eAAa,GAEbP,EAAAC,cAACC,EAAI,CAACrB,UAAU,qBACdmB,EAAAC,cAACC,EAAK,CAAArB,UAAU,4BAA4BJ,GAC5CuB,EAAAC,cAACC,EAAK,CAAArB,UAAWgB,GAAgBnB,GACjCsB,EAAAC,cAACC,EAAI,CAACrB,UAAU,4BAA4BF,MAMpD,OAAO6B,EAASC,aAAaV,EAAYW,SAASC,KACpD"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/DialogComponent/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useState,\n useImperativeHandle,\n forwardRef,\n useEffect,\n} from \"react\";\nimport ReactDOM from \"react-dom\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Mask from \"../Mask\";\nimport \"./index.scss\";\n\nexport type DialogProps = {\n header?: string | ReactNode;\n content: string | ReactNode;\n footer?: string | ReactNode;\n visible: boolean;\n} & XHComponentCommonProps;\n\nexport type DialogRef = {\n close: () => void;\n};\nconst DialogCom = forwardRef<DialogRef, DialogProps>((props, fromRef) => {\n const { header, content, footer, className = \"\", visible } = props;\n const [selfVisible, setSelfVisible] = useState(false);\n\n useImperativeHandle(fromRef, () => ({\n close: () => {\n console.log(\"closes\");\n setSelfVisible(false);\n },\n }));\n\n useEffect(() => {\n setSelfVisible(visible);\n }, [visible]);\n\n const dialogcls = classNames(\"xh-dialog\", className, {\n microApp: process.env.TARO_ENV !== \"h5\",\n });\n console.log(header);\n console.log(\"title\");\n\n const dialogContent = classNames(\"xh-dialog-content-content\", {\n headless: !header,\n });\n const DialogMain = (\n <View className={dialogcls}>\n <Mask />\n <CSSTransition\n in={selfVisible}\n timeout={200}\n classNames=\"scale\"\n unmountOnExit\n >\n <View className=\"xh-dialog-content\">\n <View className=\"xh-dialog-content-header\">{header}</View>\n <View className={dialogContent}>{content}</View>\n <View className=\"xh-dialog-content-footer\">{footer}</View>\n </View>\n </CSSTransition>\n </View>\n );\n\n return ReactDOM.createPortal(DialogMain, document.body);\n});\n\nexport default DialogCom;\n"],"names":["DialogCom","forwardRef","props","fromRef","header","content","footer","_a","className","visible","_b","__read","useState","selfVisible","setSelfVisible","useImperativeHandle","close","useEffect","dialogcls","classNames","microApp","process","env","TARO_ENV","dialogContent","headless","DialogMain","React","createElement","View","Mask","CSSTransition","in","timeout","unmountOnExit","ReactDOM","createPortal","document","body"],"mappings":"gWAyBA,IAAMA,EAAYC,GAAmC,SAACC,EAAOC,GACnD,IAAAC,EAAqDF,EAAKE,OAAlDC,EAA6CH,EAAtCG,QAAEC,EAAoCJ,EAAKI,OAAjCC,EAA4BL,EAAKM,UAAjCA,OAAY,IAAAD,EAAA,GAAEA,EAAEE,EAAYP,EAAKO,QAC5DC,EAAAC,EAAgCC,GAAS,GAAM,GAA9CC,EAAWH,EAAA,GAAEI,OAEpBC,EAAoBZ,GAAS,WAAM,MAAC,CAClCa,MAAO,WAELF,GAAe,EAChB,EACD,IAEFG,GAAU,WACRH,EAAeL,EACjB,GAAG,CAACA,IAEJ,IAAMS,EAAYC,EAAW,YAAaX,EAAW,CACnDY,SAAmC,OAAzBC,QAAQC,IAAIC,WAKlBC,EAAgBL,EAAW,4BAA6B,CAC5DM,UAAWrB,IAEPsB,EACJC,EAAAC,cAACC,EAAK,CAAArB,UAAWU,GACfS,EAAAC,cAACE,EAAO,MACRH,EAAAC,cAACG,EAAa,CACZC,GAAInB,EACJoB,QAAS,IACTd,WAAW,QACXe,eAAa,GAEbP,EAAAC,cAACC,EAAI,CAACrB,UAAU,qBACdmB,EAAAC,cAACC,EAAK,CAAArB,UAAU,4BAA4BJ,GAC5CuB,EAAAC,cAACC,EAAK,CAAArB,UAAWgB,GAAgBnB,GACjCsB,EAAAC,cAACC,EAAI,CAACrB,UAAU,4BAA4BF,MAMpD,OAAO6B,EAASC,aAAaV,EAAYW,SAASC,KACpD"}
@@ -1,2 +1,2 @@
1
- import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o,useState as n,useImperativeHandle as a,useEffect as r}from"react";import s from"classnames";import{View as c}from"@tarojs/components";import l from"../Button/index.js";import i from"../Mask/index.js";import m from"../node_modules/react-transition-group/esm/CSSTransition.js";var f=o((function(o,f){var d=o.header,u=o.content,p=o.className,h=void 0===p?"":p,g=o.visible,v=o.showCancel,x=void 0===v||v,E=o.confirmText,N=void 0===E?"确定":E,C=o.cancelText,b=void 0===C?"取消":C,j=o.footer,T=void 0!==j&&j,k=o.onConfirm,w=o.onCancel,y=o.onClose,z=o.tranparent,S=void 0!==z&&z,_=e(n(!1),2),B=_[0],M=_[1];a(f,(function(){return{close:q,open:A}}));var q=function(){y&&y(),M(!1)},A=function(){M(!0)};r((function(){g||y&&y(),M(g)}),[g]);var D=s("xh-dialog-ref",h,{show:B}),F=t.createElement(c,{className:"xh-dialog-ref-content-footer-buttons"},x&&t.createElement(l,{ghost:!0,size:"full",shape:"rectangle",preventTime:0,onClick:function(){w&&w(),q()},className:"xh-dialog-ref-content-footer-buttons-cancel"},b),t.createElement(l,{type:"primary",shape:"rectangle",size:"full",ghost:!0,className:"xh-dialog-ref-content-footer-buttons--confirm",onClick:function(){k&&k()},preventTime:0},N));return t.createElement(c,{className:D},t.createElement(i,null),t.createElement(m,{in:B,timeout:200,classNames:"scale"},t.createElement(c,{className:s("xh-dialog-ref-content",{tranparent:S})},d&&t.createElement(c,{className:"xh-dialog-ref-content-header"},d),t.createElement(c,{className:"xh-dialog-ref-content-content"},u),T||t.createElement(c,{className:"xh-dialog-ref-content-footer"},F))))}));export{f as default};
1
+ import{__read as e,__assign as o}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as n,useState as r,useImperativeHandle as a,useEffect as c}from"react";import s from"classnames";import{View as i}from"@tarojs/components";import l from"../Button/index.js";import m from"../Mask/index.js";import f from"../node_modules/react-transition-group/esm/CSSTransition.js";var p=n((function(n,p){var d=n.header,h=n.content,u=n.className,v=void 0===u?"":u,x=n.visible,E=n.showCancel,N=void 0===E||E,g=n.confirmText,T=void 0===g?"确定":g,b=n.cancelText,C=void 0===b?"取消":b,_=n.footer,j=void 0!==_&&_,A=n.onConfirm,O=n.onCancel,R=n.onClose,V=e(r(!1),2),k=V[0],y=V[1];a(p,(function(){return{close:w,open:S}}));var w=function(){R&&R(),y(!1)},S=function(){y(!0)};c((function(){x||R&&R(),y(x)}),[x]);var B=s("xh-dialog-ref",v,{show:k}),M=s("xh-dialog-ref-content-footer-buttons",{microApp:"h5"!==process.env.TARO_ENV}),q="h5"!==process.env.TARO_ENV?{type:"ghost",shape:"rectangle"}:{},z=t.createElement(i,{className:M},N&&t.createElement(l,o({},q,{preventTime:0,onClick:function(){O&&O(),w()},className:"h5"!==process.env.TARO_ENV?"xh-dialog-ref-content-footer-buttons-microapp-cancel":"xh-dialog-ref-content-footer-buttons-h5-cancel"}),C),t.createElement(l,o({type:"primary"},q,{className:"h5"!==process.env.TARO_ENV?"xh-dialog-ref-content-footer-buttons-microapp-confirm":"xh-dialog-ref-content-footer-buttons-h5-confirm",onClick:function(){A&&A()},preventTime:0}),T));return t.createElement(i,{className:B},t.createElement(m,null),t.createElement(f,{in:k,timeout:200,classNames:"scale"},t.createElement(i,{className:"xh-dialog-ref-content"},t.createElement(i,{className:"xh-dialog-ref-content-header"},d),t.createElement(i,{className:"xh-dialog-ref-content-content"},h),j||t.createElement(i,{className:"xh-dialog-ref-content-footer"},z))))}));export{p as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/DialogRef/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useState,\n useImperativeHandle,\n forwardRef,\n useEffect,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\nimport Button from \"../Button\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Mask from \"../Mask\";\nimport \"./index.scss\";\n\nexport type DialogProps = {\n header?: string | ReactNode;\n content: string | ReactNode;\n footer?: ReactNode;\n cancelText?: string;\n confirmText?: string;\n showCancel?: boolean;\n visible: boolean;\n onConfirm?: () => void;\n onCancel?: () => void;\n onClose?: () => void;\n tranparent?: boolean;\n} & XHComponentCommonProps;\n\nexport type IDialogRef = {\n close: () => void;\n open: () => void;\n};\nconst DialogCom = forwardRef<IDialogRef, DialogProps>((props, fromRef) => {\n const {\n header,\n content,\n className = \"\",\n visible,\n showCancel = true,\n confirmText = \"确定\",\n cancelText = \"取消\",\n footer = false,\n onConfirm,\n onCancel,\n onClose,\n tranparent = false,\n } = props;\n const [selfVisible, setSelfVisible] = useState(false);\n\n useImperativeHandle(fromRef, () => ({\n close,\n open,\n }));\n\n const close = () => {\n onClose && onClose();\n setSelfVisible(false);\n };\n\n const open = () => {\n setSelfVisible(true);\n };\n\n const handleConfirm = () => {\n onConfirm && onConfirm();\n // close();\n };\n const handleCancel = () => {\n onCancel && onCancel();\n close();\n };\n\n useEffect(() => {\n if (!visible) {\n onClose && onClose();\n }\n setSelfVisible(visible);\n }, [visible]);\n\n const dialogcls = classNames(\"xh-dialog-ref\", className, {\n show: selfVisible,\n });\n\n const dialogFooter = (\n <View className=\"xh-dialog-ref-content-footer-buttons\">\n {showCancel && (\n <Button\n ghost\n size=\"full\"\n shape=\"rectangle\"\n preventTime={0}\n onClick={handleCancel}\n className=\"xh-dialog-ref-content-footer-buttons-cancel\"\n >\n {cancelText}\n </Button>\n )}\n <Button\n type=\"primary\"\n shape=\"rectangle\"\n size=\"full\"\n ghost\n className=\"xh-dialog-ref-content-footer-buttons--confirm\"\n onClick={handleConfirm}\n preventTime={0}\n >\n {confirmText}\n </Button>\n </View>\n );\n\n const DialogMain = (\n <View className={dialogcls}>\n <Mask />\n <CSSTransition in={selfVisible} timeout={200} classNames=\"scale\">\n <View className={classNames(\"xh-dialog-ref-content\", { tranparent })}>\n {header && (\n <View className=\"xh-dialog-ref-content-header\">{header}</View>\n )}\n <View className=\"xh-dialog-ref-content-content\">{content}</View>\n {footer || (\n <View className=\"xh-dialog-ref-content-footer\">{dialogFooter}</View>\n )}\n </View>\n </CSSTransition>\n </View>\n );\n return DialogMain;\n});\n\nexport default DialogCom;\n"],"names":["DialogCom","forwardRef","props","fromRef","header","content","_a","className","visible","_b","showCancel","_c","confirmText","_d","cancelText","_e","footer","onConfirm","onCancel","onClose","_f","tranparent","_g","__read","useState","selfVisible","setSelfVisible","useImperativeHandle","close","open","useEffect","dialogcls","classNames","show","dialogFooter","React","createElement","View","Button","ghost","size","shape","preventTime","onClick","type","Mask","CSSTransition","in","timeout"],"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,EAAa,CAACC,GAAItB,EAAauB,QAAS,IAAKhB,WAAW,SACvDG,EAAAC,cAACC,EAAI,CAAC9B,UAAWyB,EAAW,wBAAyB,CAAEX,WAAUA,KAC9DjB,GACC+B,EAAAC,cAACC,EAAI,CAAC9B,UAAU,gCAAgCH,GAElD+B,EAAAC,cAACC,EAAK,CAAA9B,UAAU,iCAAiCF,GAChDW,GACCmB,EAAAC,cAACC,EAAI,CAAC9B,UAAU,gCAAgC2B,KAO5D"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/DialogRef/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useState,\n useImperativeHandle,\n forwardRef,\n useEffect,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\nimport Button, { XhButtonProps } from \"../Button\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Mask from \"../Mask\";\nimport \"./index.scss\";\n\nexport type DialogProps = {\n header?: string | ReactNode;\n content: string | ReactNode;\n footer?: ReactNode;\n cancelText?: string;\n confirmText?: string;\n showCancel?: boolean;\n visible: boolean;\n onConfirm?: () => void;\n onCancel?: () => void;\n onClose?: () => void;\n} & XHComponentCommonProps;\n\nexport type IDialogRef = {\n close: () => void;\n open: () => void;\n};\nconst DialogCom = forwardRef<IDialogRef, DialogProps>((props, fromRef) => {\n const {\n header,\n content,\n className = \"\",\n visible,\n showCancel = true,\n confirmText = \"确定\",\n cancelText = \"取消\",\n footer = false,\n onConfirm,\n onCancel,\n onClose,\n } = props;\n const [selfVisible, setSelfVisible] = useState(false);\n\n useImperativeHandle(fromRef, () => ({\n close,\n open,\n }));\n\n const close = () => {\n onClose && onClose();\n setSelfVisible(false);\n };\n\n const open = () => {\n setSelfVisible(true);\n };\n\n const handleConfirm = () => {\n onConfirm && onConfirm();\n // close();\n };\n const handleCancel = () => {\n onCancel && onCancel();\n close();\n };\n\n useEffect(() => {\n if (!visible) {\n onClose && onClose();\n }\n setSelfVisible(visible);\n }, [visible]);\n\n const dialogcls = classNames(\"xh-dialog-ref\", className, {\n show: selfVisible,\n });\n const footercls = classNames(\"xh-dialog-ref-content-footer-buttons\", {\n microApp: process.env.TARO_ENV !== \"h5\",\n });\n\n const morcoBtnProps:\n | { type: XhButtonProps[\"type\"]; shape: XhButtonProps[\"shape\"] }\n | {} =\n process.env.TARO_ENV !== \"h5\" ? { type: \"ghost\", shape: \"rectangle\" } : {};\n\n const dialogFooter = (\n <View className={footercls}>\n {showCancel && (\n <Button\n {...morcoBtnProps}\n preventTime={0}\n onClick={handleCancel}\n className={\n process.env.TARO_ENV !== \"h5\"\n ? \"xh-dialog-ref-content-footer-buttons-microapp-cancel\"\n : \"xh-dialog-ref-content-footer-buttons-h5-cancel\"\n }\n >\n {cancelText}\n </Button>\n )}\n <Button\n type=\"primary\"\n {...morcoBtnProps}\n className={\n process.env.TARO_ENV !== \"h5\"\n ? \"xh-dialog-ref-content-footer-buttons-microapp-confirm\"\n : \"xh-dialog-ref-content-footer-buttons-h5-confirm\"\n }\n onClick={handleConfirm}\n preventTime={0}\n >\n {confirmText}\n </Button>\n </View>\n );\n\n const DialogMain = (\n <View className={dialogcls}>\n <Mask />\n <CSSTransition in={selfVisible} timeout={200} classNames=\"scale\">\n <View className=\"xh-dialog-ref-content\">\n <View className=\"xh-dialog-ref-content-header\">{header}</View>\n <View className=\"xh-dialog-ref-content-content\">{content}</View>\n {footer || (\n <View className=\"xh-dialog-ref-content-footer\">{dialogFooter}</View>\n )}\n </View>\n </CSSTransition>\n </View>\n );\n return DialogMain;\n});\n\nexport default DialogCom;\n"],"names":["DialogCom","forwardRef","props","fromRef","header","content","_a","className","visible","_b","showCancel","_c","confirmText","_d","cancelText","_e","footer","onConfirm","onCancel","onClose","_f","__read","useState","selfVisible","setSelfVisible","useImperativeHandle","close","open","useEffect","dialogcls","classNames","show","footercls","microApp","process","env","TARO_ENV","morcoBtnProps","type","shape","dialogFooter","React","createElement","View","Button","preventTime","onClick","__assign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ACA,kDAENU,QApDgB,WACpB7B,GAAaA,GAEf,EAkDM4B,YAAa,IAEZjC,IAmBP,OAbE6B,EAAAC,cAACC,EAAK,CAAApC,UAAWsB,GACfY,EAAAC,cAACM,EAAO,MACRP,EAAAC,cAACO,EAAa,CAACC,GAAI3B,EAAa4B,QAAS,IAAKrB,WAAW,SACvDW,EAAAC,cAACC,EAAI,CAACpC,UAAU,yBACdkC,EAAAC,cAACC,EAAK,CAAApC,UAAU,gCAAgCH,GAChDqC,EAAAC,cAACC,EAAK,CAAApC,UAAU,iCAAiCF,GAChDW,GACCyB,EAAAC,cAACC,EAAI,CAACpC,UAAU,gCAAgCiC,KAO5D"}
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as a}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as n,useRef as l,useImperativeHandle as r}from"react";import{View as m,Text as o,Input as i}from"@tarojs/components";import c from"classnames";import{inputRange as s}from"../src/utils/index.js";var u=n((function(n,u){var p=n.onChange,f=n.maxlength,h=n.value,d=n.type,v=n.placeholder,x=n.label,E=n.labelHtml,N=n.RightComponent,b=n.onBlur,g=n.pattern,y=n.LeftComponent,w=n.LeftIcon,L=n.name,C=n.readonly,I=void 0!==C&&C,_=n.withArrow,B=void 0!==_&&_,H=n.direction,j=void 0===H?"row":H,A=n.border,R=void 0===A||A,T=n.mainExtra,M=n.padding,S=void 0!==M&&M,O=e(n,["onChange","maxlength","value","type","placeholder","label","labelHtml","RightComponent","onBlur","pattern","LeftComponent","LeftIcon","name","readonly","withArrow","direction","border","mainExtra","padding"]);function V(e){var a=s(e.target.value);e.target.value=a,p&&p(a)}function k(e){var a=s(e.target.value);b&&b(a)}var q=l(null);r(u,(function(){return{focus:function(){var e;null===(e=q.current)||void 0===e||e.focus()}}}));var z=c("xh-form-input",{column:"column"===j,border:R,padding:S});return"h5"!==process.env.TARO_ENV?t.createElement(m,{className:z},t.createElement(m,{className:"xh-form-input-main"},t.createElement(m,{className:"xh-form-input-main-left"},x&&t.createElement(m,{className:"xh-form-input-main-left-label"},x,w&&t.createElement(m,{className:"xh-form-input-main-left-label-icon"},w)),E&&t.createElement("label",{dangerouslySetInnerHTML:{__html:E},className:"label"}),t.createElement(m,null,y)),t.createElement(m,{className:"xh-form-input-main-center"},I?t.createElement(o,{className:c("xh-form-input-readonly",{"xh-form-input-placeholder":!h})},h||v):t.createElement(i,a({},O,{ref:q,className:"xh-form-input-main-center-native",maxlength:f,name:L,placeholder:v,type:d,value:h,onBlur:k,onInput:V}))),T&&t.createElement(m,{className:"xh-form-input-main-extra"},T)),t.createElement(m,{className:"xh-form-input-right"},N,B&&t.createElement(m,{className:"arrow"}))):t.createElement("div",{className:z},t.createElement("div",{className:"xh-form-input-main"},t.createElement("div",{className:"xh-form-input-main-left"},x&&t.createElement("label",{className:"xh-form-input-main-left-label"},x,w&&t.createElement("div",{className:"xh-form-input-main-left-label-icon"},w)),E&&t.createElement("label",{dangerouslySetInnerHTML:{__html:E},className:"label"}),t.createElement("div",null,y)),t.createElement("div",{className:"xh-form-input-main-center"},I?t.createElement("p",{className:c("xh-form-input-main-center-readonly",{"xh-form-input-main-placeholder":!h})},h||v):t.createElement("input",{ref:q,className:"xh-form-input-main-center-native",maxLength:f,name:L,pattern:g,placeholder:v,type:d,value:h,onBlur:k,onInput:V})),T&&t.createElement("div",{className:"xh-form-input-main-extra"},T)),t.createElement("div",{className:"xh-form-input-right"},N,B&&t.createElement("span",{className:"arrow"})))}));export{u as default};
1
+ import{__rest as e,__assign as a}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as n,useRef as l,useImperativeHandle as r}from"react";import{View as m,Text as o,Input as i}from"@tarojs/components";import c from"classnames";import{inputRange as s}from"../src/utils/index.js";var u=n((function(n,u){var p=n.onChange,f=n.maxlength,h=n.value,d=n.type,x=n.placeholder,v=n.label,E=n.labelHtml,N=n.RightComponent,b=n.onBlur,g=n.pattern,y=n.LeftComponent,w=n.LeftIcon,L=n.name,C=n.readonly,I=void 0!==C&&C,_=n.withArrow,B=void 0!==_&&_,H=n.direction,j=void 0===H?"row":H,A=n.border,R=void 0===A||A,T=n.mainExtra,M=n.padding,S=void 0!==M&&M,O=e(n,["onChange","maxlength","value","type","placeholder","label","labelHtml","RightComponent","onBlur","pattern","LeftComponent","LeftIcon","name","readonly","withArrow","direction","border","mainExtra","padding"]);function V(e){var a=s(e.target.value);e.target.value=a,p&&p(a)}function k(e){var a=s(e.target.value);b&&b(a)}var q=l(null);r(u,(function(){return{focus:function(){q.current.focus()}}}));var z=c("xh-form-input",{column:"column"===j,border:R,padding:S});return"h5"!==process.env.TARO_ENV?t.createElement(m,{className:z},t.createElement(m,{className:"xh-form-input-main"},t.createElement(m,{className:"xh-form-input-main-left"},v&&t.createElement(m,{className:"xh-form-input-main-left-label"},v,w&&t.createElement(m,{className:"xh-form-input-main-left-label-icon"},w)),E&&t.createElement("label",{dangerouslySetInnerHTML:{__html:E},className:"label"}),t.createElement(m,null,y)),t.createElement(m,{className:"xh-form-input-main-center"},I?t.createElement(o,{className:c("xh-form-input-readonly",{"xh-form-input-placeholder":!h})},h||x):t.createElement(i,a({},O,{ref:q,className:"xh-form-input-main-center-native",maxlength:f,name:L,placeholder:x,type:d,value:h,onBlur:k,onInput:V}))),T&&t.createElement(m,{className:"xh-form-input-main-extra"},T)),t.createElement(m,{className:"xh-form-input-right"},N,B&&t.createElement(m,{className:"arrow"}))):t.createElement("div",{className:z},t.createElement("div",{className:"xh-form-input-main"},t.createElement("div",{className:"xh-form-input-main-left"},v&&t.createElement("label",{className:"xh-form-input-main-left-label"},v,w&&t.createElement("div",{className:"xh-form-input-main-left-label-icon"},w)),E&&t.createElement("label",{dangerouslySetInnerHTML:{__html:E},className:"label"}),t.createElement("div",null,y)),t.createElement("div",{className:"xh-form-input-main-center"},I?t.createElement("p",{className:c("xh-form-input-main-center-readonly",{"xh-form-input-main-placeholder":!h})},h||x):t.createElement("input",{ref:q,className:"xh-form-input-main-center-native",maxLength:f,name:L,pattern:g,placeholder:x,type:d,value:h,onBlur:k,onInput:V})),T&&t.createElement("div",{className:"xh-form-input-main-extra"},T)),t.createElement("div",{className:"xh-form-input-right"},N,B&&t.createElement("i",{className:"arrow"})))}));export{u as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/FormInput/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useRef,\n useImperativeHandle,\n forwardRef,\n} from \"react\";\nimport {\n Input,\n View,\n Text,\n InputProps,\n CommonEventFunction,\n} from \"@tarojs/components\";\nimport classNames from \"classnames\";\nimport { inputRange } from \"../../utils/index\";\n\nimport \"./index.scss\";\n\nexport type HTMLFormType =\n | \"tel\"\n | \"text\"\n | \"number\"\n | \"password\"\n | \"idcard\"\n | \"digit\"\n | \"safe-password\"\n | \"nickname\";\n\nexport type FormInputProps = {\n onChange?: (value: string) => void;\n onBlur?: (value: string) => void;\n /** 当键盘输入时,触发input事件,event.detail = {value, cursor, keyCode},处理函数可以直接 return 一个字符串,将替换输入框的内容。\n * @supported weapp, h5, rn\n */\n onInput?: CommonEventFunction<InputProps.inputEventDetail>;\n\n /** 输入框聚焦时触发,event.detail = { value, height },height 为键盘高度\n * @supported weapp, h5, rn\n */\n onFocus?: CommonEventFunction<InputProps.inputForceEventDetail>;\n\n /** 输入框失去焦点时触发\n *\n * event.detail = {value: value}\n * @supported weapp, h5, rn\n */\n value?: string;\n maxlength?: number;\n placeholder?: string;\n type?: HTMLFormType;\n pattern?: string;\n RightComponent?: ReactNode;\n label?: string;\n labelHtml?: string;\n LeftComponent?: ReactNode;\n LeftIcon?: ReactNode;\n name?: string;\n readonly?: boolean;\n withArrow?: boolean;\n direction?: \"row\" | \"column\";\n border?: boolean;\n mainExtra?: ReactNode;\n padding?: boolean;\n password?: boolean;\n focus?: boolean;\n /** 设置键盘右下角按钮的文字\n * @default done\n * @supported weapp, rn\n */\n confirmType?: \"send\" | \"search\" | \"next\" | \"go\" | \"done\";\n /** 用于透传 `WebComponents` 上的属性到内部 H5 标签上\n * @supported h5\n */\n nativeProps?: Record<string, unknown>;\n};\n\nexport type FocusHandler = { focus: () => void };\n\nconst FormInput = forwardRef<FocusHandler, FormInputProps>((props, formRef) => {\n const {\n onChange,\n maxlength,\n value,\n type,\n placeholder,\n label,\n labelHtml,\n RightComponent,\n onBlur,\n pattern,\n LeftComponent,\n LeftIcon,\n name,\n readonly = false,\n withArrow = false,\n direction = \"row\",\n border = true,\n mainExtra,\n padding = false,\n ...rest\n } = props;\n\n function handleChange(e): any {\n let inputValue = inputRange(e.target.value);\n e.target.value = inputValue;\n onChange && onChange(inputValue);\n }\n\n function handleBlur(e): any {\n let inputValue = inputRange(e.target.value);\n onBlur && onBlur(inputValue);\n }\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n useImperativeHandle(formRef, () => ({\n focus() {\n inputRef.current?.focus();\n },\n }));\n\n const wrapperCls = classNames(\"xh-form-input\", {\n column: direction === \"column\",\n border,\n padding,\n });\n\n if (process.env.TARO_ENV !== \"h5\") {\n return (\n <View className={wrapperCls}>\n <View className=\"xh-form-input-main\">\n <View className=\"xh-form-input-main-left\">\n {label && (\n <View className=\"xh-form-input-main-left-label\">\n {label}\n {LeftIcon && (\n <View className=\"xh-form-input-main-left-label-icon\">\n {LeftIcon}\n </View>\n )}\n </View>\n )}\n {labelHtml && (\n <label\n dangerouslySetInnerHTML={{ __html: labelHtml }}\n className=\"label\"\n />\n )}\n <View>{LeftComponent}</View>\n </View>\n <View className=\"xh-form-input-main-center\">\n {readonly ? (\n <Text\n className={classNames(\"xh-form-input-readonly\", {\n \"xh-form-input-placeholder\": !value,\n })}\n >\n {value || placeholder}\n </Text>\n ) : (\n <Input\n {...rest}\n ref={inputRef}\n className=\"xh-form-input-main-center-native\"\n maxlength={maxlength}\n name={name}\n placeholder={placeholder}\n type={type as InputProps[\"type\"]}\n value={value}\n onBlur={handleBlur}\n onInput={handleChange}\n />\n )}\n </View>\n {mainExtra && (\n <View className=\"xh-form-input-main-extra\">{mainExtra}</View>\n )}\n </View>\n <View className=\"xh-form-input-right\">\n {RightComponent}\n {withArrow && <View className=\"arrow\" />}\n </View>\n </View>\n );\n }\n\n return (\n <div className={wrapperCls}>\n <div className=\"xh-form-input-main\">\n <div className=\"xh-form-input-main-left\">\n {label && (\n <label className=\"xh-form-input-main-left-label\">\n {label}\n {LeftIcon && (\n <div className=\"xh-form-input-main-left-label-icon\">\n {LeftIcon}\n </div>\n )}\n </label>\n )}\n {labelHtml && (\n <label\n dangerouslySetInnerHTML={{ __html: labelHtml }}\n className=\"label\"\n />\n )}\n <div>{LeftComponent}</div>\n </div>\n <div className=\"xh-form-input-main-center\">\n {readonly ? (\n <p\n className={classNames(\"xh-form-input-main-center-readonly\", {\n \"xh-form-input-main-placeholder\": !value,\n })}\n >\n {value || placeholder}\n </p>\n ) : (\n <input\n ref={inputRef}\n className=\"xh-form-input-main-center-native\"\n maxLength={maxlength}\n name={name}\n pattern={pattern}\n placeholder={placeholder}\n type={type}\n value={value}\n onBlur={handleBlur}\n onInput={handleChange}\n />\n )}\n </div>\n {mainExtra && (\n <div className=\"xh-form-input-main-extra\">{mainExtra}</div>\n )}\n </div>\n <div className=\"xh-form-input-right\">\n {RightComponent}\n {withArrow && <span className=\"arrow\" />}\n </div>\n </div>\n );\n});\nexport default FormInput;\n"],"names":["FormInput","forwardRef","props","formRef","onChange","maxlength","value","type","placeholder","label","labelHtml","RightComponent","onBlur","pattern","LeftComponent","LeftIcon","name","_a","readonly","_b","withArrow","_c","direction","_d","border","mainExtra","_e","padding","rest","__rest","handleChange","e","inputValue","inputRange","target","handleBlur","inputRef","useRef","useImperativeHandle","focus","current","wrapperCls","classNames","column","process","env","TARO_ENV","React","createElement","View","className","dangerouslySetInnerHTML","__html","Text","Input","ref","onInput","maxLength"],"mappings":"iSA8EA,IAAMA,EAAYC,GAAyC,SAACC,EAAOC,GAE/D,IAAAC,EAoBEF,EApBME,SACRC,EAmBEH,EAAKG,UAlBPC,EAkBEJ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W,KAAMA,EACNH,QAASA,EACTL,YAAaA,EACbD,KAAMA,EACND,MAAOA,EACPM,OAAQuB,EACRqB,QAAS1B,KAIdL,GACCsB,EAAAC,cAAA,MAAA,CAAKE,UAAU,4BAA4BzB,IAG/CsB,EAAKC,cAAA,MAAA,CAAAE,UAAU,uBACZvC,EACAS,GAAa2B,wBAAMG,UAAU,WAItC"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/FormInput/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useRef,\n useImperativeHandle,\n forwardRef,\n} from \"react\";\nimport {\n Input,\n View,\n Text,\n InputProps,\n CommonEventFunction,\n} from \"@tarojs/components\";\nimport classNames from \"classnames\";\nimport { inputRange } from \"../../utils/index\";\n\nimport \"./index.scss\";\n\nexport type HTMLFormType =\n | \"tel\"\n | \"text\"\n | \"number\"\n | \"password\"\n | \"idcard\"\n | \"digit\"\n | \"safe-password\"\n | \"nickname\";\n\nexport type FormInputProps = {\n onChange?: (value: string) => void;\n onBlur?: (value: string) => void;\n /** 当键盘输入时,触发input事件,event.detail = {value, cursor, keyCode},处理函数可以直接 return 一个字符串,将替换输入框的内容。\n * @supported weapp, h5, rn\n */\n onInput?: CommonEventFunction<InputProps.inputEventDetail>;\n\n /** 输入框聚焦时触发,event.detail = { value, height },height 为键盘高度\n * @supported weapp, h5, rn\n */\n onFocus?: CommonEventFunction<InputProps.inputForceEventDetail>;\n\n /** 输入框失去焦点时触发\n *\n * event.detail = {value: value}\n * @supported weapp, h5, rn\n */\n value?: string;\n maxlength?: number;\n placeholder?: string;\n type?: HTMLFormType;\n pattern?: string;\n RightComponent?: ReactNode;\n label?: string;\n labelHtml?: string;\n LeftComponent?: ReactNode;\n LeftIcon?: ReactNode;\n name?: string;\n readonly?: boolean;\n withArrow?: boolean;\n direction?: \"row\" | \"column\";\n border?: boolean;\n mainExtra?: ReactNode;\n padding?: boolean;\n password?: boolean;\n focus?: boolean;\n /** 设置键盘右下角按钮的文字\n * @default done\n * @supported weapp, rn\n */\n confirmType?: \"send\" | \"search\" | \"next\" | \"go\" | \"done\";\n /** 用于透传 `WebComponents` 上的属性到内部 H5 标签上\n * @supported h5\n */\n nativeProps?: Record<string, unknown>;\n};\n\nexport type FocusHandler = { focus: () => void };\n\nconst FormInput = forwardRef<FocusHandler, FormInputProps>((props, formRef) => {\n const {\n onChange,\n maxlength,\n value,\n type,\n placeholder,\n label,\n labelHtml,\n RightComponent,\n onBlur,\n pattern,\n LeftComponent,\n LeftIcon,\n name,\n readonly = false,\n withArrow = false,\n direction = \"row\",\n border = true,\n mainExtra,\n padding = false,\n ...rest\n } = props;\n\n function handleChange(e): any {\n let inputValue = inputRange(e.target.value);\n e.target.value = inputValue;\n onChange && onChange(inputValue);\n }\n\n function handleBlur(e): any {\n let inputValue = inputRange(e.target.value);\n onBlur && onBlur(inputValue);\n }\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n useImperativeHandle(formRef, () => ({\n focus() {\n inputRef.current!.focus();\n },\n }));\n\n const wrapperCls = classNames(\"xh-form-input\", {\n column: direction === \"column\",\n border,\n padding,\n });\n\n if (process.env.TARO_ENV !== \"h5\") {\n return (\n <View className={wrapperCls}>\n <View className=\"xh-form-input-main\">\n <View className=\"xh-form-input-main-left\">\n {label && (\n <View className=\"xh-form-input-main-left-label\">\n {label}\n {LeftIcon && (\n <View className=\"xh-form-input-main-left-label-icon\">\n {LeftIcon}\n </View>\n )}\n </View>\n )}\n {labelHtml && (\n <label\n dangerouslySetInnerHTML={{ __html: labelHtml }}\n className=\"label\"\n />\n )}\n <View>{LeftComponent}</View>\n </View>\n <View className=\"xh-form-input-main-center\">\n {readonly ? (\n <Text\n className={classNames(\"xh-form-input-readonly\", {\n \"xh-form-input-placeholder\": !value,\n })}\n >\n {value || placeholder}\n </Text>\n ) : (\n <Input\n {...rest}\n ref={inputRef}\n className=\"xh-form-input-main-center-native\"\n maxlength={maxlength}\n name={name}\n placeholder={placeholder}\n type={type as InputProps[\"type\"]}\n value={value}\n onBlur={handleBlur}\n onInput={handleChange}\n />\n )}\n </View>\n {mainExtra && (\n <View className=\"xh-form-input-main-extra\">{mainExtra}</View>\n )}\n </View>\n <View className=\"xh-form-input-right\">\n {RightComponent}\n {withArrow && <View className=\"arrow\" />}\n </View>\n </View>\n );\n }\n\n return (\n <div className={wrapperCls}>\n <div className=\"xh-form-input-main\">\n <div className=\"xh-form-input-main-left\">\n {label && (\n <label className=\"xh-form-input-main-left-label\">\n {label}\n {LeftIcon && (\n <div className=\"xh-form-input-main-left-label-icon\">\n {LeftIcon}\n </div>\n )}\n </label>\n )}\n {labelHtml && (\n <label\n dangerouslySetInnerHTML={{ __html: labelHtml }}\n className=\"label\"\n />\n )}\n <div>{LeftComponent}</div>\n </div>\n <div className=\"xh-form-input-main-center\">\n {readonly ? (\n <p\n className={classNames(\"xh-form-input-main-center-readonly\", {\n \"xh-form-input-main-placeholder\": !value,\n })}\n >\n {value || placeholder}\n </p>\n ) : (\n <input\n ref={inputRef}\n className=\"xh-form-input-main-center-native\"\n maxLength={maxlength}\n name={name}\n pattern={pattern}\n placeholder={placeholder}\n type={type}\n value={value}\n onBlur={handleBlur}\n onInput={handleChange}\n />\n )}\n </div>\n {mainExtra && (\n <div className=\"xh-form-input-main-extra\">{mainExtra}</div>\n )}\n </div>\n <div className=\"xh-form-input-right\">\n {RightComponent}\n {withArrow && <i className=\"arrow\" />}\n </div>\n </div>\n );\n});\nexport default FormInput;\n"],"names":["FormInput","forwardRef","props","formRef","onChange","maxlength","value","type","placeholder","label","labelHtml","RightComponent","onBlur","pattern","LeftComponent","LeftIcon","name","_a","readonly","_b","withArrow","_c","direction","_d","border","mainExtra","_e","padding","rest","__rest","handleChange","e","inputValue","inputRange","target","handleBlur","inputRef","useRef","useImperativeHandle","focus","current","wrapperCls","classNames","column","process","env","TARO_ENV","React","createElement","View","className","dangerouslySetInnerHTML","__html","Text","Input","ref","onInput","maxLength"],"mappings":"iSA8EA,IAAMA,EAAYC,GAAyC,SAACC,EAAO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,UAAU,mCACVO,UAAWpD,EACXW,KAAMA,EACNH,QAASA,EACTL,YAAaA,EACbD,KAAMA,EACND,MAAOA,EACPM,OAAQuB,EACRqB,QAAS1B,KAIdL,GACCsB,EAAAC,cAAA,MAAA,CAAKE,UAAU,4BAA4BzB,IAG/CsB,EAAKC,cAAA,MAAA,CAAAE,UAAU,uBACZvC,EACAS,GAAa2B,qBAAGG,UAAU,WAInC"}
@@ -1,2 +1,2 @@
1
- import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{useState as n,useEffect as o}from"react";import r from"classnames";import{View as a}from"@tarojs/components";import s from"../node_modules/react-transition-group/esm/CSSTransition.js";var l=function(l){var m=l.onBlur,c=l.show,i=l.maxLength,u=void 0===i?Number.MAX_SAFE_INTEGER:i,d=l.showClose,p=void 0===d||d,v=l.closeOnClickSpace,b=void 0===v||v,h=l.onClose,f=l.onChange,y=l.value,x=l.title,E=void 0===x?"安全键盘":x,k=l.closeText,N=void 0===k?"收起":k,C=l.className,g=e(n(y),2),_=g[0],S=g[1],T=function(){for(var e=[],t=1;t<=9;t++)e.push({text:t,value:t,type:"number"});return e.push({text:"",value:"",type:"none"},{text:0,value:0,type:"number"},{text:"",value:"",type:"delete"}),e}();function j(e){h&&h(e),m&&m(e)}o((function(){return b&&document.addEventListener("click",j),function(){document.removeEventListener("click",j)}}),[]),o((function(){S(y)}),[y]);var A=r("xh-number-keyboard",C);return t.createElement(s,{classNames:"slide-up",in:c,unmountOnExit:!0,timeout:200},t.createElement(a,{className:A},t.createElement(a,{className:"xh-number-keyboard-header"},t.createElement(a,{className:"xh-number-keyboard-header-title"},E),p&&t.createElement(a,{className:"xh-number-keyboard-header-close",onClick:j},N)),t.createElement(a,{className:"xh-number-keyboard-body"},T.map((function(e,n){return t.createElement(a,{key:n,className:r("xh-number-keyboard-body-key",{none:"none"===e.type,delete:"delete"===e.type}),onClick:function(t){!function(e,t){var n=t.type,o=t.value;if("h5"===process.env.TARO_ENV&&e.stopImmediatePropagation(),"none"!==n){var r=_;"delete"===n?r=_.slice(0,_.length-1):r.length<u&&(r=_+o),S(r),f&&f(r)}}(t,e)}},e.text)})))))};export{l as default};
1
+ import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{useState as n,useEffect as o}from"react";import r from"classnames";import{View as a}from"@tarojs/components";import s from"../node_modules/react-transition-group/esm/CSSTransition.js";var m=function(m){var l=m.onBlur,c=m.show,u=m.maxLength,i=void 0===u?Number.MAX_SAFE_INTEGER:u,d=m.showClose,p=void 0===d||d,v=m.closeOnClickSpace,b=void 0===v||v,f=m.onClose,y=m.onChange,h=m.value,x=m.className,E=e(n(h),2),k=E[0],N=E[1],C=function(){for(var e=[],t=1;t<=9;t++)e.push({text:t,value:t,type:"number"});return e.push({text:"",value:"",type:"none"},{text:0,value:0,type:"number"},{text:"",value:"",type:"delete"}),e}();function g(e){f&&f(e),l&&l(e)}o((function(){return b&&document.addEventListener("click",g),function(){document.removeEventListener("click",g)}}),[]),o((function(){N(h)}),[h]);var _=r("xh-number-keyboard",x);return t.createElement(s,{classNames:"slide-up",in:c,unmountOnExit:!0,timeout:200},t.createElement(a,{className:_},t.createElement(a,{className:"xh-number-keyboard-header"},p&&t.createElement(a,{className:"xh-number-keyboard-close",onClick:g},"完成")),t.createElement(a,{className:"xh-number-keyboard-body"},C.map((function(e,n){return t.createElement(a,{key:n,className:r("xh-number-keyboard-body-key",{none:"none"===e.type,delete:"delete"===e.type}),onClick:function(t){!function(e,t){var n=t.type,o=t.value;if("h5"===process.env.TARO_ENV&&e.stopImmediatePropagation(),"none"!==n){var r=k;"delete"===n?r=k.slice(0,k.length-1):r.length<i&&(r=k+o),N(r),y&&y(r)}}(t,e)}},e.text)})))))};export{m as default};
2
2
  //# sourceMappingURL=index.js.map