@gm-pc/react 1.21.1-alpha.4 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gm-pc/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
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.
|
|
27
|
+
"@gm-pc/locales": "^1.22.0",
|
|
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": "89bf53db3f0327b2352131bf15ea1d038b021f4a"
|
|
52
52
|
}
|
|
@@ -4,6 +4,7 @@ import Dialog from './dialog'
|
|
|
4
4
|
import { PromptProps } from './types'
|
|
5
5
|
import { getLocale } from '@gm-pc/locales'
|
|
6
6
|
import { Input } from '../input'
|
|
7
|
+
import { ConfigProvider } from '../config_provider'
|
|
7
8
|
|
|
8
9
|
const Prompt = (props: string | PromptProps): Promise<string> => {
|
|
9
10
|
let p = props
|
|
@@ -20,6 +21,7 @@ const Prompt = (props: string | PromptProps): Promise<string> => {
|
|
|
20
21
|
defaultValue,
|
|
21
22
|
placeholder,
|
|
22
23
|
onValidate,
|
|
24
|
+
fontSize,
|
|
23
25
|
...rest
|
|
24
26
|
} = p as PromptProps
|
|
25
27
|
|
|
@@ -43,24 +45,26 @@ const Prompt = (props: string | PromptProps): Promise<string> => {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
const child = (
|
|
46
|
-
<
|
|
48
|
+
<ConfigProvider fontSize={fontSize}>
|
|
47
49
|
<div>
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
<div>
|
|
51
|
+
<Input
|
|
52
|
+
type='text'
|
|
53
|
+
defaultValue={value}
|
|
54
|
+
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
55
|
+
value = e.target.value
|
|
56
|
+
}}
|
|
57
|
+
placeholder={placeholder}
|
|
58
|
+
onKeyDown={(e: KeyboardEvent) => {
|
|
59
|
+
if (e.key === 'Enter') {
|
|
60
|
+
handleOk()
|
|
61
|
+
}
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
{children}
|
|
61
66
|
</div>
|
|
62
|
-
|
|
63
|
-
</div>
|
|
67
|
+
</ConfigProvider>
|
|
64
68
|
)
|
|
65
69
|
|
|
66
70
|
Dialog.render({
|
|
@@ -4,6 +4,7 @@ import Alert from './alert'
|
|
|
4
4
|
import Confirm from './confirm'
|
|
5
5
|
import Prompt from './prompt'
|
|
6
6
|
import Delete from './delete_com'
|
|
7
|
+
import { ConfigProvider } from '../config_provider'
|
|
7
8
|
|
|
8
9
|
export const ComDialog = () => {
|
|
9
10
|
return (
|
|
@@ -156,6 +157,7 @@ export const ComPrompt = () => {
|
|
|
156
157
|
<button
|
|
157
158
|
onClick={() => {
|
|
158
159
|
Prompt({
|
|
160
|
+
fontSize: 'sm',
|
|
159
161
|
size: 'sm',
|
|
160
162
|
children: '请填写,< 5 不通过',
|
|
161
163
|
// @ts-ignore
|
|
@@ -182,6 +184,12 @@ export const ComPrompt = () => {
|
|
|
182
184
|
)
|
|
183
185
|
}
|
|
184
186
|
|
|
187
|
+
export const ComPromptFontSize = () => (
|
|
188
|
+
<ConfigProvider fontSize='sm'>
|
|
189
|
+
<ComPrompt />
|
|
190
|
+
</ConfigProvider>
|
|
191
|
+
)
|
|
192
|
+
|
|
185
193
|
export default {
|
|
186
194
|
title: '反馈/Dialog',
|
|
187
195
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react'
|
|
2
2
|
import { ButtonType } from '../button'
|
|
3
|
+
import { ConfigProviderProps } from '../config_provider'
|
|
3
4
|
|
|
4
5
|
type DialogSize = 'sm' | 'md' | 'lg' | 'xl'
|
|
5
6
|
|
|
@@ -12,7 +13,7 @@ interface DialogButtonProps {
|
|
|
12
13
|
disabled?: boolean
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
interface DialogProps {
|
|
16
|
+
interface DialogProps extends ConfigProviderProps {
|
|
16
17
|
title?: string
|
|
17
18
|
size?: DialogSize
|
|
18
19
|
buttons?: DialogButtonProps[]
|
|
@@ -42,7 +43,7 @@ interface ConfirmProps extends SpecificDialogProps {
|
|
|
42
43
|
read?: boolean | string
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
interface PromptProps extends ConfirmProps {
|
|
46
|
+
interface PromptProps extends ConfirmProps, ConfigProviderProps {
|
|
46
47
|
defaultValue?: string
|
|
47
48
|
placeholder?: string
|
|
48
49
|
}
|
|
@@ -5,6 +5,7 @@ import Overlay from './overlay'
|
|
|
5
5
|
import { Button } from '../button'
|
|
6
6
|
import { getLocale } from '@gm-pc/locales'
|
|
7
7
|
import { IconDownUp } from '../icon_down_up'
|
|
8
|
+
import { ConfigConsumer, ConfigProvider } from '../config_provider'
|
|
8
9
|
|
|
9
10
|
interface InnerProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
11
|
disabled: boolean
|
|
@@ -59,16 +60,24 @@ class FunctionSet extends Component<FunctionSetProps> {
|
|
|
59
60
|
return null
|
|
60
61
|
}
|
|
61
62
|
return (
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
<ConfigConsumer>
|
|
64
|
+
{(config) => (
|
|
65
|
+
<Popover
|
|
66
|
+
ref={this._popoverRef}
|
|
67
|
+
popup={
|
|
68
|
+
<ConfigProvider {...config}>
|
|
69
|
+
<Overlay data={newData} onSelect={this._handleSelect} isReverse={right} />
|
|
70
|
+
</ConfigProvider>
|
|
71
|
+
}
|
|
72
|
+
right={right}
|
|
73
|
+
type='hover'
|
|
74
|
+
disabled={disabled}
|
|
75
|
+
pureContainer
|
|
76
|
+
>
|
|
77
|
+
<Inner disabled={!!disabled}>{children}</Inner>
|
|
78
|
+
</Popover>
|
|
79
|
+
)}
|
|
80
|
+
</ConfigConsumer>
|
|
72
81
|
)
|
|
73
82
|
}
|
|
74
83
|
}
|