@hw-component/form 0.0.9-beta-v21 → 1.0.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/es/DialogForm/modal.d.ts +4 -3
- package/lib/DialogForm/modal.d.ts +4 -3
- package/package.json +1 -1
- package/src/Layout.tsx +61 -0
- package/src/app.tsx +33 -0
- package/src/components/Cascader/index.tsx +31 -0
- package/src/components/CheckboxGroup/CheckBox/index.tsx +38 -0
- package/src/components/CheckboxGroup/hooks.ts +105 -0
- package/src/components/CheckboxGroup/index.tsx +85 -0
- package/src/components/CheckboxGroup/modal.ts +17 -0
- package/src/components/DialogForm/DrawerForm/Footer.tsx +20 -0
- package/src/components/DialogForm/DrawerForm/Title.tsx +12 -0
- package/src/components/DialogForm/DrawerForm/index.tsx +110 -0
- package/src/components/DialogForm/ModalForm.tsx +91 -0
- package/src/components/DialogForm/hooks.ts +122 -0
- package/src/components/DialogForm/modal.ts +45 -0
- package/src/components/Form/Context/FormConfigProvider.tsx +38 -0
- package/src/components/Form/Context/index.tsx +14 -0
- package/src/components/Form/FormItem/BasicItem.tsx +95 -0
- package/src/components/Form/FormItem/Helper.tsx +25 -0
- package/src/components/Form/FormItem/RegularFormItem.tsx +13 -0
- package/src/components/Form/FormItem/UpFormItem.tsx +21 -0
- package/src/components/Form/FormItem/hooks.tsx +54 -0
- package/src/components/Form/FormItem/index.tsx +8 -0
- package/src/components/Form/HFormConnect.tsx +74 -0
- package/src/components/Form/InitSet.tsx +10 -0
- package/src/components/Form/Label.tsx +50 -0
- package/src/components/Form/config.ts +58 -0
- package/src/components/Form/hooks/index.ts +114 -0
- package/src/components/Form/hooks/useDefaultRender.tsx +45 -0
- package/src/components/Form/hooks/useHForm.ts +182 -0
- package/src/components/Form/hooks/useInitConfigData.tsx +194 -0
- package/src/components/Form/index.less +54 -0
- package/src/components/Form/index.tsx +113 -0
- package/src/components/Form/modal.ts +206 -0
- package/src/components/Input/ButtonInput.tsx +47 -0
- package/src/components/Input/ColorInput/Picker.tsx +18 -0
- package/src/components/Input/ColorInput/data.ts +102 -0
- package/src/components/Input/ColorInput/index.less +10 -0
- package/src/components/Input/ColorInput/index.tsx +58 -0
- package/src/components/Input/InputNumber.tsx +5 -0
- package/src/components/Input/SelectInput.tsx +75 -0
- package/src/components/Input/TrimInput.tsx +26 -0
- package/src/components/Input/VerificationCodeInput.tsx +74 -0
- package/src/components/Input/defaultConfig.ts +8 -0
- package/src/components/Input/index.tsx +26 -0
- package/src/components/Input/modal.ts +40 -0
- package/src/components/PageHandler/ErrorComponent.tsx +20 -0
- package/src/components/PageHandler/LoadingComponent.tsx +9 -0
- package/src/components/PageHandler/index.tsx +14 -0
- package/src/components/PageHandler/modal.ts +6 -0
- package/src/components/RadioGroup/index.tsx +45 -0
- package/src/components/Select/components/AllSelect.tsx +54 -0
- package/src/components/Select/components/CheckBoxOption.tsx +14 -0
- package/src/components/Select/components/DropdownComponent.tsx +36 -0
- package/src/components/Select/components/NoFindItem.tsx +7 -0
- package/src/components/Select/components/NotFoundContent.tsx +25 -0
- package/src/components/Select/defaultConfig.tsx +23 -0
- package/src/components/Select/hooks/changeHooks.tsx +159 -0
- package/src/components/Select/hooks/norHooks.ts +85 -0
- package/src/components/Select/index.less +22 -0
- package/src/components/Select/index.tsx +126 -0
- package/src/components/Select/modal.ts +36 -0
- package/src/components/Select/utils.ts +18 -0
- package/src/components/Submit/components.tsx +57 -0
- package/src/components/Submit/hooks.ts +31 -0
- package/src/components/Submit/index.tsx +33 -0
- package/src/components/Switch/index.tsx +77 -0
- package/src/components/TDPicker/RangePicker.tsx +109 -0
- package/src/components/TDPicker/TimePicker.tsx +29 -0
- package/src/components/TDPicker/hooks.ts +150 -0
- package/src/components/TDPicker/index.tsx +33 -0
- package/src/components/TDPicker/modal.ts +48 -0
- package/src/components/TextArea/TrimTextArea.tsx +30 -0
- package/src/components/TextArea/index.tsx +8 -0
- package/src/components/Upload/Btn.tsx +24 -0
- package/src/components/Upload/MediaTypeEle/TypeEle.tsx +26 -0
- package/src/components/Upload/MediaTypeEle/index.tsx +34 -0
- package/src/components/Upload/Preview/index.tsx +14 -0
- package/src/components/Upload/UrlUpload/index.tsx +104 -0
- package/src/components/Upload/enums.ts +5 -0
- package/src/components/Upload/hooks/change.ts +79 -0
- package/src/components/Upload/hooks/customRequest.ts +87 -0
- package/src/components/Upload/hooks/propsMaker.ts +20 -0
- package/src/components/Upload/index.tsx +119 -0
- package/src/components/Upload/modal.ts +33 -0
- package/src/components/Upload/util.ts +27 -0
- package/src/components/config.ts +47 -0
- package/src/components/hooks/index.ts +53 -0
- package/src/components/index.tsx +37 -0
- package/src/components/modal.ts +20 -0
- package/src/components/styles/index.less +3 -0
- package/src/components/styles/local.less +1 -0
- package/src/components/typings.d.ts +11 -0
- package/src/index.less +20 -0
- package/src/index.tsx +12 -0
- package/src/pages/Checkbox/index.tsx +14 -0
- package/src/pages/DatePicker/index.tsx +33 -0
- package/src/pages/DrawerForm/index.tsx +145 -0
- package/src/pages/Form/index.tsx +172 -0
- package/src/pages/Input/index.tsx +30 -0
- package/src/pages/ModalForm/index.tsx +195 -0
- package/src/pages/Radio/index.tsx +18 -0
- package/src/pages/Select/index.tsx +63 -0
- package/src/pages/Switch/index.tsx +18 -0
- package/src/pages/Upload/index.tsx +14 -0
- package/src/routes.tsx +80 -0
- package/.husky/pre-commit +0 -4
- package/.idea/hw-component-form.iml +0 -12
- package/.idea/inspectionProfiles/Project_Default.xml +0 -7
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare module "*.css";
|
|
2
|
+
declare module "*.less";
|
|
3
|
+
declare module "*.scss";
|
|
4
|
+
declare module "*.sass";
|
|
5
|
+
declare module "*.svg";
|
|
6
|
+
declare module "*.png";
|
|
7
|
+
declare module "*.jpg";
|
|
8
|
+
declare module "*.jpeg";
|
|
9
|
+
declare module "*.gif";
|
|
10
|
+
declare module "*.bmp";
|
|
11
|
+
declare module "*.tiff";
|
package/src/index.less
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.layout {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
right: 0;
|
|
5
|
+
bottom: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
display: flex;
|
|
8
|
+
}
|
|
9
|
+
.menu {
|
|
10
|
+
width: 256px !important;
|
|
11
|
+
height: 100vh;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.body {
|
|
15
|
+
width: calc(100vw - 256px);
|
|
16
|
+
height: 100vh;
|
|
17
|
+
padding: 16px;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
background-color: #fff;
|
|
20
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { render } from "react-dom";
|
|
2
|
+
import App from "./app";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import "antd/dist/antd.css";
|
|
5
|
+
import zhCN from "antd/es/locale/zh_CN";
|
|
6
|
+
import { ConfigProvider } from "antd";
|
|
7
|
+
render(
|
|
8
|
+
<ConfigProvider locale={zhCN}>
|
|
9
|
+
<App />
|
|
10
|
+
</ConfigProvider>,
|
|
11
|
+
document.getElementById("root")
|
|
12
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Space } from "antd";
|
|
2
|
+
import { HCheckboxGroup } from "../../components";
|
|
3
|
+
export default () => {
|
|
4
|
+
return (
|
|
5
|
+
<Space size={"large"} direction={"vertical"} style={{ width: "100%" }}>
|
|
6
|
+
<HCheckboxGroup
|
|
7
|
+
options={[
|
|
8
|
+
{ label: "测试", value: "uu" },
|
|
9
|
+
{ label: "测试1", value: "uu1" },
|
|
10
|
+
]}
|
|
11
|
+
/>
|
|
12
|
+
</Space>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Space } from "antd";
|
|
2
|
+
import { HDatePicker, HRangePicker, HTimePicker } from "../../components";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
export default () => {
|
|
5
|
+
const [timeVal, setTimeVal] = useState({
|
|
6
|
+
start: 1692070068,
|
|
7
|
+
end: 1692242868,
|
|
8
|
+
});
|
|
9
|
+
return (
|
|
10
|
+
<Space size={"large"} direction={"vertical"} style={{ width: "100%" }}>
|
|
11
|
+
<HDatePicker
|
|
12
|
+
value={1691487319}
|
|
13
|
+
onChange={(val) => {
|
|
14
|
+
console.log(val);
|
|
15
|
+
}}
|
|
16
|
+
/>
|
|
17
|
+
<HRangePicker
|
|
18
|
+
value={timeVal}
|
|
19
|
+
valueMap={{ start: "start", end: "end" }}
|
|
20
|
+
onChange={(val) => {
|
|
21
|
+
console.log(val);
|
|
22
|
+
setTimeVal(val);
|
|
23
|
+
}}
|
|
24
|
+
/>
|
|
25
|
+
<HTimePicker
|
|
26
|
+
value={55135}
|
|
27
|
+
onChange={(val) => {
|
|
28
|
+
console.log(val);
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
</Space>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Button } from "antd";
|
|
2
|
+
import { HDrawerForm, useHDialogForm } from "../../components";
|
|
3
|
+
const data = [
|
|
4
|
+
{
|
|
5
|
+
label: "输入框",
|
|
6
|
+
name: "name",
|
|
7
|
+
rules: [
|
|
8
|
+
() => {
|
|
9
|
+
return {
|
|
10
|
+
required: true,
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: "数字",
|
|
17
|
+
name: "sz",
|
|
18
|
+
type: "inputNumber",
|
|
19
|
+
rules: [{ required: true }],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: "下拉输入框",
|
|
23
|
+
name: "selectInput",
|
|
24
|
+
type: "selectInput",
|
|
25
|
+
rules: [{ required: true }],
|
|
26
|
+
itemProps: {
|
|
27
|
+
valueName: {
|
|
28
|
+
select: "op",
|
|
29
|
+
input: "opInput",
|
|
30
|
+
},
|
|
31
|
+
selectProps: {
|
|
32
|
+
options: [{ label: "测试", value: 1 }],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: "按钮输入框",
|
|
38
|
+
name: "buttonInput",
|
|
39
|
+
type: "buttonInput",
|
|
40
|
+
children: "点击",
|
|
41
|
+
rules: [{ required: true }],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "选择",
|
|
45
|
+
name: "checkboxGroup",
|
|
46
|
+
type: "checkboxGroup",
|
|
47
|
+
rules: [{ required: true }],
|
|
48
|
+
helper: "帮助我",
|
|
49
|
+
options: [
|
|
50
|
+
{ label: "选择1", value: "check1" },
|
|
51
|
+
{ label: "选择2", value: "check2" },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: "开关",
|
|
56
|
+
name: "switch",
|
|
57
|
+
type: "switch",
|
|
58
|
+
rules: [{ required: true }],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: "时间",
|
|
62
|
+
name: "datePicker",
|
|
63
|
+
type: "datePicker",
|
|
64
|
+
hover: "时间选择",
|
|
65
|
+
helper: "帮助我",
|
|
66
|
+
rules: [{ required: true }],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: "时间段",
|
|
70
|
+
name: "rangePicker",
|
|
71
|
+
type: "rangePicker",
|
|
72
|
+
helper: "帮助我",
|
|
73
|
+
rules: [{ required: true }],
|
|
74
|
+
itemProps: {
|
|
75
|
+
valueMap: {
|
|
76
|
+
start: "testStart",
|
|
77
|
+
end: "testEnd",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
label: "时分秒",
|
|
83
|
+
name: "timePicker",
|
|
84
|
+
type: "timePicker",
|
|
85
|
+
rules: [{ required: true }],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: "文件",
|
|
89
|
+
name: "upload",
|
|
90
|
+
type: "upload",
|
|
91
|
+
rules: [{ required: true }],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: "地址文件",
|
|
95
|
+
name: "urlUpload",
|
|
96
|
+
type: "urlUpload",
|
|
97
|
+
rules: [{ required: true }],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: "验证码",
|
|
101
|
+
type: "verificationCodeInput",
|
|
102
|
+
name: "verificationCodeInput",
|
|
103
|
+
itemProps: {
|
|
104
|
+
request: () => {
|
|
105
|
+
return Promise.resolve({ code: 200 });
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
let num = 0;
|
|
111
|
+
export default () => {
|
|
112
|
+
const modalForm = useHDialogForm();
|
|
113
|
+
return (
|
|
114
|
+
<>
|
|
115
|
+
<Button
|
|
116
|
+
onClick={() => {
|
|
117
|
+
num++;
|
|
118
|
+
modalForm.show({
|
|
119
|
+
initialValues: {
|
|
120
|
+
check1: 1,
|
|
121
|
+
op: 1,
|
|
122
|
+
opInput: num,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
显示
|
|
128
|
+
</Button>
|
|
129
|
+
<Button
|
|
130
|
+
onClick={() => {
|
|
131
|
+
modalForm.show();
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
打开
|
|
135
|
+
</Button>
|
|
136
|
+
<HDrawerForm
|
|
137
|
+
autoClear={false}
|
|
138
|
+
configData={data}
|
|
139
|
+
labelWidth={88}
|
|
140
|
+
dialogForm={modalForm}
|
|
141
|
+
title="测试"
|
|
142
|
+
/>
|
|
143
|
+
</>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { HForm, HFormConfigProvider, useHForm } from "../../components";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Button, DatePicker, Form, Input } from "antd";
|
|
4
|
+
|
|
5
|
+
const formData = (options) => {
|
|
6
|
+
const op = [
|
|
7
|
+
{
|
|
8
|
+
key: 1,
|
|
9
|
+
value: "是",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
key: 0,
|
|
13
|
+
value: "否",
|
|
14
|
+
},
|
|
15
|
+
];
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
label: "测试",
|
|
19
|
+
className:"hdjd",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: "测试1",
|
|
23
|
+
type:"select"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: "测试1",
|
|
27
|
+
type:"inputNumber"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: "选择",
|
|
31
|
+
name: "checkboxGroup",
|
|
32
|
+
type: "checkboxGroup",
|
|
33
|
+
rules: [{ required: true }],
|
|
34
|
+
helper: "帮助我",
|
|
35
|
+
options: [
|
|
36
|
+
{ value: "选择1", key: "check1" },
|
|
37
|
+
{ value: "选择2", key: "check2" },
|
|
38
|
+
],
|
|
39
|
+
direction: "vertical",
|
|
40
|
+
labelAlign: "topLeft",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "开关",
|
|
44
|
+
name: "switch",
|
|
45
|
+
type: "switch",
|
|
46
|
+
rules: [{ required: true }],
|
|
47
|
+
itemProps: {
|
|
48
|
+
valueMap: {
|
|
49
|
+
open: 1,
|
|
50
|
+
close: 0,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: "submit",
|
|
56
|
+
itemProps: {
|
|
57
|
+
extraList: [
|
|
58
|
+
<Button
|
|
59
|
+
key="wh"
|
|
60
|
+
onClick={() => {
|
|
61
|
+
console.log("起飞");
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
芜湖
|
|
65
|
+
</Button>,
|
|
66
|
+
"666",
|
|
67
|
+
"reset",
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: "submit",
|
|
73
|
+
itemProps: {
|
|
74
|
+
extraList: [
|
|
75
|
+
<Button
|
|
76
|
+
key="wh"
|
|
77
|
+
onClick={() => {
|
|
78
|
+
console.log("起飞");
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
芜湖
|
|
82
|
+
</Button>,
|
|
83
|
+
<Ttta key="aa" />,
|
|
84
|
+
"666",
|
|
85
|
+
"submit",
|
|
86
|
+
"reset",
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
];
|
|
91
|
+
};
|
|
92
|
+
function Ttta({ form }) {
|
|
93
|
+
return (
|
|
94
|
+
<div
|
|
95
|
+
onClick={() => {
|
|
96
|
+
console.log("form", form);
|
|
97
|
+
form.setFieldsValue({ switch: 1 });
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
ttta
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const Test = (props) => {
|
|
106
|
+
return <div>ffff</div>;
|
|
107
|
+
};
|
|
108
|
+
export default () => {
|
|
109
|
+
const form = useHForm();
|
|
110
|
+
const [options, setOptions] = useState([{ label: "1", value: 1 }]);
|
|
111
|
+
const [aForm] = Form.useForm();
|
|
112
|
+
return (
|
|
113
|
+
<div style={{ overflow: "auto", height: "90vh" }}>
|
|
114
|
+
<Form form={aForm} initialValues={{ ttim: "132123" }}>
|
|
115
|
+
<Form.Item name="ttim" rules={[{ required: true }]}>
|
|
116
|
+
<Input />
|
|
117
|
+
</Form.Item>
|
|
118
|
+
</Form>
|
|
119
|
+
<HFormConfigProvider
|
|
120
|
+
valueSwitchMap={{ open: 1, close: 2 }}
|
|
121
|
+
valueCheckMap={{ noChecked: 0, checked: 1 }}
|
|
122
|
+
defaultComponent={{
|
|
123
|
+
test: Test,
|
|
124
|
+
}}
|
|
125
|
+
itemProps={{
|
|
126
|
+
style:{
|
|
127
|
+
borderRadius:10
|
|
128
|
+
}
|
|
129
|
+
}}
|
|
130
|
+
fieldNames={{
|
|
131
|
+
label: "value",
|
|
132
|
+
value: "key",
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
<HForm
|
|
136
|
+
configData={formData(options)}
|
|
137
|
+
labelWidth={200}
|
|
138
|
+
form={form}
|
|
139
|
+
labelAlign={"right"}
|
|
140
|
+
submitLoading={true}
|
|
141
|
+
onFinish={(value) => {
|
|
142
|
+
console.log(value);
|
|
143
|
+
}}
|
|
144
|
+
onValuesChange={(val) => {
|
|
145
|
+
console.log(val, "onValuesChange");
|
|
146
|
+
}}
|
|
147
|
+
request={(params) => {
|
|
148
|
+
return new Promise<any>((resolve) => {
|
|
149
|
+
setTimeout(() => {
|
|
150
|
+
resolve(params);
|
|
151
|
+
}, 3000);
|
|
152
|
+
});
|
|
153
|
+
}}
|
|
154
|
+
/>
|
|
155
|
+
</HFormConfigProvider>
|
|
156
|
+
<div
|
|
157
|
+
onClick={() => {
|
|
158
|
+
aForm.resetFields();
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
点我
|
|
162
|
+
</div>
|
|
163
|
+
<div
|
|
164
|
+
onClick={() => {
|
|
165
|
+
form.resetFieldsInitValue();
|
|
166
|
+
}}
|
|
167
|
+
>
|
|
168
|
+
重置
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
);
|
|
172
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HInput,
|
|
3
|
+
HSelectInput,
|
|
4
|
+
HButtonInput,
|
|
5
|
+
HInputNumber,
|
|
6
|
+
HColorInput,
|
|
7
|
+
HVerificationCodeInput,
|
|
8
|
+
} from "../../components";
|
|
9
|
+
import { Space } from "antd";
|
|
10
|
+
export default () => {
|
|
11
|
+
return (
|
|
12
|
+
<Space size={"large"} direction={"vertical"} style={{ width: "100%" }}>
|
|
13
|
+
<HInput placeholder="基础输入框" />
|
|
14
|
+
<HSelectInput
|
|
15
|
+
placeholder="基础输入框"
|
|
16
|
+
selectProps={{
|
|
17
|
+
options: [{ label: "1", value: 1 }],
|
|
18
|
+
}}
|
|
19
|
+
/>
|
|
20
|
+
<HButtonInput>点我</HButtonInput>
|
|
21
|
+
<HInputNumber />
|
|
22
|
+
<HColorInput />
|
|
23
|
+
<HVerificationCodeInput
|
|
24
|
+
request={() => {
|
|
25
|
+
return Promise.resolve({ code: 200 });
|
|
26
|
+
}}
|
|
27
|
+
/>
|
|
28
|
+
</Space>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { Button } from "antd";
|
|
2
|
+
import {
|
|
3
|
+
HModalForm,
|
|
4
|
+
useHDialogForm,
|
|
5
|
+
HFormConfigProvider,
|
|
6
|
+
} from "../../components";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { ShowParamsModal } from "@/components/DialogForm/modal";
|
|
9
|
+
const data = [
|
|
10
|
+
{
|
|
11
|
+
label: "输入框",
|
|
12
|
+
name: "name",
|
|
13
|
+
rules: [
|
|
14
|
+
() => {
|
|
15
|
+
return {
|
|
16
|
+
required: true,
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: "数字",
|
|
23
|
+
name: "sz",
|
|
24
|
+
type: "inputNumber",
|
|
25
|
+
rules: [{ required: true }],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: "下拉输入框",
|
|
29
|
+
name: "selectInput",
|
|
30
|
+
type: "selectInput",
|
|
31
|
+
rules: [{ required: true }],
|
|
32
|
+
itemProps: {
|
|
33
|
+
valueName: {
|
|
34
|
+
select: "op",
|
|
35
|
+
input: "opInput",
|
|
36
|
+
},
|
|
37
|
+
selectProps: {
|
|
38
|
+
options: [{ label: "测试", value: 1 }],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "按钮输入框",
|
|
44
|
+
name: "buttonInput",
|
|
45
|
+
type: "buttonInput",
|
|
46
|
+
children: "点击",
|
|
47
|
+
rules: [{ required: true }],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: "选择",
|
|
51
|
+
name: "checkboxGroup",
|
|
52
|
+
type: "checkboxGroup",
|
|
53
|
+
rules: [{ required: true }],
|
|
54
|
+
helper: "帮助我",
|
|
55
|
+
options: [
|
|
56
|
+
{ label: "选择1", value: "check1" },
|
|
57
|
+
{ label: "选择2", value: "check2" },
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: "开关",
|
|
62
|
+
name: "switch",
|
|
63
|
+
type: "switch",
|
|
64
|
+
rules: [{ required: true }],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: "时间",
|
|
68
|
+
name: "datePicker",
|
|
69
|
+
type: "datePicker",
|
|
70
|
+
hover: "时间选择",
|
|
71
|
+
helper: "帮助我",
|
|
72
|
+
rules: [{ required: true }],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: "时间段",
|
|
76
|
+
name: "rangePicker",
|
|
77
|
+
type: "rangePicker",
|
|
78
|
+
helper: "帮助我",
|
|
79
|
+
rules: [{ required: true }],
|
|
80
|
+
itemProps: {
|
|
81
|
+
valueMap: {
|
|
82
|
+
start: "testStart",
|
|
83
|
+
end: "testEnd",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: "时分秒",
|
|
89
|
+
name: "timePicker",
|
|
90
|
+
type: "timePicker",
|
|
91
|
+
rules: [{ required: true }],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: "文件",
|
|
95
|
+
name: "upload",
|
|
96
|
+
type: "upload",
|
|
97
|
+
rules: [{ required: true }],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: "地址文件",
|
|
101
|
+
name: "urlUpload",
|
|
102
|
+
type: "urlUpload",
|
|
103
|
+
rules: [{ required: true }],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: "下拉框",
|
|
107
|
+
name: "select",
|
|
108
|
+
type: "select",
|
|
109
|
+
dispatch: {
|
|
110
|
+
fnKey: "reload",
|
|
111
|
+
dependencies: ["selectInput", "sz"],
|
|
112
|
+
manual: false,
|
|
113
|
+
},
|
|
114
|
+
itemProps: {
|
|
115
|
+
request: (params = {}, values) => {
|
|
116
|
+
const { label = "123", value = 1 } = params;
|
|
117
|
+
return Promise.resolve([{ label, value }]);
|
|
118
|
+
},
|
|
119
|
+
showSearch: true,
|
|
120
|
+
},
|
|
121
|
+
rules: [{ required: true }],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
label: "验证码",
|
|
125
|
+
type: "verificationCodeInput",
|
|
126
|
+
name: "verificationCodeInput",
|
|
127
|
+
itemProps: {
|
|
128
|
+
request: () => {
|
|
129
|
+
return Promise.resolve({ code: 200 });
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
let num = 0;
|
|
135
|
+
export default () => {
|
|
136
|
+
const modalForm = useHDialogForm();
|
|
137
|
+
return (
|
|
138
|
+
<>
|
|
139
|
+
<Button
|
|
140
|
+
onClick={() => {
|
|
141
|
+
num++;
|
|
142
|
+
modalForm.show({
|
|
143
|
+
params: {
|
|
144
|
+
name: num,
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
打开
|
|
150
|
+
</Button>
|
|
151
|
+
<Button
|
|
152
|
+
onClick={() => {
|
|
153
|
+
modalForm.show({
|
|
154
|
+
params: {
|
|
155
|
+
name: num,
|
|
156
|
+
},
|
|
157
|
+
initialValues: {
|
|
158
|
+
name: "name",
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
宣誓
|
|
164
|
+
</Button>
|
|
165
|
+
<HFormConfigProvider
|
|
166
|
+
uploadProps={{
|
|
167
|
+
request: () => {
|
|
168
|
+
return Promise.resolve({
|
|
169
|
+
url: "https://gw.alicdn.com/imgextra/i2/O1CN01MYuwJQ1GXVBWryCFJ_!!6000000000632-2-tps-1125-570.png_468x468q75.jpg_.webp",
|
|
170
|
+
});
|
|
171
|
+
},
|
|
172
|
+
}}
|
|
173
|
+
>
|
|
174
|
+
<HModalForm
|
|
175
|
+
configData={data}
|
|
176
|
+
|
|
177
|
+
labelWidth={88}
|
|
178
|
+
request={(values, params)=>{
|
|
179
|
+
console.log(values,params)
|
|
180
|
+
}}
|
|
181
|
+
contentRender={(node, form) => {
|
|
182
|
+
return (
|
|
183
|
+
<div>
|
|
184
|
+
<div>测试一些</div>
|
|
185
|
+
{node}
|
|
186
|
+
</div>
|
|
187
|
+
);
|
|
188
|
+
}}
|
|
189
|
+
dialogForm={modalForm}
|
|
190
|
+
title={<div>fff</div>}
|
|
191
|
+
/>
|
|
192
|
+
</HFormConfigProvider>
|
|
193
|
+
</>
|
|
194
|
+
);
|
|
195
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Space } from "antd";
|
|
2
|
+
import { HRadioGroup } from "../../components";
|
|
3
|
+
export default () => {
|
|
4
|
+
return (
|
|
5
|
+
<Space size={"large"} direction={"vertical"} style={{ width: "100%" }}>
|
|
6
|
+
<HRadioGroup
|
|
7
|
+
options={[
|
|
8
|
+
{ label: "测试2", value: "2" },
|
|
9
|
+
{ label: "测试1", value: "1" },
|
|
10
|
+
]}
|
|
11
|
+
value={"1"}
|
|
12
|
+
onChange={(value) => {
|
|
13
|
+
console.log(value);
|
|
14
|
+
}}
|
|
15
|
+
/>
|
|
16
|
+
</Space>
|
|
17
|
+
);
|
|
18
|
+
};
|