yootd 0.0.19 → 0.0.20
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.
package/dist/empty/index.d.ts
CHANGED
@@ -3,7 +3,7 @@ import { Empty as AntEmpty } from 'antd';
|
|
3
3
|
import { FC } from 'react';
|
4
4
|
import './index.scss';
|
5
5
|
export type EmptyProps = AntEmptyProps & {
|
6
|
-
type: 'noCollect' | 'noNews' | 'noNotice' | 'noSchedule' | 'noSearchData' | '
|
6
|
+
type: 'emptyContent' | 'emptyData' | 'networkError' | 'notFound' | 'imageError' | 'noCollect' | 'noNews' | 'noNotice' | 'noSchedule' | 'noSearchData' | 'submitFail' | 'submitSuccess';
|
7
7
|
};
|
8
8
|
export type { TransferLocale } from 'antd/es/empty';
|
9
9
|
type AntEmptyType = typeof AntEmpty;
|
package/dist/empty/index.js
CHANGED
@@ -7,6 +7,10 @@ import React, { useMemo } from 'react';
|
|
7
7
|
import { useBem } from "../hooks/useBem";
|
8
8
|
import "./index.scss";
|
9
9
|
import NotFoundPage from "./assets/404.png";
|
10
|
+
import EmptyContent from "./assets/empty-content.png";
|
11
|
+
import EmptyData from "./assets/empty-data.png";
|
12
|
+
import ImageError from "./assets/image-error.png";
|
13
|
+
import NetworkError from "./assets/net-error.png";
|
10
14
|
import NoCollect from "./assets/no-collect.png";
|
11
15
|
import NoNews from "./assets/no-news.png";
|
12
16
|
import NoNotice from "./assets/no-notice.png";
|
@@ -15,12 +19,16 @@ import NoSearchDate from "./assets/no-search-data.png";
|
|
15
19
|
import SubmitFail from "./assets/submit-fail.png";
|
16
20
|
import SubmitSuccess from "./assets/submit-success.png";
|
17
21
|
var imageMap = {
|
22
|
+
emptyContent: EmptyContent,
|
23
|
+
emptyData: EmptyData,
|
24
|
+
networkError: NetworkError,
|
25
|
+
notFound: NotFoundPage,
|
26
|
+
imageError: ImageError,
|
18
27
|
noCollect: NoCollect,
|
19
28
|
noNews: NoNews,
|
20
29
|
noNotice: NoNotice,
|
21
30
|
noSchedule: NoSchedule,
|
22
31
|
noSearchData: NoSearchDate,
|
23
|
-
notFound: NotFoundPage,
|
24
32
|
submitFail: SubmitFail,
|
25
33
|
submitSuccess: SubmitSuccess
|
26
34
|
};
|
@@ -7,6 +7,8 @@ declare const FileUpload: React.ForwardRefExoticComponent<import("antd").UploadP
|
|
7
7
|
accept?: string | undefined;
|
8
8
|
folder?: string | undefined;
|
9
9
|
value?: UploadFile<any>[] | undefined;
|
10
|
+
widthPixels?: number | undefined;
|
11
|
+
heightPixels?: number | undefined;
|
10
12
|
fileType?: "image" | "file" | undefined;
|
11
13
|
onChange?: ((value?: UploadFile<any>[] | undefined) => void) | undefined;
|
12
14
|
} & React.RefAttributes<UploadRef<any>>>;
|
@@ -7,6 +7,8 @@ declare const ImageUpload: React.ForwardRefExoticComponent<import("antd").Upload
|
|
7
7
|
accept?: string | undefined;
|
8
8
|
folder?: string | undefined;
|
9
9
|
value?: UploadFile<any>[] | undefined;
|
10
|
+
widthPixels?: number | undefined;
|
11
|
+
heightPixels?: number | undefined;
|
10
12
|
fileType?: "image" | "file" | undefined;
|
11
13
|
onChange?: ((value?: UploadFile<any>[] | undefined) => void) | undefined;
|
12
14
|
} & React.RefAttributes<UploadRef<any>>>;
|
@@ -20,7 +20,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
20
20
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
21
21
|
import { Upload as AntUpload } from 'antd';
|
22
22
|
import React, { useEffect, useMemo, useState } from 'react';
|
23
|
-
import { Image } from 'antd';
|
23
|
+
import { Image as AntdImage } from 'antd';
|
24
24
|
import { message } from "../..";
|
25
25
|
import { useRequest } from "../../hooks/useRequest";
|
26
26
|
import "../index.scss";
|
@@ -34,7 +34,9 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
34
34
|
accept = props.accept,
|
35
35
|
folder = props.folder,
|
36
36
|
value = props.value,
|
37
|
-
onChange = props.onChange
|
37
|
+
onChange = props.onChange,
|
38
|
+
widthPixels = props.widthPixels,
|
39
|
+
heightPixels = props.heightPixels;
|
38
40
|
var mb = useBem('upload');
|
39
41
|
var _useState = useState([]),
|
40
42
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -101,38 +103,65 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
101
103
|
return false;
|
102
104
|
}
|
103
105
|
}
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
106
|
+
// 校验图片尺寸
|
107
|
+
var reader = new FileReader();
|
108
|
+
reader.readAsDataURL(file);
|
109
|
+
reader.onload = function (e) {
|
110
|
+
var _e$target;
|
111
|
+
var image = new Image();
|
112
|
+
image.src = (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.result;
|
113
|
+
image.onload = function () {
|
114
|
+
if (widthPixels != null && heightPixels != null) {
|
115
|
+
if (image.width !== widthPixels || image.height !== heightPixels) {
|
116
|
+
void messageApi.warning("\u8BF7\u4E0A\u4F20\u5C3A\u5BF8\u4E3A".concat(widthPixels, "*").concat(heightPixels, "\u7684\u56FE\u7247"));
|
117
|
+
return;
|
118
|
+
}
|
119
|
+
} else if (widthPixels != null && heightPixels == null) {
|
120
|
+
if (image.width !== widthPixels) {
|
121
|
+
void messageApi.warning("\u8BF7\u4E0A\u4F20\u5BBD\u5EA6\u4E3A".concat(widthPixels, "\u7684\u56FE\u7247"));
|
122
|
+
return;
|
123
|
+
}
|
124
|
+
} else if (widthPixels == null && heightPixels != null) {
|
125
|
+
if (image.height !== heightPixels) {
|
126
|
+
void messageApi.warning("\u8BF7\u4E0A\u4F20\u9AD8\u5EA6\u4E3A".concat(heightPixels, "\u7684\u56FE\u7247"));
|
127
|
+
return;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
// 图片尺寸符合要求,上传图片
|
131
|
+
var formData = new FormData();
|
132
|
+
if (folder != null) {
|
133
|
+
formData.append('folder', folder);
|
134
|
+
}
|
135
|
+
formData.append('files', file);
|
136
|
+
formData.append('user_origin_name', 'true');
|
137
|
+
void request({
|
138
|
+
url: "/v1/file/multi-upload1",
|
139
|
+
method: 'post',
|
140
|
+
data: formData,
|
141
|
+
headers: {
|
142
|
+
'Content-Type': 'multipart/form-data'
|
143
|
+
}
|
144
|
+
}).then(function (res) {
|
145
|
+
var _fileList = Array.from([]);
|
146
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
147
|
+
// @ts-expect-error
|
148
|
+
res === null || res === void 0 || res.forEach(function (item) {
|
149
|
+
_fileList.push({
|
150
|
+
name: file.name,
|
151
|
+
url: item.filename,
|
152
|
+
uid: file.uid,
|
153
|
+
preview: item.filename,
|
154
|
+
status: 'done'
|
155
|
+
});
|
156
|
+
});
|
157
|
+
onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(fileList), _fileList));
|
158
|
+
// setFileList([...fileList, ..._fileList]);
|
159
|
+
}).catch(function () {
|
160
|
+
var msg = '上传失败!';
|
161
|
+
void messageApi.error(msg);
|
128
162
|
});
|
129
|
-
}
|
130
|
-
|
131
|
-
// setFileList([...fileList, ..._fileList]);
|
132
|
-
}).catch(function () {
|
133
|
-
var msg = '上传失败!';
|
134
|
-
void messageApi.error(msg);
|
135
|
-
});
|
163
|
+
};
|
164
|
+
};
|
136
165
|
return false;
|
137
166
|
}
|
138
167
|
var onRemove = function onRemove(file) {
|
@@ -214,7 +243,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
214
243
|
onChange: undefined
|
215
244
|
}), (fileList === null || fileList === void 0 || (_fileList$filter = fileList.filter(function (item) {
|
216
245
|
return item.url != null;
|
217
|
-
})) === null || _fileList$filter === void 0 ? void 0 : _fileList$filter.length) >= (maxCount != null ? maxCount : 1) ? null : uploadButton), (previewFile === null || previewFile === void 0 ? void 0 : previewFile.url) != null ? /*#__PURE__*/React.createElement(
|
246
|
+
})) === null || _fileList$filter === void 0 ? void 0 : _fileList$filter.length) >= (maxCount != null ? maxCount : 1) ? null : uploadButton), (previewFile === null || previewFile === void 0 ? void 0 : previewFile.url) != null ? /*#__PURE__*/React.createElement(AntdImage, {
|
218
247
|
wrapperStyle: {
|
219
248
|
display: 'none'
|
220
249
|
},
|
package/dist/upload/index.d.ts
CHANGED
@@ -7,6 +7,8 @@ export type UploadProps = AntUploadProps & {
|
|
7
7
|
accept?: string;
|
8
8
|
folder?: string;
|
9
9
|
value?: UploadFile[];
|
10
|
+
widthPixels?: number;
|
11
|
+
heightPixels?: number;
|
10
12
|
fileType?: 'file' | 'image';
|
11
13
|
onChange?: (value?: UploadFile[]) => void;
|
12
14
|
};
|
@@ -15,6 +17,8 @@ export declare const Upload: React.ForwardRefExoticComponent<AntUploadProps<any>
|
|
15
17
|
accept?: string | undefined;
|
16
18
|
folder?: string | undefined;
|
17
19
|
value?: UploadFile<any>[] | undefined;
|
20
|
+
widthPixels?: number | undefined;
|
21
|
+
heightPixels?: number | undefined;
|
18
22
|
fileType?: "image" | "file" | undefined;
|
19
23
|
onChange?: ((value?: UploadFile[]) => void) | undefined;
|
20
24
|
} & React.RefAttributes<UploadRef<any>>>;
|