@hw-component/form 0.0.9-beta-v19 → 0.0.9-beta-v21
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 -0
- package/.idea/hw-component-form.iml +12 -0
- package/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/es/Select/modal.d.ts +1 -3
- package/lib/Select/modal.d.ts +1 -3
- package/package.json +1 -1
- package/public/index.html +0 -19
- package/scripts/rollup.config.js +0 -90
- package/scripts/webpack.config.js +0 -76
- package/src/Layout.tsx +0 -61
- package/src/app.tsx +0 -33
- package/src/components/Cascader/index.tsx +0 -31
- package/src/components/CheckboxGroup/CheckBox/index.tsx +0 -38
- package/src/components/CheckboxGroup/hooks.ts +0 -105
- package/src/components/CheckboxGroup/index.tsx +0 -85
- package/src/components/CheckboxGroup/modal.ts +0 -17
- package/src/components/DialogForm/DrawerForm/Footer.tsx +0 -20
- package/src/components/DialogForm/DrawerForm/Title.tsx +0 -12
- package/src/components/DialogForm/DrawerForm/index.tsx +0 -110
- package/src/components/DialogForm/ModalForm.tsx +0 -91
- package/src/components/DialogForm/hooks.ts +0 -122
- package/src/components/DialogForm/modal.ts +0 -44
- package/src/components/Form/Context/FormConfigProvider.tsx +0 -38
- package/src/components/Form/Context/index.tsx +0 -14
- package/src/components/Form/FormItem/BasicItem.tsx +0 -95
- package/src/components/Form/FormItem/Helper.tsx +0 -25
- package/src/components/Form/FormItem/RegularFormItem.tsx +0 -13
- package/src/components/Form/FormItem/UpFormItem.tsx +0 -21
- package/src/components/Form/FormItem/hooks.tsx +0 -54
- package/src/components/Form/FormItem/index.tsx +0 -8
- package/src/components/Form/HFormConnect.tsx +0 -74
- package/src/components/Form/InitSet.tsx +0 -10
- package/src/components/Form/Label.tsx +0 -50
- package/src/components/Form/config.ts +0 -58
- package/src/components/Form/hooks/index.ts +0 -114
- package/src/components/Form/hooks/useDefaultRender.tsx +0 -45
- package/src/components/Form/hooks/useHForm.ts +0 -182
- package/src/components/Form/hooks/useInitConfigData.tsx +0 -194
- package/src/components/Form/index.less +0 -54
- package/src/components/Form/index.tsx +0 -113
- package/src/components/Form/modal.ts +0 -206
- package/src/components/Input/ButtonInput.tsx +0 -47
- package/src/components/Input/ColorInput/Picker.tsx +0 -18
- package/src/components/Input/ColorInput/data.ts +0 -102
- package/src/components/Input/ColorInput/index.less +0 -10
- package/src/components/Input/ColorInput/index.tsx +0 -58
- package/src/components/Input/InputNumber.tsx +0 -5
- package/src/components/Input/SelectInput.tsx +0 -75
- package/src/components/Input/TrimInput.tsx +0 -26
- package/src/components/Input/VerificationCodeInput.tsx +0 -74
- package/src/components/Input/defaultConfig.ts +0 -8
- package/src/components/Input/index.tsx +0 -26
- package/src/components/Input/modal.ts +0 -40
- package/src/components/PageHandler/ErrorComponent.tsx +0 -20
- package/src/components/PageHandler/LoadingComponent.tsx +0 -9
- package/src/components/PageHandler/index.tsx +0 -14
- package/src/components/PageHandler/modal.ts +0 -6
- package/src/components/RadioGroup/index.tsx +0 -45
- package/src/components/Select/components/AllSelect.tsx +0 -54
- package/src/components/Select/components/CheckBoxOption.tsx +0 -14
- package/src/components/Select/components/DropdownComponent.tsx +0 -36
- package/src/components/Select/components/NoFindItem.tsx +0 -7
- package/src/components/Select/components/NotFoundContent.tsx +0 -25
- package/src/components/Select/defaultConfig.tsx +0 -23
- package/src/components/Select/hooks/changeHooks.tsx +0 -159
- package/src/components/Select/hooks/norHooks.ts +0 -85
- package/src/components/Select/index.less +0 -22
- package/src/components/Select/index.tsx +0 -126
- package/src/components/Select/modal.ts +0 -38
- package/src/components/Select/utils.ts +0 -18
- package/src/components/Submit/components.tsx +0 -57
- package/src/components/Submit/hooks.ts +0 -31
- package/src/components/Submit/index.tsx +0 -33
- package/src/components/Switch/index.tsx +0 -77
- package/src/components/TDPicker/RangePicker.tsx +0 -109
- package/src/components/TDPicker/TimePicker.tsx +0 -29
- package/src/components/TDPicker/hooks.ts +0 -150
- package/src/components/TDPicker/index.tsx +0 -33
- package/src/components/TDPicker/modal.ts +0 -48
- package/src/components/TextArea/TrimTextArea.tsx +0 -30
- package/src/components/TextArea/index.tsx +0 -8
- package/src/components/Upload/Btn.tsx +0 -24
- package/src/components/Upload/MediaTypeEle/TypeEle.tsx +0 -26
- package/src/components/Upload/MediaTypeEle/index.tsx +0 -34
- package/src/components/Upload/Preview/index.tsx +0 -14
- package/src/components/Upload/UrlUpload/index.tsx +0 -104
- package/src/components/Upload/enums.ts +0 -5
- package/src/components/Upload/hooks/change.ts +0 -79
- package/src/components/Upload/hooks/customRequest.ts +0 -87
- package/src/components/Upload/hooks/propsMaker.ts +0 -20
- package/src/components/Upload/index.tsx +0 -119
- package/src/components/Upload/modal.ts +0 -33
- package/src/components/Upload/util.ts +0 -27
- package/src/components/config.ts +0 -47
- package/src/components/hooks/index.ts +0 -53
- package/src/components/index.tsx +0 -37
- package/src/components/modal.ts +0 -20
- package/src/components/styles/index.less +0 -3
- package/src/components/styles/local.less +0 -1
- package/src/components/typings.d.ts +0 -11
- package/src/index.less +0 -20
- package/src/index.tsx +0 -12
- package/src/pages/Checkbox/index.tsx +0 -14
- package/src/pages/DatePicker/index.tsx +0 -33
- package/src/pages/DrawerForm/index.tsx +0 -145
- package/src/pages/Form/index.tsx +0 -172
- package/src/pages/Input/index.tsx +0 -30
- package/src/pages/ModalForm/index.tsx +0 -191
- package/src/pages/Radio/index.tsx +0 -18
- package/src/pages/Select/index.tsx +0 -63
- package/src/pages/Switch/index.tsx +0 -18
- package/src/pages/Upload/index.tsx +0 -14
- package/src/routes.tsx +0 -80
package/src/components/config.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import moment from "moment";
|
|
2
|
-
import type { IFormConfigContextProps } from "./Form/modal";
|
|
3
|
-
import { fileToBase64 } from "./Upload/util";
|
|
4
|
-
export const baseConfig: IFormConfigContextProps = {
|
|
5
|
-
fieldNames: {
|
|
6
|
-
label: "label",
|
|
7
|
-
value: "value",
|
|
8
|
-
},
|
|
9
|
-
valueCheckMap: {
|
|
10
|
-
checked: 1,
|
|
11
|
-
noChecked: 0,
|
|
12
|
-
},
|
|
13
|
-
valueSwitchMap: {
|
|
14
|
-
open: 1,
|
|
15
|
-
close: 0,
|
|
16
|
-
},
|
|
17
|
-
valueRangePickerValueMap: {
|
|
18
|
-
start: (name) => {
|
|
19
|
-
return `${name}StartTime`;
|
|
20
|
-
},
|
|
21
|
-
end: (name) => {
|
|
22
|
-
return `${name}EndTime`;
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
dateRanges: {
|
|
26
|
-
最近三天: [moment().subtract(2, "days").startOf("days"), moment()],
|
|
27
|
-
最近七天: [moment().subtract(6, "days").startOf("days"), moment()],
|
|
28
|
-
最近三十天: [moment().subtract(29, "days").startOf("days"), moment()],
|
|
29
|
-
},
|
|
30
|
-
uploadProps: {
|
|
31
|
-
exFiles: ["JPG", "PNG", "JPEG", "GIF"],
|
|
32
|
-
request: async (file: any) => {
|
|
33
|
-
const url = await fileToBase64(file);
|
|
34
|
-
return {
|
|
35
|
-
url,
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
maxSize: 1024 * 1024 * 1.8,
|
|
39
|
-
},
|
|
40
|
-
defaultComponent: {},
|
|
41
|
-
formItemStyle:{},
|
|
42
|
-
itemProps:{}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export default {
|
|
46
|
-
name: "name",
|
|
47
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { useContext, useMemo } from "react";
|
|
2
|
-
import type { SelectProps } from "antd";
|
|
3
|
-
import { ConfigContext } from "antd/es/config-provider";
|
|
4
|
-
import type { IFormConfigContextProps } from "../Form/modal";
|
|
5
|
-
import { useFormConfigContext } from "../Form/Context/FormConfigProvider";
|
|
6
|
-
|
|
7
|
-
interface UseChangeOptionsParams {
|
|
8
|
-
options?: Record<string, any>[];
|
|
9
|
-
fieldNames?: SelectProps["fieldNames"];
|
|
10
|
-
}
|
|
11
|
-
export const useChangeOptions = ({
|
|
12
|
-
options,
|
|
13
|
-
fieldNames = {},
|
|
14
|
-
}: UseChangeOptionsParams) => {
|
|
15
|
-
return useMemo(() => {
|
|
16
|
-
return options?.map((item) => {
|
|
17
|
-
const { label = "", value = "" } = fieldNames;
|
|
18
|
-
const { [label]: relLabel, [value]: relVal, ...oItem } = item;
|
|
19
|
-
return {
|
|
20
|
-
...oItem,
|
|
21
|
-
label: relLabel,
|
|
22
|
-
value: relVal,
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
}, [options]);
|
|
26
|
-
}; //options组装
|
|
27
|
-
|
|
28
|
-
export const useClassName = (className: string | string[]) => {
|
|
29
|
-
const config = useContext(ConfigContext);
|
|
30
|
-
return useMemo(() => {
|
|
31
|
-
if (Array.isArray(className)) {
|
|
32
|
-
const classNames = className.map((item) => {
|
|
33
|
-
return `${config.getPrefixCls()}-${item}`;
|
|
34
|
-
});
|
|
35
|
-
return classNames.join(" ");
|
|
36
|
-
}
|
|
37
|
-
return `${config.getPrefixCls()}-${className}`;
|
|
38
|
-
}, [className]);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const useMatchConfigProps = (matchProps: IFormConfigContextProps) => {
|
|
42
|
-
const globalConfig = useFormConfigContext();
|
|
43
|
-
const keys = Object.keys(matchProps);
|
|
44
|
-
const resultMatchProps: IFormConfigContextProps = {};
|
|
45
|
-
keys.forEach((key) => {
|
|
46
|
-
if (!matchProps[key]) {
|
|
47
|
-
resultMatchProps[key] = globalConfig[key];
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
resultMatchProps[key] = matchProps[key];
|
|
51
|
-
});
|
|
52
|
-
return resultMatchProps;
|
|
53
|
-
}; //匹配全局配置
|
package/src/components/index.tsx
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import "./styles/index.less";
|
|
2
|
-
import FormConfig from "./Form/config";
|
|
3
|
-
import PageHandler from "./PageHandler";
|
|
4
|
-
export { default as HForm } from "./Form";
|
|
5
|
-
export { default as useHForm } from "./Form/hooks/useHForm";
|
|
6
|
-
export { useHDialogForm } from "./DialogForm/hooks";
|
|
7
|
-
export { default as HFormConnect } from "./Form/HFormConnect";
|
|
8
|
-
export { default as HFormConfigProvider } from "./Form/Context/FormConfigProvider";
|
|
9
|
-
|
|
10
|
-
import ModalForm from "./DialogForm/ModalForm";
|
|
11
|
-
import DrawerForm from "./DialogForm/DrawerForm";
|
|
12
|
-
export const HSelect = FormConfig.select;
|
|
13
|
-
export const HInput = FormConfig.input;
|
|
14
|
-
export const HSelectInput = FormConfig.selectInput;
|
|
15
|
-
export const HUpload = FormConfig.upload;
|
|
16
|
-
export const HUrlUpload = FormConfig.urlUpload;
|
|
17
|
-
export const HButtonInput = FormConfig.buttonInput;
|
|
18
|
-
export const HCheckBox = FormConfig.checkBox;
|
|
19
|
-
export const HSwitch = FormConfig.switch;
|
|
20
|
-
export const HCheckboxGroup = FormConfig.checkboxGroup;
|
|
21
|
-
export const HDatePicker = FormConfig.datePicker;
|
|
22
|
-
export const HRangePicker = FormConfig.rangePicker.Component;
|
|
23
|
-
export const HRadioGroup = FormConfig.radioGroup;
|
|
24
|
-
export const HTimePicker = FormConfig.timePicker;
|
|
25
|
-
export const HInputNumber = FormConfig.inputNumber;
|
|
26
|
-
export const HPageHandler = PageHandler;
|
|
27
|
-
export const HTextArea = FormConfig.textArea;
|
|
28
|
-
export const HColorInput = FormConfig.colorInput;
|
|
29
|
-
export const HModalForm = ModalForm;
|
|
30
|
-
export const HDrawerForm = DrawerForm;
|
|
31
|
-
export const HCascader = FormConfig.cascader;
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
export const HVerificationCodeInput = FormConfig.verificationCodeInput;
|
|
34
|
-
|
|
35
|
-
export const HTrimInput = FormConfig.trimInput;
|
|
36
|
-
|
|
37
|
-
export const HTrimTextArea = FormConfig.trimTextArea;
|
package/src/components/modal.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface ValueCheckMapModal {
|
|
2
|
-
checked?: any;
|
|
3
|
-
noChecked?: any;
|
|
4
|
-
}
|
|
5
|
-
export type PromiseFnResult<T = any, R = any> = (
|
|
6
|
-
params: T,
|
|
7
|
-
formDataValues?: any
|
|
8
|
-
) => Promise<R>;
|
|
9
|
-
export interface ValueSwitchMapModal {
|
|
10
|
-
open?: any;
|
|
11
|
-
close?: any;
|
|
12
|
-
}
|
|
13
|
-
export interface DataFnProvider<P = any, R = any> {
|
|
14
|
-
(name: P): R;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface DateRangePickerValueMapModal {
|
|
18
|
-
start?: string | DataFnProvider<string, string>;
|
|
19
|
-
end?: string | DataFnProvider<string, string>;
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@ant-prefix: ant;
|
|
@@ -1,11 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
);
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,145 +0,0 @@
|
|
|
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
|
-
};
|
package/src/pages/Form/index.tsx
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
};
|