@hw-component/form 0.0.6-beta-v7 → 0.0.6-beta-v8
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/DrawerForm/index.js +6 -5
- package/es/DialogForm/ModalForm.js +1 -2
- package/es/DialogForm/hooks.js +3 -0
- package/lib/DialogForm/DrawerForm/index.js +6 -5
- package/lib/DialogForm/ModalForm.js +1 -2
- package/lib/DialogForm/hooks.js +3 -0
- package/package.json +1 -1
- package/src/components/DialogForm/DrawerForm/index.tsx +4 -2
- package/src/components/DialogForm/ModalForm.tsx +1 -1
- package/src/components/DialogForm/hooks.ts +3 -0
- package/src/pages/ModalForm/index.tsx +4 -0
|
@@ -32,8 +32,7 @@ var DrawerForm = (function (_ref) {
|
|
|
32
32
|
var dialogForm = _ref.dialogForm,
|
|
33
33
|
_ref$closable = _ref.closable,
|
|
34
34
|
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
35
|
-
|
|
36
|
-
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
35
|
+
initialValues = _ref.initialValues,
|
|
37
36
|
labelWidth = _ref.labelWidth,
|
|
38
37
|
onOk = _ref.onOk,
|
|
39
38
|
onFinish = _ref.onFinish;
|
|
@@ -50,14 +49,16 @@ var DrawerForm = (function (_ref) {
|
|
|
50
49
|
visible: visible,
|
|
51
50
|
initialValues: initialValues,
|
|
52
51
|
dialogForm: currentForm,
|
|
53
|
-
params: params
|
|
52
|
+
params: params,
|
|
53
|
+
title: title
|
|
54
54
|
}),
|
|
55
55
|
modalVisible = _useModifyProps.modalVisible,
|
|
56
56
|
modalFormData = _useModifyProps.modalFormData,
|
|
57
57
|
setModalVisible = _useModifyProps.setModalVisible,
|
|
58
58
|
initValue = _useModifyProps.initValue,
|
|
59
59
|
onAfterClose = _useModifyProps.onAfterClose,
|
|
60
|
-
formParams = _useModifyProps.formParams
|
|
60
|
+
formParams = _useModifyProps.formParams,
|
|
61
|
+
modalTitle = _useModifyProps.title;
|
|
61
62
|
var cancel = function cancel() {
|
|
62
63
|
onAfterClose();
|
|
63
64
|
if (onCancel) {
|
|
@@ -84,7 +85,7 @@ var DrawerForm = (function (_ref) {
|
|
|
84
85
|
return jsx(Drawer, _objectSpread(_objectSpread({
|
|
85
86
|
visible: modalVisible,
|
|
86
87
|
title: jsx(Title, {
|
|
87
|
-
title:
|
|
88
|
+
title: modalTitle,
|
|
88
89
|
closable: closable,
|
|
89
90
|
onCancel: cancel
|
|
90
91
|
})
|
|
@@ -28,8 +28,7 @@ var ModalForm = (function (_ref) {
|
|
|
28
28
|
request = _ref.request,
|
|
29
29
|
_afterClose = _ref.afterClose,
|
|
30
30
|
dialogForm = _ref.dialogForm,
|
|
31
|
-
|
|
32
|
-
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
31
|
+
initialValues = _ref.initialValues,
|
|
33
32
|
onFinish = _ref.onFinish,
|
|
34
33
|
params = _ref.params,
|
|
35
34
|
onOk = _ref.onOk,
|
package/es/DialogForm/hooks.js
CHANGED
|
@@ -62,6 +62,9 @@ var useModifyProps = function useModifyProps(_ref) {
|
|
|
62
62
|
useEffect(function () {
|
|
63
63
|
setModalTitle(title);
|
|
64
64
|
}, [title]);
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
setInitValue(initialValues);
|
|
67
|
+
}, [initialValues]);
|
|
65
68
|
useEffect(function () {
|
|
66
69
|
dialogForm.show = function () {
|
|
67
70
|
var showParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -35,8 +35,7 @@ var DrawerForm = (function (_ref) {
|
|
|
35
35
|
var dialogForm = _ref.dialogForm,
|
|
36
36
|
_ref$closable = _ref.closable,
|
|
37
37
|
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
38
|
-
|
|
39
|
-
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
38
|
+
initialValues = _ref.initialValues,
|
|
40
39
|
labelWidth = _ref.labelWidth,
|
|
41
40
|
onOk = _ref.onOk,
|
|
42
41
|
onFinish = _ref.onFinish;
|
|
@@ -53,14 +52,16 @@ var DrawerForm = (function (_ref) {
|
|
|
53
52
|
visible: visible,
|
|
54
53
|
initialValues: initialValues,
|
|
55
54
|
dialogForm: currentForm,
|
|
56
|
-
params: params
|
|
55
|
+
params: params,
|
|
56
|
+
title: title
|
|
57
57
|
}),
|
|
58
58
|
modalVisible = _useModifyProps.modalVisible,
|
|
59
59
|
modalFormData = _useModifyProps.modalFormData,
|
|
60
60
|
setModalVisible = _useModifyProps.setModalVisible,
|
|
61
61
|
initValue = _useModifyProps.initValue,
|
|
62
62
|
onAfterClose = _useModifyProps.onAfterClose,
|
|
63
|
-
formParams = _useModifyProps.formParams
|
|
63
|
+
formParams = _useModifyProps.formParams,
|
|
64
|
+
modalTitle = _useModifyProps.title;
|
|
64
65
|
var cancel = function cancel() {
|
|
65
66
|
onAfterClose();
|
|
66
67
|
if (onCancel) {
|
|
@@ -87,7 +88,7 @@ var DrawerForm = (function (_ref) {
|
|
|
87
88
|
return jsxRuntime.jsx(antd.Drawer, _objectSpread(_objectSpread({
|
|
88
89
|
visible: modalVisible,
|
|
89
90
|
title: jsxRuntime.jsx(Title.default, {
|
|
90
|
-
title:
|
|
91
|
+
title: modalTitle,
|
|
91
92
|
closable: closable,
|
|
92
93
|
onCancel: cancel
|
|
93
94
|
})
|
|
@@ -31,8 +31,7 @@ var ModalForm = (function (_ref) {
|
|
|
31
31
|
request = _ref.request,
|
|
32
32
|
_afterClose = _ref.afterClose,
|
|
33
33
|
dialogForm = _ref.dialogForm,
|
|
34
|
-
|
|
35
|
-
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
34
|
+
initialValues = _ref.initialValues,
|
|
36
35
|
onFinish = _ref.onFinish,
|
|
37
36
|
params = _ref.params,
|
|
38
37
|
onOk = _ref.onOk,
|
package/lib/DialogForm/hooks.js
CHANGED
|
@@ -63,6 +63,9 @@ var useModifyProps = function useModifyProps(_ref) {
|
|
|
63
63
|
React.useEffect(function () {
|
|
64
64
|
setModalTitle(title);
|
|
65
65
|
}, [title]);
|
|
66
|
+
React.useEffect(function () {
|
|
67
|
+
setInitValue(initialValues);
|
|
68
|
+
}, [initialValues]);
|
|
66
69
|
React.useEffect(function () {
|
|
67
70
|
dialogForm.show = function () {
|
|
68
71
|
var showParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ export default ({
|
|
|
15
15
|
afterClose,
|
|
16
16
|
dialogForm,
|
|
17
17
|
closable = true,
|
|
18
|
-
initialValues
|
|
18
|
+
initialValues,
|
|
19
19
|
labelWidth,
|
|
20
20
|
onOk,
|
|
21
21
|
onFinish,
|
|
@@ -35,12 +35,14 @@ export default ({
|
|
|
35
35
|
initValue,
|
|
36
36
|
onAfterClose,
|
|
37
37
|
formParams,
|
|
38
|
+
title:modalTitle
|
|
38
39
|
} = useModifyProps({
|
|
39
40
|
configData,
|
|
40
41
|
visible,
|
|
41
42
|
initialValues,
|
|
42
43
|
dialogForm: currentForm,
|
|
43
44
|
params,
|
|
45
|
+
title
|
|
44
46
|
});
|
|
45
47
|
const cancel = () => {
|
|
46
48
|
onAfterClose();
|
|
@@ -67,7 +69,7 @@ export default ({
|
|
|
67
69
|
return (
|
|
68
70
|
<Drawer
|
|
69
71
|
visible={modalVisible}
|
|
70
|
-
title={<Title title={
|
|
72
|
+
title={<Title title={modalTitle} closable={closable} onCancel={cancel} />}
|
|
71
73
|
{...props}
|
|
72
74
|
onClose={cancel}
|
|
73
75
|
closable={false}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Button } from "antd";
|
|
2
2
|
import { HModalForm, useHDialogForm ,HFormConfigProvider} from "../../components";
|
|
3
|
+
import {useState} from "react";
|
|
4
|
+
import {ShowParamsModal} from "@/components/DialogForm/modal";
|
|
3
5
|
const data = [
|
|
4
6
|
{
|
|
5
7
|
label: "输入框",
|
|
@@ -118,6 +120,8 @@ const data = [
|
|
|
118
120
|
let num = 0;
|
|
119
121
|
export default () => {
|
|
120
122
|
const modalForm = useHDialogForm();
|
|
123
|
+
const [testModal,setTestModal]=useState<ShowParamsModal>({});
|
|
124
|
+
const {visible,params}=testModal;
|
|
121
125
|
return (
|
|
122
126
|
<>
|
|
123
127
|
<Button
|