@hw-component/form 1.10.35 → 1.10.37

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.
@@ -49,7 +49,9 @@ var useHForm = (function () {
49
49
  return;
50
50
  }
51
51
  var resultValue = format(value);
52
- Reflect.deleteProperty(newValue, key);
52
+ if (formatKey !== "inputValue") {
53
+ Reflect.deleteProperty(newValue, key);
54
+ }
53
55
  newValue = _objectSpread(_objectSpread({}, newValue), resultValue);
54
56
  });
55
57
  return newValue;
@@ -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,
@@ -52,7 +52,9 @@ var useHForm = (function () {
52
52
  return;
53
53
  }
54
54
  var resultValue = format(value);
55
- Reflect.deleteProperty(newValue, key);
55
+ if (formatKey !== "inputValue") {
56
+ Reflect.deleteProperty(newValue, key);
57
+ }
56
58
  newValue = _objectSpread(_objectSpread({}, newValue), resultValue);
57
59
  });
58
60
  return newValue;
@@ -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.37",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,7 +47,9 @@ export default () => {
47
47
  return;
48
48
  }
49
49
  const resultValue = format(value);
50
- Reflect.deleteProperty(newValue, key);
50
+ if (formatKey!=="inputValue"){
51
+ Reflect.deleteProperty(newValue, key);
52
+ }
51
53
  newValue = {
52
54
  ...newValue,
53
55
  ...resultValue,
@@ -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,41 +112,39 @@ 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",
123
+ name:'time',
124
+ label:"time",
125
+ type:'rangePicker',
112
126
  itemProps:{
113
- valueType:"state"
127
+ valueMap:{
128
+ start:"timeStart",
129
+ end:"timeEnd"
130
+ }
114
131
  }
115
- },
132
+ }
116
133
  ]}
117
134
  dismissOnPressEnter={false}
118
135
  labelWidth={88}
119
136
  form={form}
120
137
  initialValues={{
121
- richEditor: "1312312",
122
- startTime: "07:00:00",
123
- endTime: "14:00:00",
138
+ timeStart:"1748491247",
139
+ timeEnd:"1748577647"
124
140
  }}
125
141
  labelAlign={"left"}
126
142
  onValuesChange={(val) => {
127
143
  console.log(val, "onValuesChange");
128
144
  }}
129
145
  requiredMode
130
- request={(params) => {
131
- console.log(params, "ppppp");
132
- return new Promise<any>((resolve) => {
133
- setTimeout(() => {
134
- resolve(params);
135
- }, 3000);
136
- });
146
+ onFinish={(val)=>{
147
+ console.log(val);
137
148
  }}
138
149
  />
139
150
  </div>
@@ -164,7 +175,7 @@ export default () => {
164
175
  </div>
165
176
  <div
166
177
  onClick={() => {
167
- form.resetFields();
178
+ form.resetFieldsInitValue();
168
179
  }}
169
180
  >
170
181
  重置