@hw-component/form 1.9.60 → 1.9.62
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/.eslintcache +1 -1
- package/es/Form/config.d.ts +1 -1
- package/es/Form/modal.d.ts +1 -1
- package/es/Input/InputNumberGroup.js +72 -104
- package/es/InputGroup/index.d.ts +10 -0
- package/es/InputGroup/index.js +67 -0
- package/es/Text/index.d.ts +1 -1
- package/es/TextArea/index.d.ts +1 -1
- package/es/hooks/index.js +1 -1
- package/es/index.css +23 -25
- package/es/index.d.ts +2 -1
- package/es/index.js +1 -0
- package/lib/Form/config.d.ts +1 -1
- package/lib/Form/modal.d.ts +1 -1
- package/lib/Input/InputNumberGroup.js +76 -108
- package/lib/InputGroup/index.d.ts +10 -0
- package/lib/InputGroup/index.js +70 -0
- package/lib/Text/index.d.ts +1 -1
- package/lib/TextArea/index.d.ts +1 -1
- package/lib/index.css +23 -25
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -4
- package/package.json +1 -1
- package/src/components/DialogForm/DrawerForm/index.tsx +6 -6
- package/src/components/DialogForm/hooks.tsx +3 -3
- package/src/components/Form/hooks/useHForm.ts +2 -2
- package/src/components/Form/modal.ts +2 -2
- package/src/components/Input/InputNumberGroup.tsx +57 -73
- package/src/components/Input/index.less +4 -17
- package/src/components/InputGroup/index.less +26 -0
- package/src/components/InputGroup/index.tsx +53 -0
- package/src/components/Text/index.tsx +9 -7
- package/src/components/TextArea/index.less +6 -6
- package/src/components/TextArea/index.tsx +14 -8
- package/src/components/index.tsx +1 -0
- package/src/components/styles/index.less +1 -14
- package/src/pages/DrawerForm/index.tsx +9 -3
- package/src/pages/Form/index.tsx +10 -126
- package/src/pages/Input/index.tsx +2 -2
- package/src/pages/InputNumberGroup/index.tsx +7 -1
- package/src/pages/ModalForm/index.tsx +22 -11
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { InputNumber
|
|
1
|
+
import { InputNumber } from "antd";
|
|
2
2
|
import { SwapRightOutlined } from "@ant-design/icons";
|
|
3
3
|
import React, { useMemo, useState } from "react";
|
|
4
4
|
import type { InputNumberProps } from "antd/lib/input-number";
|
|
5
5
|
import { useClassName } from "../hooks";
|
|
6
6
|
import type { addFormatItemModal, HItemProps } from "@/components/Form/modal";
|
|
7
7
|
import HFormConnect from "../Form/HFormConnect";
|
|
8
|
-
|
|
8
|
+
import InputGroup from "../InputGroup";
|
|
9
9
|
interface IProps<T = any> {
|
|
10
10
|
placeholder?: [string, string] | string;
|
|
11
11
|
addonAfter?: React.ReactNode;
|
|
@@ -15,7 +15,7 @@ interface IProps<T = any> {
|
|
|
15
15
|
};
|
|
16
16
|
inputNumberProps?: [InputNumberProps, InputNumberProps] | InputNumberProps;
|
|
17
17
|
value?: T;
|
|
18
|
-
onChange
|
|
18
|
+
onChange?: (value: T) => void;
|
|
19
19
|
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
20
20
|
noHandlerWrap?: boolean;
|
|
21
21
|
disabled?: boolean;
|
|
@@ -31,21 +31,8 @@ const useArrayProps = (props: any) => {
|
|
|
31
31
|
return [props, props];
|
|
32
32
|
}, [props]);
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (!children) {
|
|
37
|
-
return <></>;
|
|
38
|
-
}
|
|
39
|
-
if (React.isValidElement(children)) {
|
|
40
|
-
return (
|
|
41
|
-
<div className={addonClassname}>
|
|
42
|
-
{React.cloneElement(children as any, { value, onChange })}
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
return <div className={addonClassname}>{children}</div>;
|
|
47
|
-
};
|
|
48
|
-
const InputNumberGroup = ({
|
|
34
|
+
|
|
35
|
+
const Content = ({
|
|
49
36
|
value = {},
|
|
50
37
|
valueMap = { min: "min", max: "max" },
|
|
51
38
|
onChange,
|
|
@@ -64,10 +51,8 @@ const InputNumberGroup = ({
|
|
|
64
51
|
const [fsPlaceholder, edPlaceholder] = useArrayProps(placeholder);
|
|
65
52
|
const [fsProps, edProps] = useArrayProps(inputNumberProps);
|
|
66
53
|
const [focus, setFocus] = useState(false);
|
|
67
|
-
const
|
|
68
|
-
const bodyClassname = useClassName(["hw-input-group-body"]);
|
|
54
|
+
const bodyClassname = useClassName(["hw-input-group-number-body"]);
|
|
69
55
|
const activeClassname = useClassName(["hw-input-group-active"]);
|
|
70
|
-
const borderClassname = useClassName(["hw-input-group-border"]);
|
|
71
56
|
const oneClassname = useClassName(["hw-input-group-one"]);
|
|
72
57
|
const iconClassname = useClassName(["hw-input-group-icon"]);
|
|
73
58
|
const disabledClassname = useClassName(["hw-input-group-disabled"]);
|
|
@@ -114,65 +99,64 @@ const InputNumberGroup = ({
|
|
|
114
99
|
onChange?.(newVal);
|
|
115
100
|
};
|
|
116
101
|
return (
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
{addonBefore}
|
|
120
|
-
</Addon>
|
|
121
|
-
<div
|
|
122
|
-
className={`${bodyClassname}
|
|
102
|
+
<div
|
|
103
|
+
className={`${bodyClassname}
|
|
123
104
|
${focus ? activeClassname : ""}
|
|
124
105
|
${noHandlerWrap ? noHandlerWrapClassname : ""}
|
|
125
106
|
${disabled ? disabledClassname : notDisabledClassname}
|
|
126
107
|
`}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
<
|
|
149
|
-
<SwapRightOutlined />
|
|
150
|
-
</div>
|
|
151
|
-
<InputNumber<number>
|
|
152
|
-
bordered={false}
|
|
153
|
-
value={maxVal}
|
|
154
|
-
className={oneClassname}
|
|
155
|
-
placeholder={edPlaceholder}
|
|
156
|
-
min={minValMk ? minValMk(minVal) : minVal}
|
|
157
|
-
onFocus={() => {
|
|
158
|
-
setFocus(true);
|
|
159
|
-
}}
|
|
160
|
-
onBlur={() => {
|
|
161
|
-
setFocus(false);
|
|
162
|
-
}}
|
|
163
|
-
onChange={(val) => {
|
|
164
|
-
change(max, val);
|
|
165
|
-
}}
|
|
166
|
-
{...edProps}
|
|
167
|
-
disabled={disabled}
|
|
168
|
-
/>
|
|
108
|
+
>
|
|
109
|
+
<InputNumber<number>
|
|
110
|
+
bordered={false}
|
|
111
|
+
value={minVal}
|
|
112
|
+
max={maxValMk ? maxValMk(maxVal) : maxVal}
|
|
113
|
+
min={0}
|
|
114
|
+
className={oneClassname}
|
|
115
|
+
onFocus={() => {
|
|
116
|
+
setFocus(true);
|
|
117
|
+
}}
|
|
118
|
+
onBlur={() => {
|
|
119
|
+
setFocus(false);
|
|
120
|
+
}}
|
|
121
|
+
onChange={(val) => {
|
|
122
|
+
change(min, val);
|
|
123
|
+
}}
|
|
124
|
+
placeholder={fsPlaceholder}
|
|
125
|
+
{...fsProps}
|
|
126
|
+
disabled={disabled}
|
|
127
|
+
/>
|
|
128
|
+
<div className={iconClassname}>
|
|
129
|
+
<SwapRightOutlined />
|
|
169
130
|
</div>
|
|
170
|
-
<
|
|
171
|
-
{
|
|
172
|
-
|
|
173
|
-
|
|
131
|
+
<InputNumber<number>
|
|
132
|
+
bordered={false}
|
|
133
|
+
value={maxVal}
|
|
134
|
+
className={oneClassname}
|
|
135
|
+
placeholder={edPlaceholder}
|
|
136
|
+
min={minValMk ? minValMk(minVal) : minVal}
|
|
137
|
+
onFocus={() => {
|
|
138
|
+
setFocus(true);
|
|
139
|
+
}}
|
|
140
|
+
onBlur={() => {
|
|
141
|
+
setFocus(false);
|
|
142
|
+
}}
|
|
143
|
+
onChange={(val) => {
|
|
144
|
+
change(max, val);
|
|
145
|
+
}}
|
|
146
|
+
{...edProps}
|
|
147
|
+
disabled={disabled}
|
|
148
|
+
/>
|
|
149
|
+
</div>
|
|
174
150
|
);
|
|
175
151
|
};
|
|
152
|
+
const InputNumberGroup = (props) => {
|
|
153
|
+
return (
|
|
154
|
+
<InputGroup {...props}>
|
|
155
|
+
<Content />
|
|
156
|
+
</InputGroup>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
176
160
|
const Index = HFormConnect(InputNumberGroup);
|
|
177
161
|
export default {
|
|
178
162
|
Component: Index,
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
@import "../
|
|
2
|
-
@all-input-group: ~"@{ant-prefix}-hw-input-group";
|
|
1
|
+
@import "../InputGroup/index";
|
|
3
2
|
|
|
4
3
|
.@{all-input-group} {
|
|
5
|
-
display: flex !important;
|
|
6
|
-
width: 100%;
|
|
7
|
-
color: rgba(0, 0, 0, 0.25);
|
|
8
4
|
.@{all-input-group}-disabled {
|
|
9
5
|
background-color: #f5f5f5;
|
|
10
6
|
}
|
|
11
|
-
.@{all-input-group}-body {
|
|
12
|
-
position: relative;
|
|
7
|
+
.@{all-input-group}-number-body {
|
|
13
8
|
display: flex !important;
|
|
14
|
-
|
|
9
|
+
width: 100%;
|
|
15
10
|
border: 1px solid #d9d9d9;
|
|
16
11
|
}
|
|
17
12
|
.@{all-input-group}-not-disabled {
|
|
@@ -30,14 +25,6 @@
|
|
|
30
25
|
display: none;
|
|
31
26
|
}
|
|
32
27
|
}
|
|
33
|
-
.@{all-input-group}-border {
|
|
34
|
-
position: absolute;
|
|
35
|
-
left: -1px;
|
|
36
|
-
display: none;
|
|
37
|
-
width: 1px;
|
|
38
|
-
height: 100%;
|
|
39
|
-
background-color: #40a9ff;
|
|
40
|
-
}
|
|
41
28
|
.@{all-input-group}-icon {
|
|
42
29
|
display: flex;
|
|
43
30
|
align-items: center;
|
|
@@ -63,7 +50,7 @@
|
|
|
63
50
|
box-shadow: 0 0 0 0 !important;
|
|
64
51
|
}
|
|
65
52
|
.@{ant-prefix}-form-item-has-error {
|
|
66
|
-
.@{all-input-group}-body {
|
|
53
|
+
.@{all-input-group}-number-body {
|
|
67
54
|
border-color: #ff4d4f !important;
|
|
68
55
|
}
|
|
69
56
|
.@{all-input-group}-active {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@import "../styles/local.less";
|
|
2
|
+
@all-input-group: ~"@{ant-prefix}-hw-input-group";
|
|
3
|
+
|
|
4
|
+
.@{all-input-group} {
|
|
5
|
+
display: flex !important;
|
|
6
|
+
width: 100%;
|
|
7
|
+
color: rgba(0, 0, 0, 0.25);
|
|
8
|
+
.@{all-input-group}-body {
|
|
9
|
+
position: relative;
|
|
10
|
+
display: flex !important;
|
|
11
|
+
flex: 1;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.@{ant-prefix}-hw-addon {
|
|
16
|
+
display: flex !important;
|
|
17
|
+
align-items: center;
|
|
18
|
+
padding: 0 11px;
|
|
19
|
+
background-color: #fafafa;
|
|
20
|
+
border: 1px solid #d9d9d9;
|
|
21
|
+
}
|
|
22
|
+
.@{ant-prefix}-form-item-has-error {
|
|
23
|
+
.@{all-input-group}-body {
|
|
24
|
+
border-color: #ff4d4f !important;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useClassName } from "../hooks";
|
|
3
|
+
import { Input } from "antd";
|
|
4
|
+
interface HInputGroupProps<T = any> {
|
|
5
|
+
addonAfter?: React.ReactNode;
|
|
6
|
+
value?: T;
|
|
7
|
+
onChange?: (value: T) => void;
|
|
8
|
+
addonBefore?: React.ReactNode;
|
|
9
|
+
className?:string;
|
|
10
|
+
}
|
|
11
|
+
const Addon: React.FC<HInputGroupProps> = ({ children, value, onChange }) => {
|
|
12
|
+
const addonClassname = useClassName(["hw-addon"]);
|
|
13
|
+
if (!children) {
|
|
14
|
+
return <></>;
|
|
15
|
+
}
|
|
16
|
+
if (React.isValidElement(children)) {
|
|
17
|
+
return (
|
|
18
|
+
<div className={addonClassname}>
|
|
19
|
+
{React.cloneElement(children as any, { value, onChange })}
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return <div className={addonClassname}>{children}</div>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const Index: React.FC<HInputGroupProps> = ({
|
|
27
|
+
addonAfter,
|
|
28
|
+
addonBefore,
|
|
29
|
+
children,
|
|
30
|
+
value,
|
|
31
|
+
className="",
|
|
32
|
+
onChange,
|
|
33
|
+
...props
|
|
34
|
+
}) => {
|
|
35
|
+
const contentClassname = useClassName(["hw-input-group"]);
|
|
36
|
+
const bodyClassname = useClassName(["hw-input-group-body"]);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Input.Group compact className={`${contentClassname} ${className}`}>
|
|
40
|
+
<Addon value={value} onChange={onChange}>
|
|
41
|
+
{addonBefore}
|
|
42
|
+
</Addon>
|
|
43
|
+
<div className={bodyClassname}>
|
|
44
|
+
{React.cloneElement(children as any, { value, onChange, ...props })}
|
|
45
|
+
</div>
|
|
46
|
+
<Addon value={value} onChange={onChange}>
|
|
47
|
+
{addonAfter}
|
|
48
|
+
</Addon>
|
|
49
|
+
</Input.Group>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default Index;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Space, Typography } from "antd";
|
|
2
|
-
import { TextProps } from "antd/lib/typography/Text";
|
|
2
|
+
import type { TextProps } from "antd/lib/typography/Text";
|
|
3
3
|
import React, { useMemo } from "react";
|
|
4
|
-
const {Text}=Typography;
|
|
4
|
+
const { Text } = Typography;
|
|
5
5
|
export interface HFormTextProps<V = any> extends TextProps {
|
|
6
6
|
value?: V;
|
|
7
7
|
addonBefore?: React.ReactNode;
|
|
@@ -21,9 +21,11 @@ export default ({
|
|
|
21
21
|
}
|
|
22
22
|
return value;
|
|
23
23
|
}, [value]);
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
return (
|
|
25
|
+
<Space size={size} align={"center"}>
|
|
26
|
+
<Text {...props}>{addonBefore}</Text>
|
|
27
|
+
<Text {...props}>{text}</Text>
|
|
28
|
+
<Text {...props}>{addonAfter}</Text>
|
|
29
|
+
</Space>
|
|
30
|
+
);
|
|
29
31
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
@import "../styles/local.less";
|
|
2
2
|
|
|
3
|
-
.@{ant-prefix}-hw-text-area-no-border{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
3
|
+
.@{ant-prefix}-hw-text-area-no-border {
|
|
4
|
+
border: none !important;
|
|
5
|
+
&:focus {
|
|
6
|
+
box-shadow: none !important;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { Input } from "antd";
|
|
2
2
|
import type { TextAreaProps } from "antd/es/input";
|
|
3
|
-
import {useClassName} from "../hooks";
|
|
4
|
-
interface HTextAreaProps extends TextAreaProps{
|
|
5
|
-
|
|
3
|
+
import { useClassName } from "../hooks";
|
|
4
|
+
export interface HTextAreaProps extends TextAreaProps {
|
|
5
|
+
bordered?: boolean;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export default ({
|
|
9
9
|
autoSize = { minRows: 4, maxRows: 4 },
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
bordered = true,
|
|
11
|
+
className = "",
|
|
12
12
|
...props
|
|
13
13
|
}: HTextAreaProps) => {
|
|
14
|
-
const noBorderClassName=useClassName("hw-text-area-no-border")
|
|
15
|
-
const borderClassName
|
|
16
|
-
return
|
|
14
|
+
const noBorderClassName = useClassName("hw-text-area-no-border");
|
|
15
|
+
const borderClassName = !bordered ? noBorderClassName : "";
|
|
16
|
+
return (
|
|
17
|
+
<Input.TextArea
|
|
18
|
+
autoSize={autoSize}
|
|
19
|
+
{...props}
|
|
20
|
+
className={`${borderClassName} ${className}`}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
17
23
|
};
|
package/src/components/index.tsx
CHANGED
|
@@ -7,6 +7,7 @@ export { useHDialogForm } from "@/components/DialogForm/hooks";
|
|
|
7
7
|
export { default as HFormConnect } from "./Form/HFormConnect";
|
|
8
8
|
export { default as HFormConfigProvider } from "./Form/Context/FormConfigProvider";
|
|
9
9
|
export { default as HBasicForm } from "./Form/Basic";
|
|
10
|
+
export { default as HInputGroup } from "./InputGroup";
|
|
10
11
|
|
|
11
12
|
import ModalForm from "./DialogForm/ModalForm";
|
|
12
13
|
import DrawerForm from "./DialogForm/DrawerForm";
|
|
@@ -3,17 +3,4 @@
|
|
|
3
3
|
@import "../Input/index.less";
|
|
4
4
|
@import "../Switch/index.less";
|
|
5
5
|
@import "../TextArea/index.less";
|
|
6
|
-
|
|
7
|
-
.@{ant-prefix}-hw-addon {
|
|
8
|
-
display: flex !important;
|
|
9
|
-
align-items: center;
|
|
10
|
-
padding: 0 11px;
|
|
11
|
-
background-color: #fafafa;
|
|
12
|
-
border: 1px solid #d9d9d9;
|
|
13
|
-
}
|
|
14
|
-
.@{ant-prefix}-form-item-has-error {
|
|
15
|
-
.@{ant-prefix}-hw-addon {
|
|
16
|
-
color: #ff4d4f;
|
|
17
|
-
border-color: #ff4d4f !important;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
6
|
+
@import "../InputGroup/index.less";
|
|
@@ -78,9 +78,15 @@ export default () => {
|
|
|
78
78
|
console.log("contentRender");
|
|
79
79
|
return <div>{node}</div>;
|
|
80
80
|
}}
|
|
81
|
-
title={
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
title={
|
|
82
|
+
<div
|
|
83
|
+
onClick={() => {
|
|
84
|
+
modalForm.hide();
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
关闭
|
|
88
|
+
</div>
|
|
89
|
+
}
|
|
84
90
|
>
|
|
85
91
|
<Test1 />
|
|
86
92
|
</HDrawerForm>
|
package/src/pages/Form/index.tsx
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
HBasicForm,
|
|
3
2
|
HForm,
|
|
4
3
|
HFormConfigProvider,
|
|
5
|
-
HSwitch,
|
|
6
4
|
useHForm,
|
|
7
5
|
HSelect,
|
|
8
6
|
} from "../../components";
|
|
9
7
|
import { useState } from "react";
|
|
10
|
-
import { Button,
|
|
11
|
-
import Basic from "@/components/Form/Basic";
|
|
12
|
-
const Test2 = () => {
|
|
13
|
-
return <Row style={{ background: "red" }} />;
|
|
14
|
-
};
|
|
8
|
+
import { Button, Form, Input, Space } from "antd";
|
|
15
9
|
const Test3 = ({ value = {}, onChange }) => {
|
|
16
10
|
const { fs, end } = value;
|
|
17
11
|
return (
|
|
@@ -45,122 +39,6 @@ const TestItem = () => {
|
|
|
45
39
|
</Form.Item>
|
|
46
40
|
);
|
|
47
41
|
};
|
|
48
|
-
const Test3Item = () => {
|
|
49
|
-
return (
|
|
50
|
-
<Form.List name="users">
|
|
51
|
-
{(fields, { add, remove }) => (
|
|
52
|
-
<>
|
|
53
|
-
{fields.map(({ key, name, ...restField }) => (
|
|
54
|
-
<Form.Item {...restField} name={name} key={key}>
|
|
55
|
-
<Test3 />
|
|
56
|
-
</Form.Item>
|
|
57
|
-
))}
|
|
58
|
-
<Form.Item>
|
|
59
|
-
<Button type="dashed" onClick={() => add({})} block>
|
|
60
|
-
Add field
|
|
61
|
-
</Button>
|
|
62
|
-
</Form.Item>
|
|
63
|
-
</>
|
|
64
|
-
)}
|
|
65
|
-
</Form.List>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
const formData = (options) => {
|
|
69
|
-
return [
|
|
70
|
-
{
|
|
71
|
-
name: "name",
|
|
72
|
-
label: "name",
|
|
73
|
-
rules: [
|
|
74
|
-
{
|
|
75
|
-
validator: () => {
|
|
76
|
-
return Promise.reject(new Error("错误"));
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
itemProps: {
|
|
81
|
-
addonBefore: "前面",
|
|
82
|
-
addonAfter: "后面",
|
|
83
|
-
disabled: true,
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: "inputNumberGroup",
|
|
88
|
-
label: "inputNumber",
|
|
89
|
-
type: "inputNumberGroup",
|
|
90
|
-
rules: [
|
|
91
|
-
{
|
|
92
|
-
validator: () => {
|
|
93
|
-
return Promise.reject(new Error("错误"));
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
itemProps: {
|
|
98
|
-
addonBefore: "前面",
|
|
99
|
-
addonAfter: "后面",
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
label: "时间",
|
|
104
|
-
name: "time",
|
|
105
|
-
type: "datePicker",
|
|
106
|
-
itemProps: {
|
|
107
|
-
picker: "month",
|
|
108
|
-
placeholder: "请选择月份",
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
label: "inputSelect",
|
|
113
|
-
type: "selectInput",
|
|
114
|
-
name: "selectInput",
|
|
115
|
-
itemProps: {
|
|
116
|
-
selectProps: {
|
|
117
|
-
options: [
|
|
118
|
-
{
|
|
119
|
-
value: "第一",
|
|
120
|
-
key: 1,
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
label: "下拉",
|
|
128
|
-
name: "select",
|
|
129
|
-
type: "select",
|
|
130
|
-
rules: [
|
|
131
|
-
{
|
|
132
|
-
validator: () => {
|
|
133
|
-
return Promise.reject(new Error("错误"));
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
itemProps: {
|
|
138
|
-
addonBefore: "前面",
|
|
139
|
-
addonAfter: (
|
|
140
|
-
<div
|
|
141
|
-
onClick={() => {
|
|
142
|
-
console.log("fff");
|
|
143
|
-
}}
|
|
144
|
-
>
|
|
145
|
-
后面
|
|
146
|
-
</div>
|
|
147
|
-
),
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
];
|
|
151
|
-
};
|
|
152
|
-
function Ttta({ form }) {
|
|
153
|
-
return (
|
|
154
|
-
<div
|
|
155
|
-
onClick={() => {
|
|
156
|
-
form.setFieldsValue({ switch: 1 });
|
|
157
|
-
}}
|
|
158
|
-
>
|
|
159
|
-
ttta
|
|
160
|
-
</div>
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
42
|
const Test = (props) => {
|
|
165
43
|
return <div>ffff</div>;
|
|
166
44
|
};
|
|
@@ -239,7 +117,7 @@ export default () => {
|
|
|
239
117
|
height: "100%",
|
|
240
118
|
}}
|
|
241
119
|
>
|
|
242
|
-
<div style={{ height: 200 }}
|
|
120
|
+
<div style={{ height: 200 }} />
|
|
243
121
|
</div>
|
|
244
122
|
);
|
|
245
123
|
},
|
|
@@ -255,10 +133,16 @@ export default () => {
|
|
|
255
133
|
backgroundColor: "black",
|
|
256
134
|
height: "100%",
|
|
257
135
|
}}
|
|
258
|
-
|
|
136
|
+
/>
|
|
259
137
|
);
|
|
260
138
|
},
|
|
261
139
|
},
|
|
140
|
+
{
|
|
141
|
+
label: "数字输入框",
|
|
142
|
+
name: "yyy",
|
|
143
|
+
type: "inputNumberGroup",
|
|
144
|
+
rules: [{ required: true }],
|
|
145
|
+
},
|
|
262
146
|
{
|
|
263
147
|
label: "文字",
|
|
264
148
|
type: "text",
|
|
@@ -280,7 +164,7 @@ export default () => {
|
|
|
280
164
|
]}
|
|
281
165
|
dismissOnPressEnter={false}
|
|
282
166
|
formItemStyle={{
|
|
283
|
-
marginBottom:100
|
|
167
|
+
marginBottom: 100,
|
|
284
168
|
}}
|
|
285
169
|
labelWidth={88}
|
|
286
170
|
form={form}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
HColorInput,
|
|
7
7
|
HVerificationCodeInput,
|
|
8
8
|
HInputNumberGroup,
|
|
9
|
-
|
|
9
|
+
HTextArea,
|
|
10
10
|
} from "../../components";
|
|
11
11
|
import { Space } from "antd";
|
|
12
12
|
import { useState } from "react";
|
|
@@ -37,7 +37,7 @@ export default () => {
|
|
|
37
37
|
},
|
|
38
38
|
]}
|
|
39
39
|
/>
|
|
40
|
-
|
|
40
|
+
<HTextArea />
|
|
41
41
|
</Space>
|
|
42
42
|
);
|
|
43
43
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HInputNumberGroup } from "@/components";
|
|
2
2
|
import { Col, Row } from "antd";
|
|
3
|
+
import { useState } from "react";
|
|
3
4
|
const Test = ({ value, onChange }) => {
|
|
4
5
|
console.log(value);
|
|
5
6
|
return (
|
|
@@ -13,10 +14,15 @@ const Test = ({ value, onChange }) => {
|
|
|
13
14
|
);
|
|
14
15
|
};
|
|
15
16
|
export default () => {
|
|
17
|
+
const [val, setVal] = useState({});
|
|
16
18
|
return (
|
|
17
19
|
<Row style={{ marginTop: 20, marginLeft: 20 }}>
|
|
18
20
|
<Col span={10}>
|
|
19
|
-
<HInputNumberGroup
|
|
21
|
+
<HInputNumberGroup
|
|
22
|
+
addonBefore={<Test />}
|
|
23
|
+
value={val}
|
|
24
|
+
onChange={setVal}
|
|
25
|
+
/>
|
|
20
26
|
</Col>
|
|
21
27
|
</Row>
|
|
22
28
|
);
|