@hw-component/form 1.9.46 → 1.9.48
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/DialogForm/DrawerForm/Footer.js +5 -4
- package/es/DialogForm/DrawerForm/index.js +8 -16
- package/es/DialogForm/hooks.d.ts +5 -4
- package/es/DialogForm/hooks.js +13 -3
- package/es/DialogForm/modal.d.ts +1 -1
- package/es/Form/config.d.ts +1 -1
- package/es/Form/modal.d.ts +3 -2
- package/es/Input/ButtonInput.js +5 -5
- package/es/Input/SelectInput.js +1 -0
- package/es/PageHandler/ErrorComponent.js +3 -2
- package/es/Select/TreeSelect.d.ts +2 -2
- package/es/Select/components/NotFoundContent.js +3 -2
- package/es/Submit/components.js +3 -3
- package/es/Switch/index.d.ts +1 -1
- package/es/Text/index.d.ts +8 -2
- package/es/Text/index.js +23 -6
- package/es/index.css +8 -8
- package/es/index.d.ts +1 -1
- package/lib/DialogForm/DrawerForm/Footer.js +4 -3
- package/lib/DialogForm/DrawerForm/index.js +7 -15
- package/lib/DialogForm/hooks.d.ts +5 -4
- package/lib/DialogForm/hooks.js +13 -3
- package/lib/DialogForm/modal.d.ts +1 -1
- package/lib/Form/config.d.ts +1 -1
- package/lib/Form/modal.d.ts +3 -2
- package/lib/Input/ButtonInput.js +4 -4
- package/lib/Input/SelectInput.js +1 -0
- package/lib/PageHandler/ErrorComponent.js +2 -1
- package/lib/Select/TreeSelect.d.ts +2 -2
- package/lib/Select/components/NotFoundContent.js +2 -1
- package/lib/Submit/components.js +3 -3
- package/lib/Switch/index.d.ts +1 -1
- package/lib/Text/index.d.ts +8 -2
- package/lib/Text/index.js +21 -4
- package/lib/index.css +8 -8
- package/lib/index.d.ts +1 -1
- package/package.json +5 -3
- package/src/components/CheckboxGroup/index.tsx +3 -3
- package/src/components/DialogForm/DrawerForm/Footer.tsx +7 -5
- package/src/components/DialogForm/DrawerForm/index.tsx +10 -21
- package/src/components/DialogForm/ModalForm.tsx +2 -2
- package/src/components/DialogForm/{hooks.ts → hooks.tsx} +17 -4
- package/src/components/DialogForm/modal.ts +1 -1
- package/src/components/Form/Basic.tsx +2 -2
- package/src/components/Form/HFormConnect.tsx +3 -3
- package/src/components/Form/config.ts +1 -1
- package/src/components/Form/hooks/index.ts +9 -9
- package/src/components/Form/hooks/useInitConfigData.tsx +3 -3
- package/src/components/Form/index.tsx +0 -1
- package/src/components/Form/modal.ts +8 -8
- package/src/components/Input/ButtonInput.tsx +27 -25
- package/src/components/Input/InputNumberGroup.tsx +4 -4
- package/src/components/Input/SelectInput.tsx +3 -2
- package/src/components/Input/TrimInput.tsx +3 -3
- package/src/components/Input/index.less +1 -1
- package/src/components/Input/modal.ts +1 -1
- package/src/components/PageHandler/ErrorComponent.tsx +4 -3
- package/src/components/PageHandler/index.tsx +0 -1
- package/src/components/PageHandler/modal.ts +1 -1
- package/src/components/Select/TreeSelect.tsx +51 -35
- package/src/components/Select/components/NotFoundContent.tsx +4 -3
- package/src/components/Select/index.less +18 -18
- package/src/components/Select/index.tsx +84 -75
- package/src/components/Select/modal.ts +2 -2
- package/src/components/Submit/components.tsx +5 -5
- package/src/components/Switch/index.tsx +16 -13
- package/src/components/TDPicker/RangePicker.tsx +2 -2
- package/src/components/Text/index.tsx +19 -6
- package/src/components/TextArea/TrimTextArea.tsx +3 -3
- package/src/components/Upload/MediaTypeEle/TypeEle.tsx +7 -1
- package/src/components/Upload/UrlUpload/index.tsx +1 -1
- package/src/components/Upload/index.tsx +4 -4
- package/src/components/index.tsx +1 -1
- package/src/components/styles/index.less +2 -2
- package/src/index.less +1 -0
- package/src/index.tsx +1 -0
- package/src/pages/DrawerForm/index.tsx +0 -3
- package/src/pages/Form/index.tsx +152 -77
- package/src/pages/Input/index.tsx +1 -1
- package/src/pages/ModalForm/index.tsx +3 -4
- package/src/pages/Switch/index.tsx +11 -11
- package/src/pages/Upload/index.tsx +6 -2
package/lib/index.css
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
flex-direction: row;
|
|
20
20
|
}
|
|
21
21
|
.ant-hw-select-box .ant-hw-group-addon-before {
|
|
22
|
-
border-
|
|
22
|
+
border-right: 0;
|
|
23
23
|
border-top-left-radius: 2px;
|
|
24
|
-
border-
|
|
24
|
+
border-bottom-left-radius: 2px;
|
|
25
25
|
}
|
|
26
26
|
.ant-hw-select-box .ant-select {
|
|
27
27
|
-webkit-box-flex: 1;
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
flex: 1;
|
|
31
31
|
}
|
|
32
32
|
.ant-hw-select-box .ant-hw-group-addon-after {
|
|
33
|
-
border-
|
|
33
|
+
border-left: 0;
|
|
34
34
|
border-top-right-radius: 2px;
|
|
35
|
-
border-
|
|
35
|
+
border-bottom-right-radius: 2px;
|
|
36
36
|
}
|
|
37
37
|
.ant-hw-select-box-addon-before .ant-select .ant-select-selector {
|
|
38
|
-
border-
|
|
39
|
-
border-
|
|
38
|
+
border-top-left-radius: 0 !important;
|
|
39
|
+
border-bottom-left-radius: 0 !important;
|
|
40
40
|
}
|
|
41
41
|
.ant-hw-select-box-addon-after .ant-select .ant-select-selector {
|
|
42
|
-
border-
|
|
43
|
-
border-
|
|
42
|
+
border-top-right-radius: 0 !important;
|
|
43
|
+
border-bottom-right-radius: 0 !important;
|
|
44
44
|
}
|
|
45
45
|
.ant-hw-form-item-colon:after {
|
|
46
46
|
position: relative;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./styles/index.less";
|
|
2
2
|
export { default as HForm } from "./Form";
|
|
3
3
|
export { default as useHForm } from "./Form/hooks/useHForm";
|
|
4
|
-
export { useHDialogForm } from "
|
|
4
|
+
export { useHDialogForm } from "@/components/DialogForm/hooks";
|
|
5
5
|
export { default as HFormConnect } from "./Form/HFormConnect";
|
|
6
6
|
export { default as HFormConfigProvider } from "./Form/Context/FormConfigProvider";
|
|
7
7
|
export { default as HBasicForm } from "./Form/Basic";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hw-component/form",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.48",
|
|
4
4
|
"description": "基于antd二次开发",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -85,13 +85,15 @@
|
|
|
85
85
|
"webpack": "^5.83.1",
|
|
86
86
|
"webpack-cli": "^5.1.1",
|
|
87
87
|
"webpack-dev-server": "^4.15.0",
|
|
88
|
-
"webpackbar": "^5.0.2"
|
|
88
|
+
"webpackbar": "^5.0.2",
|
|
89
|
+
"@hw-component/hj": "0.9.0"
|
|
89
90
|
},
|
|
90
91
|
"peerDependencies": {
|
|
91
92
|
"@ant-design/icons": "4.6.2",
|
|
92
93
|
"antd": "4.20.7",
|
|
93
94
|
"react": "17.0.0",
|
|
94
|
-
"react-dom": "17.0.2"
|
|
95
|
+
"react-dom": "17.0.2",
|
|
96
|
+
"@hw-component/hj": "0.9.0"
|
|
95
97
|
},
|
|
96
98
|
"cssPrefix": "hw"
|
|
97
99
|
}
|
|
@@ -43,15 +43,15 @@ const Index = ({
|
|
|
43
43
|
resultObj[key] = initValue[key];
|
|
44
44
|
});
|
|
45
45
|
return {
|
|
46
|
-
[
|
|
46
|
+
[name as string]: resultObj,
|
|
47
47
|
};
|
|
48
48
|
},
|
|
49
49
|
outputValue: (item, outputValue) => {
|
|
50
50
|
const { name = "" } = item;
|
|
51
|
-
const { [
|
|
51
|
+
const { [name as string]: itemVal = {} } = outputValue;
|
|
52
52
|
if (Array.isArray(itemVal)) {
|
|
53
53
|
return {
|
|
54
|
-
[
|
|
54
|
+
[name as string]: itemVal,
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
return {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Row, Space
|
|
1
|
+
import { Row, Space } from "antd";
|
|
2
|
+
import {HJBtn} from "@hw-component/hj";
|
|
2
3
|
|
|
3
4
|
interface IProps {
|
|
4
5
|
onOk?: VoidFunction;
|
|
@@ -7,13 +8,14 @@ interface IProps {
|
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export default ({ onCancel, onOk, confirmLoading }: IProps) => {
|
|
11
|
+
|
|
10
12
|
return (
|
|
11
13
|
<Row justify={"end"}>
|
|
12
|
-
<Space size={"
|
|
13
|
-
<
|
|
14
|
-
<
|
|
14
|
+
<Space size={"small"}>
|
|
15
|
+
<HJBtn onClick={onCancel}>关闭</HJBtn>
|
|
16
|
+
<HJBtn type={"primary"} onClick={onOk} loading={confirmLoading}>
|
|
15
17
|
确定
|
|
16
|
-
</
|
|
18
|
+
</HJBtn>
|
|
17
19
|
</Space>
|
|
18
20
|
</Row>
|
|
19
21
|
);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Drawer } from "antd";
|
|
2
2
|
import type { DialogFormProps } from "../modal";
|
|
3
|
-
import {
|
|
3
|
+
import {useCurrentForm, useFooterRender, useModifyProps, useSub} from "@/components/DialogForm/hooks";
|
|
4
4
|
import HForm from "../../Form";
|
|
5
5
|
import Title from "./Title";
|
|
6
|
-
import Footer from "./Footer";
|
|
7
6
|
import FormConfigProvider, {
|
|
8
7
|
useFormConfigContext,
|
|
9
8
|
} from "../../Form/Context/FormConfigProvider";
|
|
@@ -62,23 +61,13 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
62
61
|
setModalVisible(false);
|
|
63
62
|
};
|
|
64
63
|
const { loading, run } = useSub({ request, onFinish });
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
footer || (
|
|
74
|
-
<Footer
|
|
75
|
-
onCancel={cancel}
|
|
76
|
-
onOk={currentForm.submit}
|
|
77
|
-
confirmLoading={loading}
|
|
78
|
-
/>
|
|
79
|
-
)
|
|
80
|
-
);
|
|
81
|
-
};
|
|
64
|
+
|
|
65
|
+
const defaultFooter = useFooterRender({
|
|
66
|
+
dialogForm,
|
|
67
|
+
footer,
|
|
68
|
+
confirmLoading: loading,
|
|
69
|
+
params: formParams,
|
|
70
|
+
});
|
|
82
71
|
const node = (
|
|
83
72
|
<HForm
|
|
84
73
|
configData={modalFormData}
|
|
@@ -106,8 +95,8 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
106
95
|
{...props}
|
|
107
96
|
onClose={cancel}
|
|
108
97
|
closable={false}
|
|
109
|
-
destroyOnClose
|
|
110
|
-
footer={
|
|
98
|
+
destroyOnClose
|
|
99
|
+
footer={defaultFooter}
|
|
111
100
|
>
|
|
112
101
|
<FormConfigProvider {...providerConfig}>
|
|
113
102
|
<ChildComponent
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useFooterRender,
|
|
10
10
|
useModifyProps,
|
|
11
11
|
useSub,
|
|
12
|
-
} from "
|
|
12
|
+
} from "@/components/DialogForm/hooks";
|
|
13
13
|
import ChildComponent from "./ChildComponent";
|
|
14
14
|
import React from "react";
|
|
15
15
|
const Index: React.FC<DialogFormProps> = ({
|
|
@@ -97,7 +97,7 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
97
97
|
}}
|
|
98
98
|
{...props}
|
|
99
99
|
onOk={currentForm.submit}
|
|
100
|
-
destroyOnClose
|
|
100
|
+
destroyOnClose
|
|
101
101
|
footer={defaultFooter}
|
|
102
102
|
>
|
|
103
103
|
<FormConfigProvider {...providerConfig}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from "react";
|
|
1
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
2
2
|
import useHForm from "../Form/hooks/useHForm";
|
|
3
3
|
import type {
|
|
4
4
|
DialogFormProps,
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
ModifyPropsModal,
|
|
7
7
|
} from "./modal";
|
|
8
8
|
import { useRequest } from "ahooks";
|
|
9
|
+
import Footer from "@/components/DialogForm/DrawerForm/Footer";
|
|
9
10
|
|
|
10
11
|
export const useModifyProps = ({
|
|
11
12
|
visible,
|
|
@@ -127,11 +128,23 @@ export const useFooterRender = ({
|
|
|
127
128
|
dialogForm,
|
|
128
129
|
params,
|
|
129
130
|
}: Omit<DialogFormProps, "configData">) => {
|
|
130
|
-
if (
|
|
131
|
-
return
|
|
131
|
+
if (footer===null){
|
|
132
|
+
return null;
|
|
132
133
|
}
|
|
133
134
|
if (typeof footer === "function") {
|
|
134
135
|
return footer(dialogForm, confirmLoading, params);
|
|
135
136
|
}
|
|
136
|
-
return
|
|
137
|
+
return (
|
|
138
|
+
footer || (
|
|
139
|
+
<Footer
|
|
140
|
+
onCancel={()=>{
|
|
141
|
+
dialogForm?.hide();
|
|
142
|
+
}}
|
|
143
|
+
onOk={()=>{
|
|
144
|
+
dialogForm?.submit()
|
|
145
|
+
}}
|
|
146
|
+
confirmLoading={confirmLoading}
|
|
147
|
+
/>
|
|
148
|
+
)
|
|
149
|
+
);
|
|
137
150
|
};
|
|
@@ -29,7 +29,7 @@ export interface HDialogFormInstance<P = any, T = any> extends HFormInstance {
|
|
|
29
29
|
show: (data?: ShowParamsModal<P, T>) => void;
|
|
30
30
|
hide: VoidFunction;
|
|
31
31
|
}
|
|
32
|
-
type FooterRender = (
|
|
32
|
+
export type FooterRender = (
|
|
33
33
|
dialogForm?: HDialogFormInstance,
|
|
34
34
|
loading?: boolean,
|
|
35
35
|
params?: Record<string, any>
|
|
@@ -53,8 +53,8 @@ export default ({
|
|
|
53
53
|
...formItemProps,
|
|
54
54
|
...itemProps,
|
|
55
55
|
};
|
|
56
|
-
const arrayName=Array.isArray(name)?name.join("."):name;
|
|
57
|
-
const key=arrayName||nameKey;
|
|
56
|
+
const arrayName = Array.isArray(name) ? name.join(".") : name;
|
|
57
|
+
const key = arrayName || nameKey;
|
|
58
58
|
return (
|
|
59
59
|
<Item
|
|
60
60
|
{...itemData}
|
|
@@ -45,7 +45,7 @@ export default (
|
|
|
45
45
|
) => {
|
|
46
46
|
const { form, valueType = "float" } = useFormContext();
|
|
47
47
|
const { name } = props;
|
|
48
|
-
const relName=Array.isArray(name)?name.join("."):name;
|
|
48
|
+
const relName = Array.isArray(name) ? name.join(".") : name;
|
|
49
49
|
useEffect(() => {
|
|
50
50
|
if (!relName) {
|
|
51
51
|
return;
|
|
@@ -59,11 +59,11 @@ export default (
|
|
|
59
59
|
form?.addFormat(relName, formatMaker(props, aFormat[valueType]));
|
|
60
60
|
};
|
|
61
61
|
const addDispatchListener = (key: string, fn: argsFn) => {
|
|
62
|
-
const {dispatch } = props;
|
|
62
|
+
const { dispatch } = props;
|
|
63
63
|
if (!relName) {
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
form?.addDispatchListener({ key, name:relName, dispatch }, fn);
|
|
66
|
+
form?.addDispatchListener({ key, name: relName, dispatch }, fn);
|
|
67
67
|
};
|
|
68
68
|
const Component = component as React.ForwardRefRenderFunction<
|
|
69
69
|
any,
|
|
@@ -21,7 +21,7 @@ import VerificationCodeInput from "../Input/VerificationCodeInput";
|
|
|
21
21
|
import TrimInput from "../Input/TrimInput";
|
|
22
22
|
import TrimTextArea from "../TextArea/TrimTextArea";
|
|
23
23
|
import HInputNumberGroup from "../Input/InputNumberGroup";
|
|
24
|
-
import HText from
|
|
24
|
+
import HText from "../Text";
|
|
25
25
|
export const placeholderConfig = {
|
|
26
26
|
inputType: [
|
|
27
27
|
"input",
|
|
@@ -33,19 +33,19 @@ export const useInfoReq = ({
|
|
|
33
33
|
params: saveParams,
|
|
34
34
|
};
|
|
35
35
|
}, [params]);
|
|
36
|
-
|
|
37
|
-
if (typeof infoRequest==="object"){
|
|
38
|
-
const {request:infoReq
|
|
36
|
+
const { infoReq: initReq, options } = useMemo(() => {
|
|
37
|
+
if (typeof infoRequest === "object") {
|
|
38
|
+
const { request: infoReq, ...op } = infoRequest;
|
|
39
39
|
return {
|
|
40
40
|
infoReq,
|
|
41
|
-
options:op
|
|
42
|
-
}
|
|
41
|
+
options: op,
|
|
42
|
+
};
|
|
43
43
|
}
|
|
44
44
|
return {
|
|
45
|
-
infoReq:infoRequest,
|
|
46
|
-
options:{}
|
|
45
|
+
infoReq: infoRequest,
|
|
46
|
+
options: {},
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
}, [infoRequest]);
|
|
49
49
|
|
|
50
50
|
const subControl = useRequest(
|
|
51
51
|
async (value) => {
|
|
@@ -69,7 +69,7 @@ export const useInfoReq = ({
|
|
|
69
69
|
}
|
|
70
70
|
form?.setFieldsValue(initialValues);
|
|
71
71
|
return initialValues;
|
|
72
|
-
},options);
|
|
72
|
+
}, options);
|
|
73
73
|
const { run, mutate } = infoControl;
|
|
74
74
|
useEffect(() => {
|
|
75
75
|
if (form) {
|
|
@@ -135,7 +135,7 @@ const dispatchProvider = (
|
|
|
135
135
|
dispatchSourceData: DispatchSourceDataModal
|
|
136
136
|
) => {
|
|
137
137
|
const { name = "", dispatch = {}, dependencies = "allDependencies" } = item;
|
|
138
|
-
const relName=Array.isArray(name)?name.join("."):name;
|
|
138
|
+
const relName = Array.isArray(name) ? name.join(".") : name;
|
|
139
139
|
const {
|
|
140
140
|
fnKey,
|
|
141
141
|
dependencies: dispatchDependencies = dependencies as string | string[],
|
|
@@ -151,7 +151,7 @@ const dispatchProvider = (
|
|
|
151
151
|
};
|
|
152
152
|
dispatchDependencies.forEach((key) => {
|
|
153
153
|
const itemDispatch = itemDispatchProvider(
|
|
154
|
-
|
|
154
|
+
relName,
|
|
155
155
|
{ dependencies: key, fnKey, manual, reset },
|
|
156
156
|
dispatchSourceData
|
|
157
157
|
);
|
|
@@ -163,7 +163,7 @@ const dispatchProvider = (
|
|
|
163
163
|
return allDispatch;
|
|
164
164
|
}
|
|
165
165
|
const itemDispatch = itemDispatchProvider(
|
|
166
|
-
|
|
166
|
+
relName,
|
|
167
167
|
{ dependencies: dispatchDependencies, fnKey, manual, reset },
|
|
168
168
|
dispatchSourceData
|
|
169
169
|
);
|
|
@@ -35,8 +35,8 @@ import type { DataFnProvider } from "../modal";
|
|
|
35
35
|
import type { ColProps } from "antd/lib/grid/col";
|
|
36
36
|
import type { Gutter } from "antd/lib/grid/row";
|
|
37
37
|
import type { IUrlUploadProps } from "../Upload/modal";
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
38
|
+
import type { BaseOptions } from "@ahooksjs/use-request/lib/types";
|
|
39
|
+
import {HFormTextProps} from "../Text";
|
|
40
40
|
|
|
41
41
|
type RenderFun = (
|
|
42
42
|
props: HItemProps,
|
|
@@ -58,7 +58,7 @@ export type ItemPropsType =
|
|
|
58
58
|
| TextAreaProps
|
|
59
59
|
| IUpLoadProps
|
|
60
60
|
| CascaderProps<any>
|
|
61
|
-
| IUrlUploadProps;
|
|
61
|
+
| IUrlUploadProps|HFormTextProps;
|
|
62
62
|
|
|
63
63
|
export interface HoverModal {
|
|
64
64
|
text?: string;
|
|
@@ -92,7 +92,7 @@ export interface HItemProps
|
|
|
92
92
|
labelWidth?: number;
|
|
93
93
|
hide?: boolean | HideModal;
|
|
94
94
|
placeholder?: string | string[];
|
|
95
|
-
name?: string|string[];
|
|
95
|
+
name?: string | string[];
|
|
96
96
|
dispatch?: DispatchModal;
|
|
97
97
|
itemSpan?: ColProps;
|
|
98
98
|
hideLabel?: boolean;
|
|
@@ -100,17 +100,17 @@ export interface HItemProps
|
|
|
100
100
|
label?: React.ReactNode | HelperModal;
|
|
101
101
|
hidden?: boolean | HideModal;
|
|
102
102
|
rowWrapper?: boolean;
|
|
103
|
-
nameKey?:string;
|
|
103
|
+
nameKey?: string;
|
|
104
104
|
}
|
|
105
|
-
interface InfoRequestOp extends BaseOptions<any,any> {
|
|
106
|
-
request:PromiseFnResult;
|
|
105
|
+
interface InfoRequestOp extends BaseOptions<any, any> {
|
|
106
|
+
request: PromiseFnResult;
|
|
107
107
|
}
|
|
108
108
|
export interface HFormProps<T = any, R = any>
|
|
109
109
|
extends Omit<FormProps, "form" | "onFinish" | "labelAlign"> {
|
|
110
110
|
configData: HItemProps[];
|
|
111
111
|
labelWidth?: number;
|
|
112
112
|
request?: (values: T, params?: any) => Promise<R>;
|
|
113
|
-
infoRequest?: PromiseFnResult|InfoRequestOp;
|
|
113
|
+
infoRequest?: PromiseFnResult | InfoRequestOp;
|
|
114
114
|
valueType?: string;
|
|
115
115
|
form?: HFormInstance;
|
|
116
116
|
params?: any;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Input
|
|
1
|
+
import { Input} from "antd";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { useRequest } from "ahooks";
|
|
4
4
|
import type { HButtonInputProps } from "./modal";
|
|
5
|
-
|
|
5
|
+
import {HJBtn} from '@hw-component/hj'
|
|
6
6
|
const Index: React.FC<HButtonInputProps> = ({
|
|
7
7
|
buttonProps = {},
|
|
8
8
|
value,
|
|
9
9
|
onChange,
|
|
10
10
|
children,
|
|
11
11
|
request,
|
|
12
|
-
|
|
12
|
+
layType = "group",
|
|
13
13
|
...props
|
|
14
14
|
}) => {
|
|
15
15
|
const {
|
|
16
16
|
onClick,
|
|
17
|
-
type
|
|
17
|
+
type,
|
|
18
18
|
ghost = true,
|
|
19
19
|
loading: btnLoading,
|
|
20
20
|
...oProps
|
|
21
21
|
} = buttonProps;
|
|
22
|
-
const defaultBtnType=layType==="group"?"primary":"link"
|
|
23
|
-
const btnType=type||defaultBtnType
|
|
22
|
+
const defaultBtnType = layType === "group" ? "primary" : "link";
|
|
23
|
+
const btnType = type || defaultBtnType;
|
|
24
24
|
const { run, loading } = useRequest(
|
|
25
25
|
(val) => {
|
|
26
26
|
return request?.(val);
|
|
@@ -37,36 +37,38 @@ const Index: React.FC<HButtonInputProps> = ({
|
|
|
37
37
|
}
|
|
38
38
|
onClick?.(result, onChange);
|
|
39
39
|
};
|
|
40
|
-
if (layType==="text"){
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
if (layType === "text") {
|
|
41
|
+
return (
|
|
42
|
+
<Input
|
|
43
|
+
{...props}
|
|
44
|
+
suffix={
|
|
45
|
+
<HJBtn
|
|
46
|
+
type={btnType}
|
|
47
|
+
onClick={click}
|
|
48
|
+
size={"small"}
|
|
49
|
+
loading={loading || btnLoading}
|
|
50
|
+
ghost={ghost}
|
|
51
|
+
{...oProps}
|
|
52
|
+
>
|
|
53
|
+
{children}
|
|
54
|
+
</HJBtn>
|
|
55
|
+
}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
56
58
|
}
|
|
57
59
|
return (
|
|
58
60
|
<Input.Group compact style={{ display: "flex" }}>
|
|
59
61
|
<Input {...props} style={{ flex: 1 }} value={value} onChange={change} />
|
|
60
|
-
<
|
|
62
|
+
<HJBtn
|
|
61
63
|
type={btnType}
|
|
62
64
|
onClick={click}
|
|
63
65
|
loading={loading || btnLoading}
|
|
64
|
-
style={{ marginLeft: 8
|
|
66
|
+
style={{ marginLeft: 8}}
|
|
65
67
|
ghost={ghost}
|
|
66
68
|
{...oProps}
|
|
67
69
|
>
|
|
68
70
|
{children}
|
|
69
|
-
</
|
|
71
|
+
</HJBtn>
|
|
70
72
|
</Input.Group>
|
|
71
73
|
);
|
|
72
74
|
};
|
|
@@ -80,11 +80,11 @@ const InputNumberGroup = ({
|
|
|
80
80
|
inputValue: (item, initValue) => {
|
|
81
81
|
const { name: valueName = "" } = item;
|
|
82
82
|
const { min: minKey, max: maxKey } = valueMap;
|
|
83
|
-
const cuValue = initValue[
|
|
83
|
+
const cuValue = initValue[valueName as string];
|
|
84
84
|
const minInitVal = initValue[minKey];
|
|
85
85
|
const maxInitVal = initValue[maxKey];
|
|
86
86
|
return {
|
|
87
|
-
[
|
|
87
|
+
[valueName as string]: {
|
|
88
88
|
[min]: minInitVal,
|
|
89
89
|
[max]: maxInitVal,
|
|
90
90
|
...cuValue,
|
|
@@ -93,7 +93,7 @@ const InputNumberGroup = ({
|
|
|
93
93
|
},
|
|
94
94
|
outputValue: (item, outputValue) => {
|
|
95
95
|
const { name: valueName = "" } = item;
|
|
96
|
-
const { [
|
|
96
|
+
const { [valueName as string]: itemVal = {} } = outputValue;
|
|
97
97
|
const { min: minKey, max: maxKey } = valueMap;
|
|
98
98
|
const {
|
|
99
99
|
[minKey]: minSubVal,
|
|
@@ -103,7 +103,7 @@ const InputNumberGroup = ({
|
|
|
103
103
|
return {
|
|
104
104
|
[maxKey]: maxSubVal,
|
|
105
105
|
[minKey]: minSubVal,
|
|
106
|
-
[
|
|
106
|
+
[valueName as string]: oItemVal,
|
|
107
107
|
};
|
|
108
108
|
},
|
|
109
109
|
},
|
|
@@ -37,13 +37,14 @@ export const Index = ({
|
|
|
37
37
|
Object.values(valueName).forEach((key) => {
|
|
38
38
|
resultObj[key] = initValue[key];
|
|
39
39
|
});
|
|
40
|
+
console.log(item, valueName);
|
|
40
41
|
return {
|
|
41
|
-
[
|
|
42
|
+
[name as string]: resultObj,
|
|
42
43
|
};
|
|
43
44
|
},
|
|
44
45
|
outputValue: (item, outputValue) => {
|
|
45
46
|
const { name = "" } = item;
|
|
46
|
-
const { [
|
|
47
|
+
const { [name as string]: itemVal = {} } = outputValue;
|
|
47
48
|
const newItemVal = { [itemVal[select]]: itemVal[input] };
|
|
48
49
|
return {
|
|
49
50
|
...newItemVal,
|
|
@@ -8,14 +8,14 @@ const Index = ({ addFormat, ...props }: HInputProps) => {
|
|
|
8
8
|
inputValue: (item, initValue) => {
|
|
9
9
|
const { name: valueName = "" } = item;
|
|
10
10
|
return {
|
|
11
|
-
[
|
|
11
|
+
[valueName as string]: initValue[valueName as string],
|
|
12
12
|
};
|
|
13
13
|
},
|
|
14
14
|
outputValue: (item, outputValue) => {
|
|
15
15
|
const { name = "" } = item;
|
|
16
|
-
const { [
|
|
16
|
+
const { [name as string]: itemVal } = outputValue;
|
|
17
17
|
return {
|
|
18
|
-
[
|
|
18
|
+
[name as string]: itemVal?.trim(),
|
|
19
19
|
};
|
|
20
20
|
},
|
|
21
21
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Row, Space, Typography } from "antd";
|
|
2
2
|
import { ExclamationCircleOutlined } from "@ant-design/icons";
|
|
3
3
|
import type { IHPageHandler } from "./modal";
|
|
4
|
+
import {HJBtn} from "@hw-component/hj";
|
|
4
5
|
|
|
5
6
|
const { Text } = Typography;
|
|
6
7
|
export default ({ error, reload }: IHPageHandler) => {
|
|
@@ -11,9 +12,9 @@ export default ({ error, reload }: IHPageHandler) => {
|
|
|
11
12
|
<ExclamationCircleOutlined size={24} />
|
|
12
13
|
</Text>
|
|
13
14
|
<Text type={"danger"}>{error?.message}</Text>
|
|
14
|
-
<
|
|
15
|
+
<HJBtn type="primary" size={"small"} onClick={reload}>
|
|
15
16
|
重新加载
|
|
16
|
-
</
|
|
17
|
+
</HJBtn>
|
|
17
18
|
</Space>
|
|
18
19
|
</Row>
|
|
19
20
|
);
|
|
@@ -3,7 +3,6 @@ import Loading from "./LoadingComponent";
|
|
|
3
3
|
import ErrorComponent from "./ErrorComponent";
|
|
4
4
|
import type { IHPageHandler } from "./modal";
|
|
5
5
|
const Index: React.FC<IHPageHandler> = ({ error, data, reload, children }) => {
|
|
6
|
-
|
|
7
6
|
if (error) {
|
|
8
7
|
return <ErrorComponent error={error} reload={reload} />;
|
|
9
8
|
}
|