@hw-component/form 1.9.83 → 1.9.84

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.
@@ -127,6 +127,13 @@ var Index = function Index(_ref) {
127
127
  infoRequest: infoRequest,
128
128
  labelWidth: labelWidth
129
129
  }));
130
+ var selfAfterClose = function selfAfterClose() {
131
+ if (autoClear) {
132
+ dialogForm === null || dialogForm === void 0 || dialogForm.clear();
133
+ return;
134
+ }
135
+ dialogForm === null || dialogForm === void 0 || dialogForm.resetFormStatus();
136
+ };
130
137
  return jsx(Drawer, _objectSpread(_objectSpread({
131
138
  visible: modalVisible,
132
139
  title: jsx(Title, {
@@ -140,9 +147,7 @@ var Index = function Index(_ref) {
140
147
  if (changeVisible) {
141
148
  return;
142
149
  }
143
- if (autoClear) {
144
- dialogForm === null || dialogForm === void 0 || dialogForm.clear();
145
- }
150
+ selfAfterClose();
146
151
  afterClose === null || afterClose === void 0 || afterClose();
147
152
  },
148
153
  closable: false,
@@ -51,8 +51,10 @@ var Index = function Index(_ref) {
51
51
  setModalVisible = _useModifyProps.setModalVisible,
52
52
  initValue = _useModifyProps.initValue,
53
53
  formParams = _useModifyProps.formParams,
54
- modalTitle = _useModifyProps.title;
54
+ modalTitle = _useModifyProps.title,
55
+ saveOldParams = _useModifyProps.saveOldParams;
55
56
  var cancel = function cancel() {
57
+ saveOldParams();
56
58
  if (onCancel) {
57
59
  return onCancel === null || onCancel === void 0 ? void 0 : onCancel();
58
60
  }
@@ -116,15 +118,20 @@ var Index = function Index(_ref) {
116
118
  params: formParams,
117
119
  onOk: footerOnOk
118
120
  });
121
+ var selfAfterClose = function selfAfterClose() {
122
+ if (autoClear) {
123
+ dialogForm === null || dialogForm === void 0 || dialogForm.clear();
124
+ return;
125
+ }
126
+ dialogForm === null || dialogForm === void 0 || dialogForm.resetFormStatus();
127
+ };
119
128
  return jsx(Modal, _objectSpread(_objectSpread({
120
129
  title: modalTitle,
121
130
  visible: modalVisible,
122
131
  onCancel: cancel,
123
132
  confirmLoading: loading,
124
133
  afterClose: function afterClose() {
125
- if (autoClear) {
126
- currentForm.clear();
127
- }
134
+ selfAfterClose();
128
135
  _afterClose === null || _afterClose === void 0 || _afterClose();
129
136
  }
130
137
  }, props), {}, {
@@ -47,7 +47,6 @@ var useModifyProps = function useModifyProps(_ref) {
47
47
  }, []);
48
48
  var saveOldParams = function saveOldParams() {
49
49
  saveOldParamsObj.old = dialogForm.outputValues();
50
- console.log(saveOldParamsObj.old, "saveOldParamsObj.old");
51
50
  };
52
51
  useEffect(function () {
53
52
  setModalVisible(visible);
@@ -81,7 +80,6 @@ var useModifyProps = function useModifyProps(_ref) {
81
80
  setModalTitle(changeTitle);
82
81
  }
83
82
  var relChangeInitVal = autoClear ? changeInitialValues : _objectSpread(_objectSpread({}, saveOldParamsObj.old), changeInitialValues);
84
- console.log(relChangeInitVal, "relChangeInitVal");
85
83
  setInitValue(relChangeInitVal);
86
84
  setModalVisible(true);
87
85
  };
@@ -201,6 +201,9 @@ var useHForm = (function () {
201
201
  form.resetFields();
202
202
  isLoading = false;
203
203
  },
204
+ resetFormStatus: function resetFormStatus() {
205
+ isLoading = false;
206
+ },
204
207
  inited: false
205
208
  });
206
209
  }, []);
@@ -151,6 +151,7 @@ export interface HFormInstance extends FormInstance {
151
151
  resetFieldsInitValue: (values?: Record<string, any>) => void;
152
152
  clearFormat: (name: string) => void;
153
153
  inited: boolean;
154
+ resetFormStatus: VoidFunction;
154
155
  }
155
156
  export interface ConnectConfigModal {
156
157
  format?: Record<string, addFormatItemModal>;
@@ -68,7 +68,6 @@ var HRangePicker = function HRangePicker(_ref) {
68
68
  }
69
69
  });
70
70
  var hasKeys = Object.keys(resultObj).length !== 0;
71
- console.log(initValue, dateMapKeys, valueName, resultObj, "resultObjresultObjresultObj");
72
71
  return _defineProperty({}, valueName, hasKeys ? resultObj : null);
73
72
  },
74
73
  outputValue: function outputValue(item, _outputValue) {
@@ -130,6 +130,13 @@ var Index = function Index(_ref) {
130
130
  infoRequest: infoRequest,
131
131
  labelWidth: labelWidth
132
132
  }));
133
+ var selfAfterClose = function selfAfterClose() {
134
+ if (autoClear) {
135
+ dialogForm === null || dialogForm === void 0 || dialogForm.clear();
136
+ return;
137
+ }
138
+ dialogForm === null || dialogForm === void 0 || dialogForm.resetFormStatus();
139
+ };
133
140
  return jsxRuntime.jsx(antd.Drawer, _objectSpread(_objectSpread({
134
141
  visible: modalVisible,
135
142
  title: jsxRuntime.jsx(Title.default, {
@@ -143,9 +150,7 @@ var Index = function Index(_ref) {
143
150
  if (changeVisible) {
144
151
  return;
145
152
  }
146
- if (autoClear) {
147
- dialogForm === null || dialogForm === void 0 || dialogForm.clear();
148
- }
153
+ selfAfterClose();
149
154
  afterClose === null || afterClose === void 0 || afterClose();
150
155
  },
151
156
  closable: false,
@@ -54,8 +54,10 @@ var Index = function Index(_ref) {
54
54
  setModalVisible = _useModifyProps.setModalVisible,
55
55
  initValue = _useModifyProps.initValue,
56
56
  formParams = _useModifyProps.formParams,
57
- modalTitle = _useModifyProps.title;
57
+ modalTitle = _useModifyProps.title,
58
+ saveOldParams = _useModifyProps.saveOldParams;
58
59
  var cancel = function cancel() {
60
+ saveOldParams();
59
61
  if (onCancel) {
60
62
  return onCancel === null || onCancel === void 0 ? void 0 : onCancel();
61
63
  }
@@ -119,15 +121,20 @@ var Index = function Index(_ref) {
119
121
  params: formParams,
120
122
  onOk: footerOnOk
121
123
  });
124
+ var selfAfterClose = function selfAfterClose() {
125
+ if (autoClear) {
126
+ dialogForm === null || dialogForm === void 0 || dialogForm.clear();
127
+ return;
128
+ }
129
+ dialogForm === null || dialogForm === void 0 || dialogForm.resetFormStatus();
130
+ };
122
131
  return jsxRuntime.jsx(antd.Modal, _objectSpread(_objectSpread({
123
132
  title: modalTitle,
124
133
  visible: modalVisible,
125
134
  onCancel: cancel,
126
135
  confirmLoading: loading,
127
136
  afterClose: function afterClose() {
128
- if (autoClear) {
129
- currentForm.clear();
130
- }
137
+ selfAfterClose();
131
138
  _afterClose === null || _afterClose === void 0 || _afterClose();
132
139
  }
133
140
  }, props), {}, {
@@ -48,7 +48,6 @@ var useModifyProps = function useModifyProps(_ref) {
48
48
  }, []);
49
49
  var saveOldParams = function saveOldParams() {
50
50
  saveOldParamsObj.old = dialogForm.outputValues();
51
- console.log(saveOldParamsObj.old, "saveOldParamsObj.old");
52
51
  };
53
52
  React.useEffect(function () {
54
53
  setModalVisible(visible);
@@ -82,7 +81,6 @@ var useModifyProps = function useModifyProps(_ref) {
82
81
  setModalTitle(changeTitle);
83
82
  }
84
83
  var relChangeInitVal = autoClear ? changeInitialValues : _objectSpread(_objectSpread({}, saveOldParamsObj.old), changeInitialValues);
85
- console.log(relChangeInitVal, "relChangeInitVal");
86
84
  setInitValue(relChangeInitVal);
87
85
  setModalVisible(true);
88
86
  };
@@ -204,6 +204,9 @@ var useHForm = (function () {
204
204
  form.resetFields();
205
205
  isLoading = false;
206
206
  },
207
+ resetFormStatus: function resetFormStatus() {
208
+ isLoading = false;
209
+ },
207
210
  inited: false
208
211
  });
209
212
  }, []);
@@ -151,6 +151,7 @@ export interface HFormInstance extends FormInstance {
151
151
  resetFieldsInitValue: (values?: Record<string, any>) => void;
152
152
  clearFormat: (name: string) => void;
153
153
  inited: boolean;
154
+ resetFormStatus: VoidFunction;
154
155
  }
155
156
  export interface ConnectConfigModal {
156
157
  format?: Record<string, addFormatItemModal>;
@@ -71,7 +71,6 @@ var HRangePicker = function HRangePicker(_ref) {
71
71
  }
72
72
  });
73
73
  var hasKeys = Object.keys(resultObj).length !== 0;
74
- console.log(initValue, dateMapKeys, valueName, resultObj, "resultObjresultObjresultObj");
75
74
  return _defineProperty({}, valueName, hasKeys ? resultObj : null);
76
75
  },
77
76
  outputValue: function outputValue(item, _outputValue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.83",
3
+ "version": "1.9.84",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -102,6 +102,13 @@ const Index: React.FC<DialogFormProps> = ({
102
102
  labelWidth={labelWidth}
103
103
  />
104
104
  );
105
+ const selfAfterClose=()=>{
106
+ if (autoClear){
107
+ dialogForm?.clear();
108
+ return;
109
+ }
110
+ dialogForm?.resetFormStatus();
111
+ }
105
112
  return (
106
113
  <Drawer
107
114
  visible={modalVisible}
@@ -112,9 +119,7 @@ const Index: React.FC<DialogFormProps> = ({
112
119
  if (changeVisible){
113
120
  return;
114
121
  }
115
- if (autoClear){
116
- dialogForm?.clear();
117
- }
122
+ selfAfterClose();
118
123
  afterClose?.();
119
124
  }}
120
125
  closable={false}
@@ -43,6 +43,7 @@ const Index: React.FC<DialogFormProps> = ({
43
43
  initValue,
44
44
  formParams,
45
45
  title: modalTitle,
46
+ saveOldParams,
46
47
  } = useModifyProps({
47
48
  configData,
48
49
  visible,
@@ -53,6 +54,7 @@ const Index: React.FC<DialogFormProps> = ({
53
54
  onCancel,
54
55
  });
55
56
  const cancel = () => {
57
+ saveOldParams();
56
58
  if (onCancel) {
57
59
  return onCancel?.();
58
60
  }
@@ -93,6 +95,13 @@ const Index: React.FC<DialogFormProps> = ({
93
95
  params: formParams,
94
96
  onOk:footerOnOk
95
97
  });
98
+ const selfAfterClose=()=>{
99
+ if (autoClear){
100
+ dialogForm?.clear();
101
+ return;
102
+ }
103
+ dialogForm?.resetFormStatus();
104
+ }
96
105
  return (
97
106
  <Modal
98
107
  title={modalTitle}
@@ -100,9 +109,7 @@ const Index: React.FC<DialogFormProps> = ({
100
109
  onCancel={cancel}
101
110
  confirmLoading={loading}
102
111
  afterClose={() => {
103
- if (autoClear) {
104
- currentForm.clear();
105
- }
112
+ selfAfterClose();
106
113
  afterClose?.();
107
114
  }}
108
115
  {...props}
@@ -30,7 +30,6 @@ export const useModifyProps = ({
30
30
  }, []);
31
31
  const saveOldParams = () => {
32
32
  saveOldParamsObj.old = dialogForm.outputValues();
33
- console.log(saveOldParamsObj.old,"saveOldParamsObj.old")
34
33
  };
35
34
  useEffect(() => {
36
35
  setModalVisible(visible);
@@ -66,7 +65,6 @@ export const useModifyProps = ({
66
65
  const relChangeInitVal = autoClear
67
66
  ? changeInitialValues
68
67
  : { ...saveOldParamsObj.old, ...changeInitialValues };
69
- console.log(relChangeInitVal,"relChangeInitVal")
70
68
  setInitValue(relChangeInitVal);
71
69
  setModalVisible(true);
72
70
  };
@@ -190,6 +190,9 @@ export default () => {
190
190
  form.resetFields();
191
191
  isLoading = false;
192
192
  },
193
+ resetFormStatus:()=>{
194
+ isLoading = false;
195
+ },
193
196
  inited:false
194
197
  };
195
198
  }, []);
@@ -210,6 +210,7 @@ export interface HFormInstance extends FormInstance {
210
210
  resetFieldsInitValue: (values?: Record<string, any>) => void;
211
211
  clearFormat: (name: string) => void;
212
212
  inited:boolean;
213
+ resetFormStatus:VoidFunction
213
214
  }
214
215
 
215
216
  export interface ConnectConfigModal {
@@ -61,7 +61,6 @@ const HRangePicker: React.FC<HRangePickerProps> = ({
61
61
  }
62
62
  });
63
63
  const hasKeys = Object.keys(resultObj).length !== 0;
64
- console.log(initValue,dateMapKeys,valueName,resultObj,"resultObjresultObjresultObj")
65
64
  return {
66
65
  [valueName as string]: hasKeys ? resultObj : null,
67
66
  };