@hw-component/form 1.9.83 → 1.9.85

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,
@@ -44,15 +44,18 @@ var Index = function Index(_ref) {
44
44
  dialogForm: currentForm,
45
45
  params: params,
46
46
  title: title,
47
- onCancel: onCancel
47
+ onCancel: onCancel,
48
+ autoClear: autoClear
48
49
  }),
49
50
  modalVisible = _useModifyProps.modalVisible,
50
51
  modalFormData = _useModifyProps.modalFormData,
51
52
  setModalVisible = _useModifyProps.setModalVisible,
52
53
  initValue = _useModifyProps.initValue,
53
54
  formParams = _useModifyProps.formParams,
54
- modalTitle = _useModifyProps.title;
55
+ modalTitle = _useModifyProps.title,
56
+ saveOldParams = _useModifyProps.saveOldParams;
55
57
  var cancel = function cancel() {
58
+ saveOldParams();
56
59
  if (onCancel) {
57
60
  return onCancel === null || onCancel === void 0 ? void 0 : onCancel();
58
61
  }
@@ -116,15 +119,20 @@ var Index = function Index(_ref) {
116
119
  params: formParams,
117
120
  onOk: footerOnOk
118
121
  });
122
+ var selfAfterClose = function selfAfterClose() {
123
+ if (autoClear) {
124
+ dialogForm === null || dialogForm === void 0 || dialogForm.clear();
125
+ return;
126
+ }
127
+ dialogForm === null || dialogForm === void 0 || dialogForm.resetFormStatus();
128
+ };
119
129
  return jsx(Modal, _objectSpread(_objectSpread({
120
130
  title: modalTitle,
121
131
  visible: modalVisible,
122
132
  onCancel: cancel,
123
133
  confirmLoading: loading,
124
134
  afterClose: function afterClose() {
125
- if (autoClear) {
126
- currentForm.clear();
127
- }
135
+ selfAfterClose();
128
136
  _afterClose === null || _afterClose === void 0 || _afterClose();
129
137
  }
130
138
  }, 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,
@@ -47,15 +47,18 @@ var Index = function Index(_ref) {
47
47
  dialogForm: currentForm,
48
48
  params: params,
49
49
  title: title,
50
- onCancel: onCancel
50
+ onCancel: onCancel,
51
+ autoClear: autoClear
51
52
  }),
52
53
  modalVisible = _useModifyProps.modalVisible,
53
54
  modalFormData = _useModifyProps.modalFormData,
54
55
  setModalVisible = _useModifyProps.setModalVisible,
55
56
  initValue = _useModifyProps.initValue,
56
57
  formParams = _useModifyProps.formParams,
57
- modalTitle = _useModifyProps.title;
58
+ modalTitle = _useModifyProps.title,
59
+ saveOldParams = _useModifyProps.saveOldParams;
58
60
  var cancel = function cancel() {
61
+ saveOldParams();
59
62
  if (onCancel) {
60
63
  return onCancel === null || onCancel === void 0 ? void 0 : onCancel();
61
64
  }
@@ -119,15 +122,20 @@ var Index = function Index(_ref) {
119
122
  params: formParams,
120
123
  onOk: footerOnOk
121
124
  });
125
+ var selfAfterClose = function selfAfterClose() {
126
+ if (autoClear) {
127
+ dialogForm === null || dialogForm === void 0 || dialogForm.clear();
128
+ return;
129
+ }
130
+ dialogForm === null || dialogForm === void 0 || dialogForm.resetFormStatus();
131
+ };
122
132
  return jsxRuntime.jsx(antd.Modal, _objectSpread(_objectSpread({
123
133
  title: modalTitle,
124
134
  visible: modalVisible,
125
135
  onCancel: cancel,
126
136
  confirmLoading: loading,
127
137
  afterClose: function afterClose() {
128
- if (autoClear) {
129
- currentForm.clear();
130
- }
138
+ selfAfterClose();
131
139
  _afterClose === null || _afterClose === void 0 || _afterClose();
132
140
  }
133
141
  }, 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.85",
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,
@@ -51,8 +52,10 @@ const Index: React.FC<DialogFormProps> = ({
51
52
  params,
52
53
  title,
53
54
  onCancel,
55
+ autoClear
54
56
  });
55
57
  const cancel = () => {
58
+ saveOldParams();
56
59
  if (onCancel) {
57
60
  return onCancel?.();
58
61
  }
@@ -93,6 +96,13 @@ const Index: React.FC<DialogFormProps> = ({
93
96
  params: formParams,
94
97
  onOk:footerOnOk
95
98
  });
99
+ const selfAfterClose=()=>{
100
+ if (autoClear){
101
+ dialogForm?.clear();
102
+ return;
103
+ }
104
+ dialogForm?.resetFormStatus();
105
+ }
96
106
  return (
97
107
  <Modal
98
108
  title={modalTitle}
@@ -100,9 +110,7 @@ const Index: React.FC<DialogFormProps> = ({
100
110
  onCancel={cancel}
101
111
  confirmLoading={loading}
102
112
  afterClose={() => {
103
- if (autoClear) {
104
- currentForm.clear();
105
- }
113
+ selfAfterClose();
106
114
  afterClose?.();
107
115
  }}
108
116
  {...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
  };