taro-react-uilib 1.3.1 → 1.3.2-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +111 -3
- package/dist/components/ActionSheet/index.js +2 -0
- package/dist/components/ActionSheet/index.js.map +1 -0
- package/dist/components/ActivityIndicator/index.js +2 -0
- package/dist/components/ActivityIndicator/index.js.map +1 -0
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Captcha/index.js +1 -1
- package/dist/components/Captcha/index.js.map +1 -1
- package/dist/components/Cell/index.js +2 -0
- package/dist/components/Cell/index.js.map +1 -0
- package/dist/components/Dialog/Alert/index.js +1 -1
- package/dist/components/Dialog/Alert/index.js.map +1 -1
- package/dist/components/Dialog/Confirm/index.js +1 -1
- package/dist/components/Dialog/Confirm/index.js.map +1 -1
- package/dist/components/DialogComponent/index.js.map +1 -1
- package/dist/components/DialogRef/index.js +1 -1
- package/dist/components/DialogRef/index.js.map +1 -1
- package/dist/components/FormInput/index.js +1 -1
- package/dist/components/FormInput/index.js.map +1 -1
- package/dist/components/Icon/index.js +2 -0
- package/dist/components/Icon/index.js.map +1 -0
- package/dist/components/NumberKeyboard/index.js +1 -1
- package/dist/components/NumberKeyboard/index.js.map +1 -1
- package/dist/components/Radio/index.js +1 -1
- package/dist/components/Radio/index.js.map +1 -1
- package/dist/components/Rank/index.js +2 -0
- package/dist/components/Rank/index.js.map +1 -0
- package/dist/components/Tabbar/index.js.map +1 -1
- package/dist/components/Tabbar/tabbar/TabItem.js.map +1 -1
- package/dist/components/Tabbar/tabbar/Tabbar.js.map +1 -1
- package/dist/components/src/index.js +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +6 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/styles/components/actionsheet.scss +121 -0
- package/dist/styles/components/activityindicator.scss +43 -0
- package/dist/styles/components/amountinput.scss +5 -6
- package/dist/styles/components/amountkeyboard.scss +33 -14
- package/dist/styles/components/badge.scss +0 -1
- package/dist/styles/components/bankicon.scss +1 -1
- package/dist/styles/components/button.scss +7 -5
- package/dist/styles/components/captcha.scss +8 -3
- package/dist/styles/components/cell.scss +113 -0
- package/dist/styles/components/checkbox.scss +4 -5
- package/dist/styles/components/dialog.scss +14 -14
- package/dist/styles/components/dialogref.scss +11 -29
- package/dist/styles/components/font/iconfont.ttf +0 -0
- package/dist/styles/components/font/iconfont.woff +0 -0
- package/dist/styles/components/font/iconfont.woff2 +0 -0
- package/dist/styles/components/forminput.scss +25 -13
- package/dist/styles/components/icon.scss +34 -4
- package/dist/styles/components/index.scss +4 -0
- package/dist/styles/components/list.scss +17 -5
- package/dist/styles/components/loading.scss +1 -9
- package/dist/styles/components/mask.scss +1 -1
- package/dist/styles/components/navbar.scss +1 -0
- package/dist/styles/components/numberkeyboard.scss +47 -36
- package/dist/styles/components/page.scss +2 -2
- package/dist/styles/components/passwordinput.scss +1 -1
- package/dist/styles/components/picker.scss +0 -1
- package/dist/styles/components/popup.scss +2 -3
- package/dist/styles/components/progress.scss +2 -2
- package/dist/styles/components/radio.scss +5 -6
- package/dist/styles/components/rank.scss +50 -0
- package/dist/styles/components/tabbar.scss +3 -0
- package/dist/styles/components/toast.scss +0 -1
- package/dist/styles/themes/default.scss +17 -8
- package/dist/styles/themes/variable.scss +8 -0
- package/lib/components/ActionSheet/index.js +57 -0
- package/lib/components/ActionSheet/index.js.map +1 -0
- package/lib/components/ActivityIndicator/index.js +14 -0
- package/lib/components/ActivityIndicator/index.js.map +1 -0
- package/lib/components/Button/index.js +2 -2
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Captcha/index.js +2 -2
- package/lib/components/Captcha/index.js.map +1 -1
- package/lib/components/Cell/index.js +27 -0
- package/lib/components/Cell/index.js.map +1 -0
- package/lib/components/Dialog/Alert/index.js +3 -3
- package/lib/components/Dialog/Alert/index.js.map +1 -1
- package/lib/components/Dialog/Confirm/index.js +2 -2
- package/lib/components/Dialog/Confirm/index.js.map +1 -1
- package/lib/components/DialogComponent/index.js +0 -2
- package/lib/components/DialogComponent/index.js.map +1 -1
- package/lib/components/DialogRef/index.js +3 -11
- package/lib/components/DialogRef/index.js.map +1 -1
- package/lib/components/FormInput/index.js +3 -2
- package/lib/components/FormInput/index.js.map +1 -1
- package/lib/components/Icon/index.js +3 -2
- package/lib/components/Icon/index.js.map +1 -1
- package/lib/components/NumberKeyboard/index.js +4 -2
- package/lib/components/NumberKeyboard/index.js.map +1 -1
- package/lib/components/Radio/index.js +1 -1
- package/lib/components/Radio/index.js.map +1 -1
- package/lib/components/Rank/index.js +22 -0
- package/lib/components/Rank/index.js.map +1 -0
- package/lib/components/Tabbar/index.js +1 -0
- package/lib/components/Tabbar/index.js.map +1 -1
- package/lib/components/Tabbar/tabbar/TabItem.js +0 -1
- package/lib/components/Tabbar/tabbar/TabItem.js.map +1 -1
- package/lib/components/Tabbar/tabbar/Tabbar.js +0 -1
- package/lib/components/Tabbar/tabbar/Tabbar.js.map +1 -1
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/types/components/ActionSheet/index.d.ts +1 -0
- package/types/components/ActivityIndicator/index.d.ts +11 -0
- package/types/components/Button/index.d.ts +2 -1
- package/types/components/Captcha/index.d.ts +1 -1
- package/types/components/Cell/index.d.ts +29 -0
- package/types/components/Icon/index.d.ts +3 -1
- package/types/components/NumberKeyboard/index.d.ts +2 -0
- package/types/components/Tabbar/index.d.ts +1 -0
- package/types/components/Tabbar/tabbar/TabItem.d.ts +0 -1
- package/types/components/Tabbar/tabbar/Tabbar.d.ts +0 -1
- package/types/index.d.ts +5 -0
- package/dist/styles/components/images/backspace.png +0 -0
- package/dist/styles/components/images/closeKeyboard.png +0 -0
- package/dist/styles/components/images/icon-arrow-right.png +0 -0
- package/dist/styles/components/images/loading.png +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,63 @@
|
|
|
1
|
-
## [1.3.1](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0...v1.3.1) (2023-
|
|
1
|
+
## [1.3.2-1](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.2-0...v1.3.2-1) (2023-07-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* cell content固定宽度 ([6d998c4](https://code.xhdev.xyz/h5group/taro-uilib/commits/6d998c47e90ebda8d0afe7f502625b3a2d6d05a0))
|
|
7
|
+
* 去掉所有图片改用icon ([f87d12d](https://code.xhdev.xyz/h5group/taro-uilib/commits/f87d12d39264aeacae35220a7760dd573d18a559))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* actionsheet inline模式 ([d6b4ac5](https://code.xhdev.xyz/h5group/taro-uilib/commits/d6b4ac56bcdc57af9092d847d4c5bc58f1a3edf8))
|
|
13
|
+
* add Cell ([6f79e20](https://code.xhdev.xyz/h5group/taro-uilib/commits/6f79e20acba10d7db41de78a826b0c4f33655c27))
|
|
14
|
+
* alert样式修改 ([d1dab6d](https://code.xhdev.xyz/h5group/taro-uilib/commits/d1dab6d4c9b4b709bd0377d8b62da48aea65f7b3))
|
|
15
|
+
* button 变量修改 ([54d9198](https://code.xhdev.xyz/h5group/taro-uilib/commits/54d9198388022d66afe0a96850acd0706e6d9833))
|
|
16
|
+
* 增加cell、activityindicator、button优化 ([177fb35](https://code.xhdev.xyz/h5group/taro-uilib/commits/177fb3537bd25bb67f152e3570c88950c377019b))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# [1.3.0-9](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0...v1.3.0-9) (2023-06-16)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* 抖音小程序上的兼容问题 ([1ccdae1](https://code.xhdev.xyz/h5group/taro-uilib/commits/1ccdae18e5bb7c8b36420d3c9d5c66af770e6c43))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# [1.3.0-8](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0-7...v1.3.0-8) (2023-06-14)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* numberkeyboard ([6633cc8](https://code.xhdev.xyz/h5group/taro-uilib/commits/6633cc8676d71a564d7416a08b7ceda037844c51))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
* actionsheet组件、、rank组件 ([46b5dcd](https://code.xhdev.xyz/h5group/taro-uilib/commits/46b5dcd09300006ba12cc9adb1ea899aa61aa0a9))
|
|
40
|
+
* radio 默认圆形 ([c070363](https://code.xhdev.xyz/h5group/taro-uilib/commits/c070363288a1032cbcaa3c4b5d6d77dfab54290c))
|
|
41
|
+
* 主色调更新、优化captcha组件 ([680707e](https://code.xhdev.xyz/h5group/taro-uilib/commits/680707ef5e5e8c35be01125a1a567ea9070b8a2a))
|
|
42
|
+
* 增加action组件、增加icon ([db09cdd](https://code.xhdev.xyz/h5group/taro-uilib/commits/db09cddee336cdfb4965c4dc39c9907bdd95f8ea))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Performance Improvements
|
|
46
|
+
|
|
47
|
+
* button ghost diaddialog优化 ([628ed11](https://code.xhdev.xyz/h5group/taro-uilib/commits/628ed11cac10014cd47776f98abfac0b401fda79))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## [1.3.2-0](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.1...v1.3.2-0) (2023-06-16)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
* 借款金额键盘键盘在小程序的UI问题修复 ([bd96e97](https://code.xhdev.xyz/h5group/taro-uilib/commits/bd96e974eced8b6be8a7941bd98becf4d50dd5c8))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## [1.3.1](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0-9...v1.3.1) (2023-06-16)
|
|
2
61
|
|
|
3
62
|
|
|
4
63
|
### Bug Fixes
|
|
@@ -7,18 +66,67 @@
|
|
|
7
66
|
|
|
8
67
|
|
|
9
68
|
|
|
10
|
-
# [1.3.0](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0
|
|
69
|
+
# [1.3.0-9](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0...v1.3.0-9) (2023-06-16)
|
|
11
70
|
|
|
12
71
|
|
|
13
72
|
### Bug Fixes
|
|
14
73
|
|
|
15
|
-
*
|
|
74
|
+
* 抖音小程序上的兼容问题 ([1ccdae1](https://code.xhdev.xyz/h5group/taro-uilib/commits/1ccdae18e5bb7c8b36420d3c9d5c66af770e6c43))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# [1.3.0-8](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0-7...v1.3.0-8) (2023-06-14)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Bug Fixes
|
|
82
|
+
|
|
83
|
+
* numberkeyboard ([6633cc8](https://code.xhdev.xyz/h5group/taro-uilib/commits/6633cc8676d71a564d7416a08b7ceda037844c51))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Features
|
|
87
|
+
|
|
88
|
+
* actionsheet组件、、rank组件 ([46b5dcd](https://code.xhdev.xyz/h5group/taro-uilib/commits/46b5dcd09300006ba12cc9adb1ea899aa61aa0a9))
|
|
89
|
+
* radio 默认圆形 ([c070363](https://code.xhdev.xyz/h5group/taro-uilib/commits/c070363288a1032cbcaa3c4b5d6d77dfab54290c))
|
|
90
|
+
* 主色调更新、优化captcha组件 ([680707e](https://code.xhdev.xyz/h5group/taro-uilib/commits/680707ef5e5e8c35be01125a1a567ea9070b8a2a))
|
|
91
|
+
* 增加action组件、增加icon ([db09cdd](https://code.xhdev.xyz/h5group/taro-uilib/commits/db09cddee336cdfb4965c4dc39c9907bdd95f8ea))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### Performance Improvements
|
|
95
|
+
|
|
96
|
+
* button ghost diaddialog优化 ([628ed11](https://code.xhdev.xyz/h5group/taro-uilib/commits/628ed11cac10014cd47776f98abfac0b401fda79))
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
# [1.3.0](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0-8...v1.3.0) (2023-06-15)
|
|
16
101
|
|
|
17
102
|
|
|
18
103
|
### Features
|
|
19
104
|
|
|
20
105
|
* badge、amountkeyboard在抖音上的边框问题 ([b7d1179](https://code.xhdev.xyz/h5group/taro-uilib/commits/b7d117931cb355f402bc28b1da174a8e51617286))
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# [1.3.0-8](https://code.xhdev.xyz/h5group/taro-uilib/compare/v1.3.0-7...v1.3.0-8) (2023-06-14)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### Bug Fixes
|
|
113
|
+
|
|
114
|
+
* navbar arrow ([085dd2b](https://code.xhdev.xyz/h5group/taro-uilib/commits/085dd2bc98df7a1249b86808378e7933e0fcdab2))
|
|
115
|
+
* numberkeyboard ([6633cc8](https://code.xhdev.xyz/h5group/taro-uilib/commits/6633cc8676d71a564d7416a08b7ceda037844c51))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Features
|
|
119
|
+
|
|
120
|
+
* actionsheet组件、、rank组件 ([46b5dcd](https://code.xhdev.xyz/h5group/taro-uilib/commits/46b5dcd09300006ba12cc9adb1ea899aa61aa0a9))
|
|
21
121
|
* navbar适配 ([ee6ab17](https://code.xhdev.xyz/h5group/taro-uilib/commits/ee6ab17e766d849c9223582e8e3431315163b289))
|
|
122
|
+
* radio 默认圆形 ([c070363](https://code.xhdev.xyz/h5group/taro-uilib/commits/c070363288a1032cbcaa3c4b5d6d77dfab54290c))
|
|
123
|
+
* 主色调更新、优化captcha组件 ([680707e](https://code.xhdev.xyz/h5group/taro-uilib/commits/680707ef5e5e8c35be01125a1a567ea9070b8a2a))
|
|
124
|
+
* 增加action组件、增加icon ([db09cdd](https://code.xhdev.xyz/h5group/taro-uilib/commits/db09cddee336cdfb4965c4dc39c9907bdd95f8ea))
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Performance Improvements
|
|
128
|
+
|
|
129
|
+
* button ghost diaddialog优化 ([628ed11](https://code.xhdev.xyz/h5group/taro-uilib/commits/628ed11cac10014cd47776f98abfac0b401fda79))
|
|
22
130
|
|
|
23
131
|
|
|
24
132
|
|
|
@@ -0,0 +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 a from"classnames";import{View as c}from"@tarojs/components";import l from"../Popup/index.js";var i=function(i){var s=i.visible,r=void 0!==s&&s,m=i.title,u=i.description,h=i.data,d=void 0===h?[]:h,f=i.onConfirm,p=i.onCancel,E=i.className,x=i.children,v=i.style,N=i.mode,C=i.submitText,k=void 0===C?"提交":C,b=i.cancelText,g=void 0===b?"取消":b,y=i.showCancel,j=void 0!==y&&y,T=i.renderItem,P=i.ItemWrapper,_=i.onSubmit,w=i.onClick,A=i.showClose,I=void 0!==A&&A,O=i.justifyContent,R=void 0===O?"center":O,V=i.inline,F=void 0!==V&&V,S=e(n(r),2),W=S[0],q=S[1],z=function(e){null==p||p(e),null==w||w(!1),q(!1)};o((function(){q(r)}),[r]);var B=function(){null==_||_()},D=function(){return d.map((function(e,n){return T?T(e,n):t.createElement(c,{className:a("xh-action-sheet-panel-item",R),key:n,onClick:function(){!function(e,t){null==f||f(e,t),q(!1)}(e,n)}},"string"==typeof e?e:e.text)}))};return t.createElement(c,{className:a("xh-action",{inline:F}),onClick:function(){w?w(!r):d.length<=0||q(!0)}},t.createElement(l,{visible:W},t.createElement(c,{className:a("xh-action-sheet",E,N),style:v},t.createElement(c,{className:"xh-action-sheet-header"},t.createElement(c,{className:"xh-action-sheet-header-title"},m),t.createElement(c,{className:"xh-action-sheet-header-desc"},u),(I||"controlled"===N&&!j)&&t.createElement(c,{className:"xh-action-sheet-header-close",onClick:function(){return z()}})),t.createElement(c,{className:a("xh-action-sheet-panel",{panel:!T}),onClick:function(e){return"h5"!==process.env.TARO_ENV&&e.stopPropagation()}},P?t.createElement(P,null,D()):t.createElement(t.Fragment,null,D())),t.createElement(c,{className:"xh-action-sheet-action",onClick:function(e){return"h5"!==process.env.TARO_ENV&&e.stopPropagation()}},"controlled"===N?t.createElement(c,null,t.createElement(c,{className:"xh-action-sheet-action-submit",onClick:B},k),j&&t.createElement(c,{className:"xh-action-sheet-action-cancel mode",onClick:function(){return z(!0)}},g)):t.createElement(c,{className:"xh-action-sheet-action-cancel",onClick:function(){return z(!0)}},g)))),x)};export{i as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/ActionSheet/index.tsx"],"sourcesContent":["import React, { useState, ReactNode, ReactElement, useEffect } from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\n\nimport Popup from \"../Popup\";\nimport \"./index.scss\";\n\nexport interface ActionSheetOption {\n text: ReactNode;\n value: string | number;\n [key: string]: any;\n}\n\nexport type ActionValue = string | ActionSheetOption;\nexport interface ActionProps<T extends ActionValue = ActionValue> {\n visible?: boolean;\n title?: ReactNode;\n data: T[];\n defaultValueData?: (string | number)[];\n className?: string;\n style?: React.CSSProperties;\n onConfirm?: (selectedValue: T, index: number) => void;\n onCancel?: (bottom?: boolean) => void;\n onClose?: () => void;\n onClick?: (flag: boolean) => void;\n children?: ReactNode;\n description?: ReactNode;\n /**\n * @summary controlled模式下,组件为受控组件,需要外部来显示和隐藏\n * @description submit 模式下会显示提交按钮,可以自定义,也可以显示取消按钮但是得传进来一个Toggle事件用来显示隐藏\n */\n mode?: \"controlled\";\n cancelText?: ReactNode;\n /**\n * submit模式下,默认不展示取消按钮,可以设置\n */\n showCancel?: boolean;\n submitText?: string;\n renderItem?: (item: T, index: number) => ReactNode;\n ItemWrapper?: React.FC<{}>;\n onSubmit?: () => void;\n justifyContent?: \"start\" | \"end\";\n /**\n * 显示右上角的关闭、默认只有不显示下面的取消的时候才出现\n */\n showClose?: boolean;\n inline?: boolean;\n}\n\nconst ActionSheet = <T extends ActionValue>(\n props: ActionProps<T>\n): ReactElement => {\n const {\n visible = false,\n title,\n description,\n data = [],\n onConfirm,\n onCancel,\n className,\n children,\n style,\n mode,\n submitText = \"提交\",\n cancelText = \"取消\",\n showCancel = false,\n renderItem,\n ItemWrapper,\n onSubmit,\n onClick,\n showClose = false,\n justifyContent = \"center\",\n inline = false,\n } = props;\n\n const [innerVisible, setInnerVisible] = useState(visible);\n\n const handleCancel = (bottom?: boolean) => {\n onCancel?.(bottom);\n onClick?.(false);\n setInnerVisible(false);\n };\n\n useEffect(() => {\n setInnerVisible(visible);\n }, [visible]);\n\n const handleClick = () => {\n if (onClick) {\n onClick(!visible);\n return;\n }\n if (data.length <= 0) return;\n setInnerVisible(true);\n };\n\n const handleConfirm = (item: T, index: number) => {\n onConfirm?.(item, index);\n setInnerVisible(false);\n };\n\n const handleSubmit = () => {\n onSubmit?.();\n };\n\n const submitButton = () => {\n return (\n <View>\n <View className=\"xh-action-sheet-action-submit\" onClick={handleSubmit}>\n {submitText}\n </View>\n {showCancel && (\n <View\n className=\"xh-action-sheet-action-cancel mode\"\n onClick={() => handleCancel(true)}\n >\n {cancelText}\n </View>\n )}\n </View>\n );\n };\n\n const itemRender = () =>\n data.map((item, index) => {\n return renderItem ? (\n renderItem(item, index)\n ) : (\n <View\n className={classNames(\"xh-action-sheet-panel-item\", justifyContent)}\n key={index}\n onClick={() => {\n handleConfirm(item, index);\n }}\n >\n {typeof item === \"string\" ? item : item.text}\n </View>\n );\n });\n\n return (\n <View className={classNames(\"xh-action\", { inline })} onClick={handleClick}>\n <Popup visible={innerVisible}>\n <View\n className={classNames(\"xh-action-sheet\", className, mode)}\n style={style}\n >\n <View className=\"xh-action-sheet-header\">\n <View className=\"xh-action-sheet-header-title\">{title}</View>\n <View className=\"xh-action-sheet-header-desc\">{description}</View>\n {(showClose || (mode === \"controlled\" && !showCancel)) && (\n <View\n className=\"xh-action-sheet-header-close\"\n onClick={() => handleCancel()}\n ></View>\n )}\n </View>\n <View\n className={classNames(\"xh-action-sheet-panel\", {\n panel: !renderItem,\n })}\n onClick={e => process.env.TARO_ENV !== \"h5\" && e.stopPropagation()}\n >\n {ItemWrapper ? (\n <ItemWrapper>{itemRender()}</ItemWrapper>\n ) : (\n <React.Fragment>{itemRender()}</React.Fragment>\n )}\n </View>\n <View\n className=\"xh-action-sheet-action\"\n onClick={e => process.env.TARO_ENV !== \"h5\" && e.stopPropagation()}\n >\n {mode === \"controlled\" ? (\n submitButton()\n ) : (\n <View\n className=\"xh-action-sheet-action-cancel\"\n onClick={() => handleCancel(true)}\n >\n {cancelText}\n </View>\n )}\n </View>\n </View>\n </Popup>\n {children}\n </View>\n );\n};\n\nexport default ActionSheet;\n"],"names":["ActionSheet","props","_a","visible","title","description","_b","data","onConfirm","onCancel","className","children","style","mode","_c","submitText","_d","cancelText","_e","showCancel","renderItem","ItemWrapper","onSubmit","onClick","_f","showClose","_g","justifyContent","_h","inline","_j","__read","useState","innerVisible","setInnerVisible","handleCancel","bottom","useEffect","handleSubmit","itemRender","map","item","index","React","createElement","View","classNames","key","handleConfirm","text","length","Popup","panel","e","process","env","TARO_ENV","stopPropagation","Fragment"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import a from"react";import t from"classnames";import{View as e}from"@tarojs/components";var i=function(i){var c=i.className,r=i.style,m=i.slot,s=t("xh-activity-indicator",c);return a.createElement(e,{className:s,style:r},a.createElement(e,{className:"xh-activity-indicator-main"}),a.createElement(e,{className:"xh-activity-indicator-main"}),a.createElement(e,{className:"xh-activity-indicator-main"}),m)};export{i as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/ActivityIndicator/index.tsx"],"sourcesContent":["import React, { CSSProperties, FC, ReactNode } from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport \"./index.scss\";\n\nexport type LoadingProps = {\n color?: string;\n tip?: string | ReactNode;\n style?: CSSProperties;\n slot?: ReactNode;\n} & XHComponentCommonProps;\n\nconst Activityindicator: FC<LoadingProps> = ({ className, style, slot }) => {\n const cls = classNames(\"xh-activity-indicator\", className);\n\n return (\n <View className={cls} style={style}>\n <View className=\"xh-activity-indicator-main\"></View>\n <View className=\"xh-activity-indicator-main\"></View>\n <View className=\"xh-activity-indicator-main\"></View>\n {slot}\n </View>\n );\n};\n\nexport default Activityindicator;\n"],"names":["Activityindicator","_a","className","style","slot","cls","classNames","React","createElement","View"],"mappings":"yFAaM,IAAAA,EAAsC,SAACC,GAAE,IAAAC,cAAWC,EAAKF,EAAAE,MAAEC,EAAIH,EAAAG,KAC7DC,EAAMC,EAAW,wBAAyBJ,GAEhD,OACEK,EAACC,cAAAC,EAAK,CAAAP,UAAWG,EAAKF,MAAOA,GAC3BI,EAAAC,cAACC,EAAI,CAACP,UAAU,+BAChBK,EAAAC,cAACC,EAAI,CAACP,UAAU,+BAChBK,EAAAC,cAACC,EAAI,CAACP,UAAU,+BACfE,EAGP"}
|
|
@@ -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,_=i(),
|
|
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};
|
|
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\"
|
|
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,2 +1,2 @@
|
|
|
1
|
-
import{__rest as
|
|
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};
|
|
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 ...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
|
|
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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from"react";import{View as l,Text as c}from"@tarojs/components";import a from"classnames";var t=function(t){var o=t.icon,r=t.value,n=t.extraIcon,s=t.arrow,i=t.border,m=void 0===i||i,d=t.onClick,p=t.className,u=t.outline,h=void 0===u||u,v=t.descriptionColor,x=void 0===v?"":v,E=t.valueColor,N=t.ellipsis,f=void 0===N||N,b=t.content,y=t.contentDescription,C=t.description,k=t.subDescription,w=t.secondary,D=t.alignItems,I=void 0===D?o?"start":"center":D,g=t.placeholder,j=void 0===g?"":g,q=a("xh-cell",{border:m},{secondary:w},{outline:h},I,p),z=a("xh-cell-main",{ellipsis:f});return e.createElement(l,{className:q,onClick:function(e){d&&d(e)}},o&&e.createElement(l,{className:"xh-cell-icon"},o),e.createElement(l,{className:z},b&&e.createElement(c,{className:"xh-cell-main-content"},b),y&&e.createElement(c,{className:"xh-cell-main-description"},y)),e.createElement(l,{className:"xh-cell-description",style:{color:x}},C?e.createElement(c,null,C):e.createElement(c,{className:"xh-cell-description-placeholder"},j),e.createElement(c,{className:"xh-cell-description-sub"},k)),e.createElement(l,{className:"xh-cell-value"},e.createElement(l,{className:"xh-cell-value-info",style:{color:E}},r),e.createElement(l,{className:"xh-cell-value-icon"},n||s&&e.createElement(l,{className:"arrow"}))))};export{t as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Cell/index.tsx"],"sourcesContent":["import React, { FC, ReactNode } from \"react\";\nimport { View, Text, ITouchEvent } from \"@tarojs/components\";\nimport classNames from \"classnames\";\nimport { StandardLonghandProperties } from \"csstype\";\nimport { XHComponentCommonProps } from \"../../types\";\n\nimport \"./index.scss\";\n\nexport type XHCellProps = {\n content?: ReactNode;\n contentDescription?: ReactNode;\n description?: ReactNode;\n subDescription?: ReactNode;\n icon?: ReactNode;\n value?: ReactNode;\n extraIcon?: ReactNode;\n border?: boolean;\n arrow?: boolean;\n outline?: boolean;\n onClick?: (e: ITouchEvent) => void;\n descriptionColor?: StandardLonghandProperties[\"color\"];\n valueColor?: StandardLonghandProperties[\"color\"];\n ellipsis?: boolean;\n placeholder?: string;\n alignItems?: \"start\" | \"center\" | \"end\";\n /**\n * @description 是否是次级列表\n */\n secondary?: boolean;\n} & XHComponentCommonProps;\n\nconst XHCell: FC<XHCellProps> = props => {\n const {\n icon,\n value,\n extraIcon,\n arrow,\n border = true,\n onClick,\n className,\n outline = true,\n descriptionColor = \"\",\n valueColor,\n ellipsis = true,\n content,\n contentDescription,\n description,\n subDescription,\n secondary,\n alignItems = icon ? \"start\" : \"center\",\n placeholder = \"\",\n } = props;\n\n const cellcls = classNames(\n \"xh-cell\",\n { border },\n { secondary },\n { outline },\n alignItems,\n className\n );\n\n const mainCls = classNames(\"xh-cell-main\", {\n ellipsis,\n });\n\n const handleClick = (e: ITouchEvent) => {\n onClick && onClick(e);\n };\n\n return (\n <View className={cellcls} onClick={handleClick}>\n {icon && <View className=\"xh-cell-icon\">{icon}</View>}\n <View className={mainCls}>\n {content && <Text className=\"xh-cell-main-content\">{content}</Text>}\n {contentDescription && (\n <Text className=\"xh-cell-main-description\">{contentDescription}</Text>\n )}\n </View>\n <View className=\"xh-cell-description\" style={{ color: descriptionColor }}>\n {description ? (\n <Text>{description}</Text>\n ) : (\n <Text className=\"xh-cell-description-placeholder\">{placeholder}</Text>\n )}\n <Text className=\"xh-cell-description-sub\">{subDescription}</Text>\n </View>\n <View className=\"xh-cell-value\">\n <View className=\"xh-cell-value-info\" style={{ color: valueColor }}>\n {value}\n </View>\n <View className=\"xh-cell-value-icon\">\n {extraIcon ? extraIcon : arrow && <View className=\"arrow\" />}\n </View>\n </View>\n </View>\n );\n};\nexport default XHCell;\n"],"names":["XHCell","props","icon","value","extraIcon","arrow","_a","border","onClick","className","_b","outline","_c","descriptionColor","valueColor","_d","ellipsis","content","contentDescription","description","subDescription","secondary","_e","alignItems","_f","placeholder","cellcls","classNames","mainCls","React","createElement","View","e","Text","style","color"],"mappings":"mGA+BM,IAAAA,EAA0B,SAAAC,GAE5B,IAAAC,EAkBED,EAlBEC,KACJC,EAiBEF,EAAKE,MAhBPC,EAgBEH,EAhBOG,UACTC,EAeEJ,EAAKI,MAdPC,EAcEL,EAAKM,OAdPA,OAAS,IAAAD,GAAIA,EACbE,EAaEP,EAbKO,QACPC,EAYER,EAAKQ,UAXPC,EAWET,EAAKU,QAXPA,OAAU,IAAAD,GAAIA,EACdE,EAUEX,EAVmBY,iBAArBA,OAAgB,IAAAD,EAAG,GAAEA,EACrBE,EASEb,aARFc,EAQEd,EAAKe,SARPA,OAAW,IAAAD,GAAIA,EACfE,EAOEhB,EAAKgB,QANPC,EAMEjB,EANgBiB,mBAClBC,EAKElB,EAAKkB,YAJPC,EAIEnB,EAJYmB,eACdC,EAGEpB,EAAKoB,UAFPC,EAEErB,EAAKsB,WAFPA,OAAa,IAAAD,EAAApB,EAAO,QAAU,SAAQoB,EACtCE,EACEvB,EADcwB,YAAhBA,OAAW,IAAAD,EAAG,GAAEA,EAGZE,EAAUC,EACd,UACA,CAAEpB,OAAMA,GACR,CAAEc,UAASA,GACX,CAAEV,QAAOA,GACTY,EACAd,GAGImB,EAAUD,EAAW,eAAgB,CACzCX,SAAQA,IAOV,OACEa,EAACC,cAAAC,EAAK,CAAAtB,UAAWiB,EAASlB,QALR,SAACwB,GACnBxB,GAAWA,EAAQwB,EACrB,GAIK9B,GAAQ2B,gBAACE,EAAI,CAACtB,UAAU,gBAAgBP,GACzC2B,EAAAC,cAACC,EAAI,CAACtB,UAAWmB,GACdX,GAAWY,gBAACI,EAAI,CAACxB,UAAU,wBAAwBQ,GACnDC,GACCW,EAACC,cAAAG,EAAK,CAAAxB,UAAU,4BAA4BS,IAGhDW,EAAAC,cAACC,EAAI,CAACtB,UAAU,sBAAsByB,MAAO,CAAEC,MAAOtB,IACnDM,EACCU,gBAACI,EAAI,KAAEd,GAEPU,EAACC,cAAAG,EAAK,CAAAxB,UAAU,mCAAmCgB,GAErDI,EAACC,cAAAG,GAAKxB,UAAU,2BAA2BW,IAE7CS,EAAAC,cAACC,EAAI,CAACtB,UAAU,iBACdoB,EAAAC,cAACC,EAAI,CAACtB,UAAU,qBAAqByB,MAAO,CAAEC,MAAOrB,IAClDX,GAEH0B,EAACC,cAAAC,EAAK,CAAAtB,UAAU,sBACbL,GAAwBC,GAASwB,EAAAC,cAACC,EAAI,CAACtB,UAAU,YAK5D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as
|
|
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};
|
|
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 = \"
|
|
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,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
|
|
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};
|
|
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 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","
|
|
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 +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
|
|
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,2 +1,2 @@
|
|
|
1
|
-
import{__read as e
|
|
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,x=o.showCancel,v=void 0===x||x,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=e(n(!1),2),S=z[0],_=z[1];a(f,(function(){return{close:B,open:M}}));var B=function(){y&&y(),_(!1)},M=function(){_(!0)};r((function(){g||y&&y(),_(g)}),[g]);var q=s("xh-dialog-ref",h,{show:S}),A=t.createElement(c,{className:"xh-dialog-ref-content-footer-buttons"},v&&t.createElement(l,{ghost:!0,size:"full",shape:"rectangle",preventTime:0,onClick:function(){w&&w(),B()},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:q},t.createElement(i,null),t.createElement(m,{in:S,timeout:200,classNames:"scale"},t.createElement(c,{className:"xh-dialog-ref-content"},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"},A))))}));export{f 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
|
|
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} & 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\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=\"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","dialogFooter","React","createElement","View","Button","ghost","size","shape","preventTime","onClick","type","Mask","CSSTransition","in","timeout"],"mappings":"yWAgCA,IAAMA,EAAYC,GAAoC,SAACC,EAAOC,GAE1D,IAAAC,EAWEF,EAAKE,OAVPC,EAUEH,EAAKG,QATPC,EASEJ,EATYK,UAAdA,OAAY,IAAAD,EAAA,GAAEA,EACdE,EAQEN,EARKM,QACPC,EAOEP,EAAKQ,WAPPA,cAAiBD,EACjBE,EAMET,EANgBU,YAAlBA,OAAW,IAAAD,EAAG,KAAIA,EAClBE,EAKEX,EALeY,WAAjBA,OAAU,IAAAD,EAAG,KAAIA,EACjBE,EAIEb,SAJFc,OAAS,IAAAD,KACTE,EAGEf,YAFFgB,EAEEhB,WADFiB,EACEjB,UACEkB,EAAAC,EAAgCC,GAAS,GAAM,GAA9CC,EAAWH,EAAA,GAAEI,OAEpBC,EAAoBtB,GAAS,WAAM,MAAC,CAClCuB,MAAKA,EACLC,KAAIA,EACJ,IAEF,IAAMD,EAAQ,WACZP,GAAWA,IACXK,GAAe,EACjB,EAEMG,EAAO,WACXH,GAAe,EACjB,EAWAI,GAAU,WACHpB,GACHW,GAAWA,IAEbK,EAAehB,EACjB,GAAG,CAACA,IAEJ,IAAMqB,EAAYC,EAAW,gBAAiBvB,EAAW,CACvDwB,KAAMR,IAGFS,EACJC,EAAAC,cAACC,EAAK,CAAA5B,UAAU,wCACbG,GACCuB,EAACC,cAAAE,EACC,CAAAC,OACA,EAAAC,KAAK,OACLC,MAAM,YACNC,YAAa,EACbC,QAxBa,WACnBvB,GAAYA,IACZQ,GACF,EAsBQnB,UAAU,+CAETO,GAGLmB,EAAAC,cAACE,EAAM,CACLM,KAAK,UACLH,MAAM,YACND,KAAK,OACLD,OAAK,EACL9B,UAAU,gDACVkC,QAxCgB,WACpBxB,GAAaA,GAEf,EAsCMuB,YAAa,GAEZ5B,IAmBP,OAbEqB,EAAAC,cAACC,EAAK,CAAA5B,UAAWsB,GACfI,EAAAC,cAACS,EAAO,MACRV,EAAAC,cAACU,EAAa,CAACC,GAAItB,EAAauB,QAAS,IAAKhB,WAAW,SACvDG,EAAAC,cAACC,EAAI,CAAC5B,UAAU,yBACd0B,EAAAC,cAACC,EAAK,CAAA5B,UAAU,gCAAgCH,GAChD6B,EAAAC,cAACC,EAAK,CAAA5B,UAAU,iCAAiCF,GAChDW,GACCiB,EAAAC,cAACC,EAAI,CAAC5B,UAAU,gCAAgCyB,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,
|
|
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};
|
|
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
|
|
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":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__rest as o,__assign as s}from"../node_modules/tslib/tslib.es6.js";import e from"react";import r from"classnames";import{pxTransform as t}from"../src/utils/index.js";var i=function(i){var c=i.icon,a=void 0===c?"":c,l=i.size,m=void 0===l?0:l,n=i.className,f=i.color,d=i.style,p=o(i,["icon","size","className","color","style"]),u=a&&"xh-icon-".concat(a),v=r("xh-icon",u,n),x=s(s({},d),{fontSize:t(m),color:f});return e.createElement("span",s({className:v},{style:x},p))};export{i as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Icon/index.tsx"],"sourcesContent":["import React from \"react\";\nimport classNames from \"classnames\";\nimport { pxTransform } from \"@/utils\";\nimport type { StandardLonghandProperties } from \"csstype\";\nimport { XHComponentCommonProps } from \"../../types\";\n\nimport \"./index.scss\";\n\nexport type XHIcon =\n | \"prompt\"\n | \"score\"\n | \"info\"\n | \"failure\"\n | \"success\"\n | \"loading\"\n | \"back\"\n | \"notice\"\n | \"scan\"\n | \"light\"\n | \"faceScan\"\n | \"delete\"\n | \"radioFull\"\n | \"checkboxFull\"\n | \"checkedSquare\"\n | \"checked2\"\n | \"arrowTop\"\n | \"notice2\"\n | \"position\"\n | \"contacts\"\n | \"billFull\"\n | \"bill2\"\n | \"bill3\"\n | \"bill4\"\n | \"edit\"\n | \"editFull\"\n | \"camera\"\n | \"close\"\n | \"gift\"\n | \"message\"\n | \"user\"\n | \"wenhao\"\n | \"kefu\"\n | \"user\"\n | \"play\"\n | \"arrowLeft\"\n | \"arrowRight\"\n | \"keyboardClose\";\n\nexport type XHIconProps = {\n icon: XHIcon;\n size?: number;\n color?: StandardLonghandProperties[\"color\"];\n style?: React.CSSProperties;\n onClick?: () => void;\n} & XHComponentCommonProps;\n\nconst Icon: React.FC<XHIconProps> = props => {\n const { icon = \"\", size = 0, className, color, style, ...rest } = props;\n\n const fixIcon = icon && `xh-icon-${icon}`;\n const iconCls = classNames(\"xh-icon\", fixIcon, className);\n\n const finalStyle: React.CSSProperties = {\n ...style,\n fontSize: pxTransform(size),\n color,\n };\n\n return <span className={iconCls} {...{ style: finalStyle }} {...rest} />;\n};\n\nexport default Icon;\n"],"names":["Icon","props","_a","icon","_b","size","className","color","style","rest","__rest","fixIcon","concat","iconCls","classNames","finalStyle","__assign","fontSize","pxTransform","React","createElement"],"mappings":"6KAwDM,IAAAA,EAA8B,SAAAC,GAC1B,IAAAC,EAA0DD,EAAKE,KAA/DA,aAAO,GAAED,EAAEE,EAA+CH,EAAvCI,KAARA,OAAO,IAAAD,EAAA,IAAGE,EAAqCL,YAA1BM,EAA0BN,EAAKM,MAAxBC,EAAmBP,EAAKO,MAAdC,EAAIC,EAAKT,EAA5D,CAAA,OAAA,OAAA,YAAA,QAAA,UAEAU,EAAUR,GAAQ,WAAWS,OAAAT,GAC7BU,EAAUC,EAAW,UAAWH,EAASL,GAEzCS,EAAUC,EAAAA,EAAA,CAAA,EACXR,GAAK,CACRS,SAAUC,EAAYb,GACtBE,MAAKA,IAGP,OAAOY,EAAMC,cAAA,OAAAJ,EAAA,CAAAV,UAAWO,GAAa,CAAEL,MAAOO,GAAkBN,GAClE"}
|
|
@@ -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
|
|
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};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|