@ecoding/components.antd 0.5.15 → 0.5.17

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.
@@ -152,9 +152,13 @@ const MultipleUpload = (props) => {
152
152
  isInnerChange.current = false;
153
153
  return;
154
154
  }
155
+ if (!value) {
156
+ setInfos([]);
157
+ }
155
158
  if (value && value.length > 0) {
156
159
  const temp = [];
157
- value.forEach((item, index) => {
160
+ const tempValue = JSON.parse(JSON.stringify(value));
161
+ tempValue.forEach((item, index) => {
158
162
  isInnerDone.current.push(true);
159
163
  if (typeof item === "string" && item) {
160
164
  // 防止重复拼接domain
@@ -222,9 +222,13 @@ const MultipleImgUpload = (props) => {
222
222
  isInnerChange.current = false;
223
223
  return;
224
224
  }
225
+ if (!value) {
226
+ setImgList([]);
227
+ }
225
228
  if (value && value.length > 0) {
226
229
  const temp = [];
227
- value.forEach((item, index) => {
230
+ const tempValue = JSON.parse(JSON.stringify(value));
231
+ tempValue.forEach((item, index) => {
228
232
  if (typeof item === "string" && item) {
229
233
  // 防止重复拼接domain
230
234
  item = domain ? item.replace(domain, "") : item;
@@ -13,7 +13,7 @@ import { UploadOutlined } from "@ant-design/icons";
13
13
  import { buildURL } from "@ecoding/helper.url";
14
14
  import Toast from "../../core/toast";
15
15
  const SingleFileUpload = (props) => {
16
- const [fileUrl, setFileUrl] = useState('');
16
+ const [fileUrl, setFileUrl] = useState(undefined);
17
17
  const [loading, setLoading] = useState(false);
18
18
  const action = useMemo(() => {
19
19
  if (typeof props.action === "string") {
@@ -93,15 +93,19 @@ const SingleFileUpload = (props) => {
93
93
  }, []);
94
94
  useEffect(() => {
95
95
  let item = props.value;
96
+ if (!item) {
97
+ setFileUrl(undefined);
98
+ }
96
99
  if (typeof item === "string" && (item || item == '') && fileUrl != item) {
97
100
  // 防止重复拼接domain
98
101
  item = props.domain ? item.replace(props.domain, "") : item;
99
102
  setFileUrl(item);
100
103
  }
101
- if (((item === null || item === void 0 ? void 0 : item.url) || (item === null || item === void 0 ? void 0 : item.url) == '') && fileUrl != item.url) {
104
+ const temp = Object.assign({}, item);
105
+ if (((temp === null || temp === void 0 ? void 0 : temp.url) || (temp === null || temp === void 0 ? void 0 : temp.url) == '') && fileUrl != temp.url) {
102
106
  // 防止重复拼接domain
103
- item.url = props.domain ? item.url.replace(props.domain, "") : item.url;
104
- setFileUrl(item.url);
107
+ temp.url = props.domain ? temp.url.replace(props.domain, "") : temp.url;
108
+ setFileUrl(temp.url);
105
109
  }
106
110
  }, [props.value]);
107
111
  return (React.createElement(Space.Compact, { block: true },
@@ -166,15 +166,19 @@ const ImgUpload = (props) => {
166
166
  React.createElement("div", { style: { marginTop: 8 } }, props.buttonText))), [loading]);
167
167
  useEffect(() => {
168
168
  let item = props.value;
169
+ if (!item) {
170
+ setImageUrl(undefined);
171
+ }
169
172
  if (typeof item === "string" && item) {
170
173
  // 防止重复拼接domain
171
174
  item = props.domain ? item.replace(props.domain, "") : item;
172
175
  setImageUrl(item);
173
176
  }
174
- if (item === null || item === void 0 ? void 0 : item.url) {
177
+ const temp = Object.assign({}, item);
178
+ if (temp === null || temp === void 0 ? void 0 : temp.url) {
175
179
  // 防止重复拼接domain
176
- item.url = props.domain ? item.url.replace(props.domain, "") : item.url;
177
- setImageUrl(item.url);
180
+ temp.url = props.domain ? temp.url.replace(props.domain, "") : temp.url;
181
+ setImageUrl(temp.url);
178
182
  }
179
183
  }, [props.value]);
180
184
  return (React.createElement(Flex, { style: { fontSize: 0 } },
@@ -72,7 +72,6 @@ const FiltersHorizontal = ({ items, itemValues, onFinish, onClear, y, setY, over
72
72
  setWrapH(110);
73
73
  }
74
74
  if (itemValues) {
75
- console.log(itemValues);
76
75
  form.setFieldsValue(itemValues);
77
76
  }
78
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.5.15",
3
+ "version": "0.5.17",
4
4
  "author": "cxc",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -47,5 +47,5 @@
47
47
  "antd": "^6.0.0",
48
48
  "axios": "^1.1.2"
49
49
  },
50
- "gitHead": "aea1fd9c6bd9e8cb76f68b09e7779d5825ae56b4"
50
+ "gitHead": "5a1de779ccf48290bf89c9dd0c4c350e5b100571"
51
51
  }