@hw-component/form 1.2.8 → 1.3.0

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.
@@ -29,7 +29,6 @@ var useProps = function useProps(_ref) {
29
29
  }
30
30
  });
31
31
  var defaultExFiles = exFiles === undefined ? resultProps.exFiles : exFiles;
32
- console.log(defaultExFiles);
33
32
  return _objectSpread(_objectSpread({}, resultProps), {}, {
34
33
  exFiles: defaultExFiles
35
34
  });
@@ -86,6 +86,7 @@ var Index = function Index(_ref, ref) {
86
86
  addFormat === null || addFormat === void 0 || addFormat({
87
87
  float: {
88
88
  inputValue: function inputValue(item, initValue) {
89
+ console.log("fff");
89
90
  var _item$name = item.name,
90
91
  name = _item$name === void 0 ? "" : _item$name;
91
92
  var initFileList = initValue[name] || [];
@@ -98,7 +99,7 @@ var Index = function Index(_ref, ref) {
98
99
  },
99
100
  status: "done",
100
101
  uid: "init-".concat(index),
101
- thumbUrl: url
102
+ thumbUrl: thumbUrl || url
102
103
  };
103
104
  });
104
105
  return _defineProperty({}, name, fileList);
@@ -115,12 +116,13 @@ var Index = function Index(_ref, ref) {
115
116
  }
116
117
  }
117
118
  });
119
+ var relVal = Array.isArray(value) ? value : [];
118
120
  return jsxs("div", {
119
121
  style: contentStyle,
120
122
  children: [jsx(Upload, _objectSpread(_objectSpread({
121
123
  listType: listType,
122
124
  maxCount: maxNum,
123
- fileList: value,
125
+ fileList: relVal,
124
126
  onPreview: preview,
125
127
  onChange: change,
126
128
  beforeUpload: function beforeUpload() {
@@ -128,7 +130,7 @@ var Index = function Index(_ref, ref) {
128
130
  }
129
131
  }, props), {}, {
130
132
  children: jsx(Btn, {
131
- value: value,
133
+ value: relVal,
132
134
  maxCount: maxCount,
133
135
  listType: listType
134
136
  })
@@ -30,7 +30,6 @@ var useProps = function useProps(_ref) {
30
30
  }
31
31
  });
32
32
  var defaultExFiles = exFiles === undefined ? resultProps.exFiles : exFiles;
33
- console.log(defaultExFiles);
34
33
  return _objectSpread(_objectSpread({}, resultProps), {}, {
35
34
  exFiles: defaultExFiles
36
35
  });
@@ -89,6 +89,7 @@ var Index = function Index(_ref, ref) {
89
89
  addFormat === null || addFormat === void 0 || addFormat({
90
90
  float: {
91
91
  inputValue: function inputValue(item, initValue) {
92
+ console.log("fff");
92
93
  var _item$name = item.name,
93
94
  name = _item$name === void 0 ? "" : _item$name;
94
95
  var initFileList = initValue[name] || [];
@@ -101,7 +102,7 @@ var Index = function Index(_ref, ref) {
101
102
  },
102
103
  status: "done",
103
104
  uid: "init-".concat(index),
104
- thumbUrl: url
105
+ thumbUrl: thumbUrl || url
105
106
  };
106
107
  });
107
108
  return _defineProperty({}, name, fileList);
@@ -118,12 +119,13 @@ var Index = function Index(_ref, ref) {
118
119
  }
119
120
  }
120
121
  });
122
+ var relVal = Array.isArray(value) ? value : [];
121
123
  return jsxRuntime.jsxs("div", {
122
124
  style: contentStyle,
123
125
  children: [jsxRuntime.jsx(antd.Upload, _objectSpread(_objectSpread({
124
126
  listType: listType,
125
127
  maxCount: maxNum,
126
- fileList: value,
128
+ fileList: relVal,
127
129
  onPreview: preview,
128
130
  onChange: change$1,
129
131
  beforeUpload: function beforeUpload() {
@@ -131,7 +133,7 @@ var Index = function Index(_ref, ref) {
131
133
  }
132
134
  }, props), {}, {
133
135
  children: jsxRuntime.jsx(Btn.default, {
134
- value: value,
136
+ value: relVal,
135
137
  maxCount: maxCount,
136
138
  listType: listType
137
139
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.2.8",
3
+ "version": "1.3.0",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,6 @@ export const useProps = ({ request, exFiles, maxSize }: IUpLoadProps) => {
16
16
  }
17
17
  });
18
18
  const defaultExFiles=exFiles===undefined?resultProps.exFiles:exFiles;
19
- console.log(defaultExFiles)
20
19
  return {
21
20
  ...resultProps,
22
21
  exFiles:defaultExFiles
@@ -61,6 +61,7 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
61
61
  addFormat?.({
62
62
  float: {
63
63
  inputValue: (item, initValue) => {
64
+ console.log("fff")
64
65
  const { name = "" } = item;
65
66
  const initFileList = initValue[name] || [];
66
67
  const relInitFileList =
@@ -73,7 +74,7 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
73
74
  },
74
75
  status: "done",
75
76
  uid: `init-${index}`,
76
- thumbUrl: url,
77
+ thumbUrl: thumbUrl||url,
77
78
  };
78
79
  });
79
80
  return {
@@ -92,12 +93,13 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
92
93
  },
93
94
  },
94
95
  });
96
+ const relVal=Array.isArray(value)?value:[];
95
97
  return (
96
98
  <div style={contentStyle}>
97
99
  <Upload
98
100
  listType={listType}
99
101
  maxCount={maxNum}
100
- fileList={value}
102
+ fileList={relVal}
101
103
  onPreview={preview}
102
104
  onChange={change}
103
105
  beforeUpload={() => {
@@ -105,7 +107,7 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
105
107
  }}
106
108
  {...props}
107
109
  >
108
- <Btn value={value} maxCount={maxCount} listType={listType} />
110
+ <Btn value={relVal} maxCount={maxCount} listType={listType} />
109
111
  </Upload>
110
112
  <Preview
111
113
  visible={visible}
@@ -57,6 +57,13 @@ const formData = (options) => {
57
57
  direction: "vertical",
58
58
  labelAlign: "topLeft",
59
59
  },
60
+ {
61
+ label: "file",
62
+ name: "file",
63
+ type: "upload",
64
+ direction: "vertical",
65
+ labelAlign: "topLeft",
66
+ },
60
67
  {
61
68
  label: "开关",
62
69
  name: "switch",
@@ -161,6 +168,9 @@ export default () => {
161
168
  onValuesChange={(val) => {
162
169
  console.log(val, "onValuesChange");
163
170
  }}
171
+ initialValues={{
172
+ file:"fff"
173
+ }}
164
174
  request={(params) => {
165
175
  return new Promise<any>((resolve) => {
166
176
  setTimeout(() => {