@hw-component/form 1.10.35 → 1.10.36

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.
@@ -193,7 +193,9 @@ var useHForm = (function () {
193
193
  resetFieldsInitValue: function resetFieldsInitValue() {
194
194
  var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
195
195
  var oldValue = form.getFieldsValue(true);
196
- var keys = Object.keys(oldValue);
196
+ var outputOldValue = formatValuesFn(oldValue, "outputValue");
197
+ var changeVal = _objectSpread(_objectSpread({}, oldValue), outputOldValue);
198
+ var keys = Object.keys(changeVal);
197
199
  var newVale = {};
198
200
  keys.forEach(function (key) {
199
201
  newVale[key] = undefined;
@@ -20,17 +20,16 @@ var useSubRequest = function useSubRequest(_ref) {
20
20
  while (1) switch (_context.prev = _context.next) {
21
21
  case 0:
22
22
  subVal = form === null || form === void 0 ? void 0 : form.outputValues(value, preserve);
23
- console.log(subVal, "sss");
24
23
  params = getSaveParams();
25
24
  if (!request) {
26
- _context.next = 6;
25
+ _context.next = 5;
27
26
  break;
28
27
  }
29
- _context.next = 6;
28
+ _context.next = 5;
30
29
  return request(subVal, params);
31
- case 6:
30
+ case 5:
32
31
  onFinish === null || onFinish === void 0 || onFinish(subVal, params);
33
- case 7:
32
+ case 6:
34
33
  case "end":
35
34
  return _context.stop();
36
35
  }
package/es/Form/index.js CHANGED
@@ -72,7 +72,6 @@ var HForm = (function (_ref) {
72
72
  return _objectSpread(_objectSpread({}, oldData), newData);
73
73
  });
74
74
  };
75
- console.log(hForm.inited);
76
75
  return jsx(Index, {
77
76
  loading: infoLoading,
78
77
  error: infoErr,
@@ -72,6 +72,7 @@ var useOptionsRequest = function useOptionsRequest(_ref) {
72
72
  }
73
73
  return params;
74
74
  };
75
+ console.log(dispatchManual, "dispatchManual");
75
76
  var _useRequest = useRequest(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
76
77
  var requestParams,
77
78
  type,
@@ -196,7 +196,9 @@ var useHForm = (function () {
196
196
  resetFieldsInitValue: function resetFieldsInitValue() {
197
197
  var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
198
198
  var oldValue = form.getFieldsValue(true);
199
- var keys = Object.keys(oldValue);
199
+ var outputOldValue = formatValuesFn(oldValue, "outputValue");
200
+ var changeVal = _objectSpread(_objectSpread({}, oldValue), outputOldValue);
201
+ var keys = Object.keys(changeVal);
200
202
  var newVale = {};
201
203
  keys.forEach(function (key) {
202
204
  newVale[key] = undefined;
@@ -21,17 +21,16 @@ var useSubRequest = function useSubRequest(_ref) {
21
21
  while (1) switch (_context.prev = _context.next) {
22
22
  case 0:
23
23
  subVal = form === null || form === void 0 ? void 0 : form.outputValues(value, preserve);
24
- console.log(subVal, "sss");
25
24
  params = getSaveParams();
26
25
  if (!request) {
27
- _context.next = 6;
26
+ _context.next = 5;
28
27
  break;
29
28
  }
30
- _context.next = 6;
29
+ _context.next = 5;
31
30
  return request(subVal, params);
32
- case 6:
31
+ case 5:
33
32
  onFinish === null || onFinish === void 0 || onFinish(subVal, params);
34
- case 7:
33
+ case 6:
35
34
  case "end":
36
35
  return _context.stop();
37
36
  }
package/lib/Form/index.js CHANGED
@@ -75,7 +75,6 @@ var HForm = (function (_ref) {
75
75
  return _objectSpread(_objectSpread({}, oldData), newData);
76
76
  });
77
77
  };
78
- console.log(hForm.inited);
79
78
  return jsxRuntime.jsx(index$1.default, {
80
79
  loading: infoLoading,
81
80
  error: infoErr,
@@ -73,6 +73,7 @@ var useOptionsRequest = function useOptionsRequest(_ref) {
73
73
  }
74
74
  return params;
75
75
  };
76
+ console.log(dispatchManual, "dispatchManual");
76
77
  var _useRequest = ahooks.useRequest(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
77
78
  var requestParams,
78
79
  type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.10.35",
3
+ "version": "1.10.36",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -178,7 +178,9 @@ export default () => {
178
178
  },
179
179
  resetFieldsInitValue: (values = {}) => {
180
180
  const oldValue = form.getFieldsValue(true);
181
- const keys = Object.keys(oldValue);
181
+ const outputOldValue=formatValuesFn(oldValue,"outputValue");
182
+ const changeVal={...oldValue,...outputOldValue};
183
+ const keys = Object.keys(changeVal);
182
184
  const newVale = {};
183
185
  keys.forEach((key) => {
184
186
  newVale[key] = undefined;
@@ -19,7 +19,6 @@ const useSubRequest = ({
19
19
  return useRequest(
20
20
  async (value) => {
21
21
  const subVal = form?.outputValues(value, preserve);
22
- console.log(subVal, "sss");
23
22
  const params = getSaveParams();
24
23
  if (request) {
25
24
  await request(subVal, params);
@@ -62,7 +62,6 @@ export default ({
62
62
  };
63
63
  });
64
64
  };
65
- console.log(hForm.inited)
66
65
  return (
67
66
  <PageHandler
68
67
  loading={infoLoading}
@@ -62,6 +62,7 @@ const useOptionsRequest = ({
62
62
  }
63
63
  return params;
64
64
  };
65
+ console.log(dispatchManual,"dispatchManual")
65
66
  const {
66
67
  run: listRun,
67
68
  loading,
@@ -55,6 +55,7 @@ const HRangePicker: React.FC<HRangePickerProps> = ({
55
55
  inputValue: (item, initValue) => {
56
56
  const { name: valueName = "" } = item;
57
57
  const resultObj = {};
58
+
58
59
  Object.values(dateMapKeys).forEach((key) => {
59
60
  if (initValue[key]) {
60
61
  resultObj[key] = initValue[key];
@@ -62,7 +63,7 @@ const HRangePicker: React.FC<HRangePickerProps> = ({
62
63
  });
63
64
  const hasKeys = Object.keys(resultObj).length !== 0;
64
65
  return {
65
- [valueName as string]: hasKeys ? resultObj : null,
66
+ [valueName as string]: hasKeys ? resultObj :null,
66
67
  };
67
68
  },
68
69
  outputValue: (item, outputValue) => {
@@ -1,9 +1,9 @@
1
1
  import {
2
- HForm,
3
- HFormConfigProvider,
4
- useHForm,
5
- HSelect,
6
- HBasicForm,
2
+ HForm,
3
+ HFormConfigProvider,
4
+ useHForm,
5
+ HSelect,
6
+ HBasicForm, HRangePicker,
7
7
  } from "../../components";
8
8
  import {useEffect, useState} from "react";
9
9
  import { Button, Form, Input, Space } from "antd";
@@ -33,39 +33,52 @@ const Test3 = ({ value = {}, onChange }) => {
33
33
  </Space>
34
34
  );
35
35
  };
36
- const TestItem = () => {
37
- return (
38
- <Form.Item name="name1">
39
- <Test3 />
40
- </Form.Item>
41
- );
42
- };
43
36
  const Test = (props) => {
44
- useEffect(()=>{
45
- console.log("ffff")
46
- },[]);
47
37
  return <div>ffff</div>;
48
38
  };
49
39
  const Basic = () => {
50
40
  return (
51
41
  <HBasicForm
52
42
  configData={[
53
- {
54
- label: "你好",
55
- type: "inputNumberGroup",
56
- name: "jgTime",
57
- },
58
43
  {
59
44
  label:"test",
60
45
  name:"test",
61
46
  render:()=>{
62
47
  return <Test/>
63
48
  }
64
- }
49
+ },{
50
+ name:'deviceType',
51
+ label:"deviceType"
52
+ },
53
+ {
54
+ label:"select",
55
+ name:"select",
56
+ type:"select",
57
+ dispatch: {
58
+ fnKey: 'reload',
59
+ dependencies: ['deviceType'],
60
+ },
61
+ itemProps:{
62
+ request:()=>{
63
+ console.log("request")
64
+ return Promise.resolve([])
65
+ }
66
+ }
67
+ },
65
68
  ]}
66
69
  />
67
70
  );
68
71
  };
72
+
73
+ const TestItem = ({value,...props}) => {
74
+ return (
75
+ <div>
76
+ 1
77
+ <HRangePicker value={value} {...props}/>
78
+ </div>
79
+ );
80
+ };
81
+
69
82
  export default () => {
70
83
  const form = useHForm();
71
84
  const [id, setId] = useState(1);
@@ -99,28 +112,28 @@ export default () => {
99
112
  <div style={{ width: 1000 }}>
100
113
  <HForm
101
114
  configData={[
102
- {
103
- noStyle: true,
104
- nameKey: "sendSetting",
105
- render: () => {
106
- return <Basic />;
107
- },
108
- },
115
+ // {
116
+ // noStyle: true,
117
+ // nameKey: "sendSetting",
118
+ // render: () => {
119
+ // return <Basic />;
120
+ // },
121
+ // },
109
122
  {
110
- type:"richEditor",
111
- name:"richEditor",
112
- itemProps:{
113
- valueType:"state"
123
+ name:'time',
124
+ label:"time",
125
+ render:()=>{
126
+ return <TestItem/>
114
127
  }
115
- },
128
+ }
116
129
  ]}
117
130
  dismissOnPressEnter={false}
118
131
  labelWidth={88}
119
132
  form={form}
120
133
  initialValues={{
121
134
  richEditor: "1312312",
122
- startTime: "07:00:00",
123
- endTime: "14:00:00",
135
+ select:"1",
136
+ deviceType:"1"
124
137
  }}
125
138
  labelAlign={"left"}
126
139
  onValuesChange={(val) => {
@@ -164,7 +177,7 @@ export default () => {
164
177
  </div>
165
178
  <div
166
179
  onClick={() => {
167
- form.resetFields();
180
+ form.resetFieldsInitValue();
168
181
  }}
169
182
  >
170
183
  重置