@hw-component/form 0.0.2-beta-v2 → 0.0.2-beta-v4

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.
@@ -27,6 +27,7 @@ var useHForm = (function () {
27
27
  var formatSourceData = {};
28
28
  var dispatchSourceData = {};
29
29
  var cacheValues = {};
30
+ var isLoading = false;
30
31
  var norAddItemDispatch = function norAddItemDispatch(name, fn) {
31
32
  if (!name) {
32
33
  return {
@@ -45,6 +46,7 @@ var useHForm = (function () {
45
46
  var newValue = this.formatValues(cacheValues);
46
47
  form.setFieldsValue(newValue);
47
48
  }
49
+ isLoading = true;
48
50
  },
49
51
  addFormat: function addFormat(name, format) {
50
52
  if (!format) {
@@ -147,8 +149,11 @@ var useHForm = (function () {
147
149
  }
148
150
  }, form), {}, {
149
151
  setFieldsValue: function setFieldsValue(values) {
152
+ if (!isLoading) {
153
+ cacheValues = values;
154
+ return;
155
+ }
150
156
  var newValue = this.formatValues(values);
151
- cacheValues = values;
152
157
  form.setFieldsValue(newValue);
153
158
  },
154
159
  validateFields: function validateFields(nameList) {
@@ -72,7 +72,10 @@ var Index = function Index(_ref) {
72
72
  })), /*#__PURE__*/React.createElement(Button, _extends({}, oProps, {
73
73
  type: type,
74
74
  onClick: click,
75
- loading: loading
75
+ loading: loading,
76
+ style: {
77
+ marginLeft: 4
78
+ }
76
79
  }), children));
77
80
  };
78
81
 
@@ -30,6 +30,7 @@ var useHForm = (function () {
30
30
  var formatSourceData = {};
31
31
  var dispatchSourceData = {};
32
32
  var cacheValues = {};
33
+ var isLoading = false;
33
34
  var norAddItemDispatch = function norAddItemDispatch(name, fn) {
34
35
  if (!name) {
35
36
  return {
@@ -48,6 +49,7 @@ var useHForm = (function () {
48
49
  var newValue = this.formatValues(cacheValues);
49
50
  form.setFieldsValue(newValue);
50
51
  }
52
+ isLoading = true;
51
53
  },
52
54
  addFormat: function addFormat(name, format) {
53
55
  if (!format) {
@@ -150,8 +152,11 @@ var useHForm = (function () {
150
152
  }
151
153
  }, form), {}, {
152
154
  setFieldsValue: function setFieldsValue(values) {
155
+ if (!isLoading) {
156
+ cacheValues = values;
157
+ return;
158
+ }
153
159
  var newValue = this.formatValues(values);
154
- cacheValues = values;
155
160
  form.setFieldsValue(newValue);
156
161
  },
157
162
  validateFields: function validateFields(nameList) {
@@ -75,7 +75,10 @@ var Index = function Index(_ref) {
75
75
  })), /*#__PURE__*/React.createElement(antd.Button, _extends({}, oProps, {
76
76
  type: type,
77
77
  onClick: click,
78
- loading: loading
78
+ loading: loading,
79
+ style: {
80
+ marginLeft: 4
81
+ }
79
82
  }), children));
80
83
  };
81
84
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "0.0.2-beta-v2",
3
+ "version": "0.0.2-beta-v4",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,6 +14,7 @@ export default () => {
14
14
  const formatSourceData: Record<string, FormatItemModal> = {};
15
15
  let dispatchSourceData: Record<string, DispatchItemData> = {};
16
16
  let cacheValues: Record<string, any> = {};
17
+ let isLoading=false;
17
18
  const norAddItemDispatch = (name, fn) => {
18
19
  if (!name) {
19
20
  return {
@@ -34,6 +35,7 @@ export default () => {
34
35
  const newValue = this.formatValues(cacheValues);
35
36
  form.setFieldsValue(newValue);
36
37
  }
38
+ isLoading=true;
37
39
  },
38
40
  addFormat(name: string, format?: FormatItemModal) {
39
41
  if (!format) {
@@ -125,8 +127,11 @@ export default () => {
125
127
  },
126
128
  ...form,
127
129
  setFieldsValue(values) {
130
+ if (!isLoading){
131
+ cacheValues = values;
132
+ return;
133
+ }
128
134
  const newValue = this.formatValues(values);
129
- cacheValues = values;
130
135
  form.setFieldsValue(newValue);
131
136
  },
132
137
  validateFields(nameList) {
@@ -32,7 +32,7 @@ const Index: React.FC<HButtonInputProps> = ({
32
32
  return (
33
33
  <Input.Group compact style={{ display: "flex" }}>
34
34
  <Input {...props} style={{ flex: 1 }} value={value} onChange={change} />
35
- <Button {...oProps} type={type} onClick={click} loading={loading}>
35
+ <Button {...oProps} type={type} onClick={click} loading={loading} style={{marginLeft:4}}>
36
36
  {children}
37
37
  </Button>
38
38
  </Input.Group>
@@ -1,5 +1,5 @@
1
1
  import { Button } from "antd";
2
- import { HDrawerForm, useHDiaLogForm } from "../../components";
2
+ import { HDrawerForm, useHDialogForm } from "../../components";
3
3
  const data = [
4
4
  {
5
5
  label: "输入框",
@@ -98,7 +98,7 @@ const data = [
98
98
  },
99
99
  ];
100
100
  export default () => {
101
- const modalForm = useHDiaLogForm();
101
+ const modalForm = useHDialogForm();
102
102
  return (
103
103
  <>
104
104
  <Button
@@ -128,9 +128,7 @@ export default () => {
128
128
  testEnd: "1693538359",
129
129
  op: 1,
130
130
  opInput: "12121",
131
- upload: [
132
- "https://img2.baidu.com/it/u=2048195462,703560066&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=333",
133
- ],
131
+ upload: "https://img2.baidu.com/it/u=2048195462,703560066&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=333",
134
132
  });
135
133
  }, 3000);
136
134
  });
@@ -1,5 +1,5 @@
1
1
  import { Button } from "antd";
2
- import { HModalForm, useHDiaLogForm } from "../../components";
2
+ import { HModalForm, useHDialogForm } from "../../components";
3
3
  const data = [
4
4
  {
5
5
  label: "输入框",
@@ -98,7 +98,7 @@ const data = [
98
98
  },
99
99
  ];
100
100
  export default () => {
101
- const modalForm = useHDiaLogForm();
101
+ const modalForm = useHDialogForm();
102
102
  return (
103
103
  <>
104
104
  <Button