@gm-pc/react 1.24.7-beta.8 → 1.24.7
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gm-pc/react",
|
|
3
|
-
"version": "1.24.7
|
|
3
|
+
"version": "1.24.7",
|
|
4
4
|
"description": "观麦前端基础组件库",
|
|
5
5
|
"author": "liyatang <liyatang@qq.com>",
|
|
6
6
|
"homepage": "https://github.com/gmfe/gm-pc#readme",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@gm-common/hooks": "^2.10.0",
|
|
26
26
|
"@gm-common/tool": "^2.10.0",
|
|
27
|
-
"@gm-pc/locales": "^1.24.7
|
|
27
|
+
"@gm-pc/locales": "^1.24.7",
|
|
28
28
|
"big.js": "^6.0.1",
|
|
29
29
|
"classnames": "^2.2.5",
|
|
30
30
|
"lodash": "^4.17.19",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-router-dom": "^5.2.0",
|
|
49
49
|
"react-window": "^1.8.5"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "3bada70ae395c8d15bca5579f0ecdbed0bb4b6f8"
|
|
52
52
|
}
|
|
@@ -10,6 +10,10 @@ import { Button } from '../button'
|
|
|
10
10
|
interface InnerProps extends ConfirmProps {
|
|
11
11
|
resolve: any
|
|
12
12
|
reject: any
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated
|
|
15
|
+
* 这个没用
|
|
16
|
+
* */
|
|
13
17
|
confirmLoading?: boolean
|
|
14
18
|
}
|
|
15
19
|
|
|
@@ -22,28 +26,42 @@ const Inner: FC<InnerProps> = ({
|
|
|
22
26
|
resolve,
|
|
23
27
|
reject,
|
|
24
28
|
confirmLoading,
|
|
29
|
+
onOk,
|
|
30
|
+
onCancel,
|
|
25
31
|
}) => {
|
|
26
32
|
const [checked, setChecked] = useState<boolean>(false)
|
|
27
33
|
|
|
28
34
|
const readText = _.isString(read) ? read : getLocale('我已阅读以上提示,确认删除')
|
|
35
|
+
const [loading, setLoading] = useState<boolean>(false)
|
|
36
|
+
|
|
37
|
+
const handleOk = async () => {
|
|
38
|
+
const fn = onOk || resolve
|
|
39
|
+
try {
|
|
40
|
+
setLoading(true)
|
|
41
|
+
await fn()
|
|
42
|
+
Dialog.hide()
|
|
43
|
+
} finally {
|
|
44
|
+
setLoading(false)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
29
47
|
|
|
30
48
|
const buttons: DialogButtonProps[] = [
|
|
31
49
|
{
|
|
32
50
|
text: cancelBtnText || getLocale('取消'),
|
|
33
51
|
btnType: 'default',
|
|
34
52
|
onClick() {
|
|
35
|
-
reject
|
|
53
|
+
const fn = onCancel || reject
|
|
54
|
+
|
|
55
|
+
fn(new Error('cancel'))
|
|
56
|
+
|
|
36
57
|
Dialog.hide()
|
|
37
58
|
},
|
|
38
59
|
},
|
|
39
60
|
{
|
|
40
61
|
text: okBtnText || getLocale('确定'),
|
|
41
62
|
btnType: okBtnType || 'primary',
|
|
42
|
-
onClick
|
|
43
|
-
|
|
44
|
-
Dialog.hide()
|
|
45
|
-
},
|
|
46
|
-
loading: confirmLoading,
|
|
63
|
+
onClick: handleOk,
|
|
64
|
+
loading: loading,
|
|
47
65
|
disabled: read ? !checked : false,
|
|
48
66
|
},
|
|
49
67
|
]
|
|
@@ -64,9 +82,8 @@ const Inner: FC<InnerProps> = ({
|
|
|
64
82
|
key={btn.text}
|
|
65
83
|
type={btn.btnType}
|
|
66
84
|
disabled={btn.disabled}
|
|
67
|
-
onClick={() =>
|
|
68
|
-
|
|
69
|
-
}}
|
|
85
|
+
onClick={() => btn.onClick()}
|
|
86
|
+
loading={btn.loading}
|
|
70
87
|
className='gm-margin-left-10'
|
|
71
88
|
>
|
|
72
89
|
{btn.text}
|