@ecoding/components.antd 0.5.14 → 0.5.15

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.
@@ -12,6 +12,7 @@ import { Upload, message, Button, Popover, Typography, Space, Empty } from 'antd
12
12
  import { UploadOutlined, LinkOutlined, DeleteOutlined, EllipsisOutlined } from '@ant-design/icons';
13
13
  import { buildURL } from '@ecoding/helper.url';
14
14
  import Toast from "../../core/toast";
15
+ import Loading from "../../core/loading";
15
16
  const InfosRender = ({ infos, updateItems, domain, nameKey }) => {
16
17
  const remove = (i) => {
17
18
  const temp = infos.concat([]);
@@ -47,6 +48,7 @@ const InfosRender = ({ infos, updateItems, domain, nameKey }) => {
47
48
  const MultipleUpload = (props) => {
48
49
  const { value, domain, onChange, valueKey, objectInValue, nameKey } = props;
49
50
  const isInnerChange = useRef(false);
51
+ const isInnerDone = useRef([]);
50
52
  const [infos, setInfos] = useState(() => {
51
53
  return [];
52
54
  });
@@ -88,15 +90,19 @@ const MultipleUpload = (props) => {
88
90
  const urls = temp.map((item) => domain ? item.url.replace(domain, '') : item.url);
89
91
  onChange && onChange(!isEmpty ? urls : undefined);
90
92
  }
91
- if (open) {
92
- setOpen(true);
93
- clearTimeout(timeout.current);
94
- timeout.current = setTimeout(() => {
95
- setOpen(undefined);
96
- }, 3000);
93
+ if (isInnerDone.current.length == newItems.length) {
94
+ if (open) {
95
+ setOpen(true);
96
+ clearTimeout(timeout.current);
97
+ timeout.current = setTimeout(() => {
98
+ setOpen(undefined);
99
+ }, 3000);
100
+ }
101
+ Loading.hide();
97
102
  }
98
103
  };
99
104
  const handleChange = ({ fileList }) => {
105
+ Loading.show();
100
106
  fileList && fileList.forEach((file) => {
101
107
  if (file.status == "done") {
102
108
  const response = file.response || {};
@@ -107,6 +113,7 @@ const MultipleUpload = (props) => {
107
113
  const data = response.data || response.model;
108
114
  file.url = data && data[valueKey || "url"];
109
115
  file.responseData = data;
116
+ isInnerDone.current.push(true);
110
117
  delete file.response;
111
118
  delete file.xhr;
112
119
  delete file.lastModifiedDate;
@@ -114,6 +121,7 @@ const MultipleUpload = (props) => {
114
121
  }
115
122
  }
116
123
  else if (file.status === "error") {
124
+ Loading.hide();
117
125
  Toast.error({
118
126
  mask: true,
119
127
  title: file.response ? file.response.msg || file.response.message : `${props.i18n ? props.i18n.$t('global.upload.error.img') : '服务出错,文件上传失败'}`
@@ -147,6 +155,7 @@ const MultipleUpload = (props) => {
147
155
  if (value && value.length > 0) {
148
156
  const temp = [];
149
157
  value.forEach((item, index) => {
158
+ isInnerDone.current.push(true);
150
159
  if (typeof item === "string" && item) {
151
160
  // 防止重复拼接domain
152
161
  item = domain ? item.replace(domain, "") : item;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  interface IProps {
3
3
  items: React.ReactElement[];
4
+ itemValues?: any;
4
5
  overMax?: number;
5
6
  colOpts?: any;
6
7
  onFinish?: (v: any) => Promise<void>;
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import React, { useRef, useEffect, useState, useMemo, memo } from 'react';
11
11
  import { Button, Form, Row, Col, Space } from 'antd';
12
12
  import { DownOutlined, UpOutlined } from '@ant-design/icons';
13
- const FiltersHorizontal = ({ items, onFinish, onClear, y, setY, overMax, colOpts, searchText, resetText, i18n }) => {
13
+ const FiltersHorizontal = ({ items, itemValues, onFinish, onClear, y, setY, overMax, colOpts, searchText, resetText, i18n }) => {
14
14
  const [form] = Form.useForm(); // 该组件内form全局变量
15
15
  const ref = useRef(null);
16
16
  const refInitY = useRef(undefined);
@@ -71,6 +71,10 @@ const FiltersHorizontal = ({ items, onFinish, onClear, y, setY, overMax, colOpts
71
71
  setShowMore(true);
72
72
  setWrapH(110);
73
73
  }
74
+ if (itemValues) {
75
+ console.log(itemValues);
76
+ form.setFieldsValue(itemValues);
77
+ }
74
78
  }
75
79
  }, []);
76
80
  useEffect(() => {
@@ -17,6 +17,7 @@ interface IProps {
17
17
  overMax?: number;
18
18
  colOpts?: ColProps;
19
19
  items: React.ReactElement[];
20
+ itemValues?: any;
20
21
  onFinish?: (v: any) => Promise<void>;
21
22
  onClear?: () => Promise<void>;
22
23
  searchText?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.5.14",
3
+ "version": "0.5.15",
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": "63dbd74fd806139370f6f812cc712756866283ff"
50
+ "gitHead": "aea1fd9c6bd9e8cb76f68b09e7779d5825ae56b4"
51
51
  }