@hw-component/form 1.10.66 → 1.10.68

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.
@@ -50,7 +50,6 @@ var Index = function Index(_ref) {
50
50
  dialogForm: currentForm,
51
51
  params: params,
52
52
  title: title,
53
- onCancel: onCancel,
54
53
  autoClear: autoClear,
55
54
  afterClose: afterClose
56
55
  }),
@@ -114,7 +113,8 @@ var Index = function Index(_ref) {
114
113
  footer: footer,
115
114
  confirmLoading: loading,
116
115
  params: formParams,
117
- onOk: footerOnOk
116
+ onOk: footerOnOk,
117
+ onCancel: onCancel
118
118
  });
119
119
  var node = modalFormData && jsx(HForm, _objectSpread(_objectSpread({
120
120
  configData: modalFormData,
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import type { DialogFormProps, HDialogFormInstance, ModifyPropsModal } from "./modal";
3
- export declare const useModifyProps: ({ visible, configData, initialValues, dialogForm, afterClose, params, title, autoClear, onCancel }: ModifyPropsModal) => {
3
+ export declare const useModifyProps: ({ visible, configData, initialValues, dialogForm, afterClose, params, title, autoClear }: ModifyPropsModal) => {
4
4
  modalFormData: import("../Form/modal").HItemProps[] | undefined;
5
5
  modalVisible: boolean | undefined;
6
6
  setModalVisible: React.Dispatch<React.SetStateAction<boolean | undefined>>;
@@ -17,5 +17,5 @@ export declare const useSub: ({ request, onFinish }: Partial<DialogFormProps>) =
17
17
  interface FooterRenderParamsModal extends Omit<DialogFormProps, "configData"> {
18
18
  onOk: VoidFunction;
19
19
  }
20
- export declare const useFooterRender: ({ footer, confirmLoading, dialogForm, params, onOk, }: FooterRenderParamsModal) => any;
20
+ export declare const useFooterRender: ({ footer, confirmLoading, dialogForm, params, onOk, onCancel, }: FooterRenderParamsModal) => any;
21
21
  export {};
@@ -19,8 +19,7 @@ var useModifyProps = function useModifyProps(_ref) {
19
19
  afterClose = _ref.afterClose,
20
20
  params = _ref.params,
21
21
  title = _ref.title,
22
- autoClear = _ref.autoClear,
23
- onCancel = _ref.onCancel;
22
+ autoClear = _ref.autoClear;
24
23
  var _useState = useState(visible),
25
24
  _useState2 = _slicedToArray(_useState, 2),
26
25
  modalVisible = _useState2[0],
@@ -88,10 +87,6 @@ var useModifyProps = function useModifyProps(_ref) {
88
87
  setModalVisible(true);
89
88
  };
90
89
  dialogForm.hide = function () {
91
- if (onCancel) {
92
- onCancel();
93
- return;
94
- }
95
90
  setModalVisible(false);
96
91
  };
97
92
  }, [afterClose, autoClear]);
@@ -182,7 +177,8 @@ var useFooterRender = function useFooterRender(_ref4) {
182
177
  confirmLoading = _ref4.confirmLoading,
183
178
  dialogForm = _ref4.dialogForm,
184
179
  params = _ref4.params,
185
- onOk = _ref4.onOk;
180
+ onOk = _ref4.onOk,
181
+ _onCancel = _ref4.onCancel;
186
182
  if (footer === null) {
187
183
  return null;
188
184
  }
@@ -191,7 +187,11 @@ var useFooterRender = function useFooterRender(_ref4) {
191
187
  }
192
188
  return footer || jsx(Footer, {
193
189
  onCancel: function onCancel() {
194
- dialogForm === null || dialogForm === void 0 || dialogForm.hide();
190
+ if (dialogForm) {
191
+ dialogForm.hide();
192
+ return;
193
+ }
194
+ _onCancel === null || _onCancel === void 0 || _onCancel();
195
195
  },
196
196
  onOk: onOk,
197
197
  confirmLoading: confirmLoading
@@ -53,7 +53,6 @@ var Index = function Index(_ref) {
53
53
  dialogForm: currentForm,
54
54
  params: params,
55
55
  title: title,
56
- onCancel: onCancel,
57
56
  autoClear: autoClear,
58
57
  afterClose: afterClose
59
58
  }),
@@ -117,7 +116,8 @@ var Index = function Index(_ref) {
117
116
  footer: footer,
118
117
  confirmLoading: loading,
119
118
  params: formParams,
120
- onOk: footerOnOk
119
+ onOk: footerOnOk,
120
+ onCancel: onCancel
121
121
  });
122
122
  var node = modalFormData && jsxRuntime.jsx(index.default, _objectSpread(_objectSpread({
123
123
  configData: modalFormData,
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import type { DialogFormProps, HDialogFormInstance, ModifyPropsModal } from "./modal";
3
- export declare const useModifyProps: ({ visible, configData, initialValues, dialogForm, afterClose, params, title, autoClear, onCancel }: ModifyPropsModal) => {
3
+ export declare const useModifyProps: ({ visible, configData, initialValues, dialogForm, afterClose, params, title, autoClear }: ModifyPropsModal) => {
4
4
  modalFormData: import("../Form/modal").HItemProps[] | undefined;
5
5
  modalVisible: boolean | undefined;
6
6
  setModalVisible: React.Dispatch<React.SetStateAction<boolean | undefined>>;
@@ -17,5 +17,5 @@ export declare const useSub: ({ request, onFinish }: Partial<DialogFormProps>) =
17
17
  interface FooterRenderParamsModal extends Omit<DialogFormProps, "configData"> {
18
18
  onOk: VoidFunction;
19
19
  }
20
- export declare const useFooterRender: ({ footer, confirmLoading, dialogForm, params, onOk, }: FooterRenderParamsModal) => any;
20
+ export declare const useFooterRender: ({ footer, confirmLoading, dialogForm, params, onOk, onCancel, }: FooterRenderParamsModal) => any;
21
21
  export {};
@@ -20,8 +20,7 @@ var useModifyProps = function useModifyProps(_ref) {
20
20
  afterClose = _ref.afterClose,
21
21
  params = _ref.params,
22
22
  title = _ref.title,
23
- autoClear = _ref.autoClear,
24
- onCancel = _ref.onCancel;
23
+ autoClear = _ref.autoClear;
25
24
  var _useState = React.useState(visible),
26
25
  _useState2 = _slicedToArray(_useState, 2),
27
26
  modalVisible = _useState2[0],
@@ -89,10 +88,6 @@ var useModifyProps = function useModifyProps(_ref) {
89
88
  setModalVisible(true);
90
89
  };
91
90
  dialogForm.hide = function () {
92
- if (onCancel) {
93
- onCancel();
94
- return;
95
- }
96
91
  setModalVisible(false);
97
92
  };
98
93
  }, [afterClose, autoClear]);
@@ -183,7 +178,8 @@ var useFooterRender = function useFooterRender(_ref4) {
183
178
  confirmLoading = _ref4.confirmLoading,
184
179
  dialogForm = _ref4.dialogForm,
185
180
  params = _ref4.params,
186
- onOk = _ref4.onOk;
181
+ onOk = _ref4.onOk,
182
+ _onCancel = _ref4.onCancel;
187
183
  if (footer === null) {
188
184
  return null;
189
185
  }
@@ -192,7 +188,11 @@ var useFooterRender = function useFooterRender(_ref4) {
192
188
  }
193
189
  return footer || jsxRuntime.jsx(Footer.default, {
194
190
  onCancel: function onCancel() {
195
- dialogForm === null || dialogForm === void 0 || dialogForm.hide();
191
+ if (dialogForm) {
192
+ dialogForm.hide();
193
+ return;
194
+ }
195
+ _onCancel === null || _onCancel === void 0 || _onCancel();
196
196
  },
197
197
  onOk: onOk,
198
198
  confirmLoading: confirmLoading
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.10.66",
3
+ "version": "1.10.68",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -55,7 +55,6 @@ const Index: React.FC<DialogFormProps> = ({
55
55
  dialogForm: currentForm,
56
56
  params,
57
57
  title,
58
- onCancel,
59
58
  autoClear,
60
59
  afterClose,
61
60
  });
@@ -88,6 +87,7 @@ const Index: React.FC<DialogFormProps> = ({
88
87
  confirmLoading: loading,
89
88
  params: formParams,
90
89
  onOk: footerOnOk,
90
+ onCancel
91
91
  });
92
92
  const node = modalFormData && (
93
93
  <HForm
@@ -16,8 +16,7 @@ export const useModifyProps = ({
16
16
  afterClose,
17
17
  params,
18
18
  title,
19
- autoClear,
20
- onCancel
19
+ autoClear
21
20
  }: ModifyPropsModal) => {
22
21
  const [modalVisible, setModalVisible] = useState(visible);
23
22
  const [modalFormData, setModalFormData] = useState(configData);
@@ -74,10 +73,6 @@ export const useModifyProps = ({
74
73
  setModalVisible(true);
75
74
  };
76
75
  dialogForm.hide = () => {
77
- if (onCancel){
78
- onCancel();
79
- return;
80
- }
81
76
  setModalVisible(false);
82
77
  };
83
78
  }, [afterClose, autoClear]);
@@ -163,6 +158,7 @@ export const useFooterRender = ({
163
158
  dialogForm,
164
159
  params,
165
160
  onOk,
161
+ onCancel,
166
162
  }: FooterRenderParamsModal) => {
167
163
  if (footer === null) {
168
164
  return null;
@@ -174,7 +170,11 @@ export const useFooterRender = ({
174
170
  footer || (
175
171
  <Footer
176
172
  onCancel={() => {
177
- dialogForm?.hide();
173
+ if (dialogForm){
174
+ dialogForm.hide();
175
+ return;
176
+ }
177
+ onCancel?.();
178
178
  }}
179
179
  onOk={onOk}
180
180
  confirmLoading={confirmLoading}