yootd 0.0.18 → 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 +1 -1
- package/dist/empty/index.js +9 -1
- package/dist/school/index.d.ts +2 -1
- package/dist/school/index.js +9 -4
- package/dist/upload/components/fileUpload.d.ts +2 -0
- package/dist/upload/components/imageUpload.d.ts +2 -0
- package/dist/upload/components/imageUpload.js +63 -34
- package/dist/upload/index.d.ts +4 -0
- package/dist/year-term/index.d.ts +2 -1
- package/dist/year-term/index.js +9 -4
- package/package.json +1 -1
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
|
};
|
package/dist/school/index.d.ts
CHANGED
package/dist/school/index.js
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
var _excluded = ["type", "multiple", "style", "showSearch", "value", "onChange", "allowClear", "placeholder"];
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
6
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
@@ -10,6 +12,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
10
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
11
13
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
12
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
16
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
13
17
|
import { useQuery } from '@tanstack/react-query';
|
14
18
|
import React, { useEffect, useMemo, useState } from 'react';
|
15
19
|
import { Select } from "./..";
|
@@ -27,7 +31,8 @@ export var School = function School(_ref) {
|
|
27
31
|
onChange = _ref.onChange,
|
28
32
|
_ref$allowClear = _ref.allowClear,
|
29
33
|
allowClear = _ref$allowClear === void 0 ? true : _ref$allowClear,
|
30
|
-
placeholder = _ref.placeholder
|
34
|
+
placeholder = _ref.placeholder,
|
35
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
31
36
|
var mb = useBem('School');
|
32
37
|
var request = useRequest();
|
33
38
|
// 选择的系部id
|
@@ -276,7 +281,7 @@ export var School = function School(_ref) {
|
|
276
281
|
return /*#__PURE__*/React.createElement("div", {
|
277
282
|
className: isSingle ? '' : "".concat(mb),
|
278
283
|
style: isSingle ? {} : style
|
279
|
-
}, type === 'major' || type === 'class' ? null : /*#__PURE__*/React.createElement(Select, {
|
284
|
+
}, type === 'major' || type === 'class' ? null : /*#__PURE__*/React.createElement(Select, _extends({
|
280
285
|
allowClear: allowClear,
|
281
286
|
className: "".concat(mb.b('school-select')),
|
282
287
|
value: type === 'collegeMajor' || type === 'college' ? collegeId : gradeId,
|
@@ -290,7 +295,7 @@ export var School = function School(_ref) {
|
|
290
295
|
options: firstSelectOptions,
|
291
296
|
onChange: changeFirstSelect,
|
292
297
|
mode: type !== 'collegeMajor' && type !== 'gradeClass' ? multiple ? 'multiple' : undefined : undefined
|
293
|
-
}), type === 'college' || type === 'grade' ? null : /*#__PURE__*/React.createElement(Select, {
|
298
|
+
}, type !== 'collegeMajor' && type !== 'gradeClass' ? rest : {})), type === 'college' || type === 'grade' ? null : /*#__PURE__*/React.createElement(Select, _extends({
|
294
299
|
allowClear: allowClear,
|
295
300
|
value: type === 'collegeMajor' || type === 'major' ? majorId : classId,
|
296
301
|
mode: type !== 'collegeMajor' && type !== 'gradeClass' ? multiple ? 'multiple' : undefined : undefined,
|
@@ -303,5 +308,5 @@ export var School = function School(_ref) {
|
|
303
308
|
},
|
304
309
|
options: secondSelectOptions,
|
305
310
|
onChange: changeSecondSelect
|
306
|
-
}));
|
311
|
+
}, type !== 'collegeMajor' && type !== 'gradeClass' ? rest : {})));
|
307
312
|
};
|
@@ -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>>>;
|
package/dist/year-term/index.js
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
+
var _excluded = ["type", "style", "showSearch", "value", "onChange", "allowClear", "placeholder"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
1
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
3
5
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
4
6
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
5
7
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
6
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
7
11
|
import { useQuery } from '@tanstack/react-query';
|
8
12
|
import React, { useEffect, useMemo, useState } from 'react';
|
9
13
|
import { Select } from "./..";
|
@@ -20,7 +24,8 @@ export var YearTerm = function YearTerm(_ref) {
|
|
20
24
|
onChange = _ref.onChange,
|
21
25
|
_ref$allowClear = _ref.allowClear,
|
22
26
|
allowClear = _ref$allowClear === void 0 ? true : _ref$allowClear,
|
23
|
-
placeholder = _ref.placeholder
|
27
|
+
placeholder = _ref.placeholder,
|
28
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
24
29
|
var mb = useBem('YearTerm');
|
25
30
|
var request = useRequest();
|
26
31
|
// 选择的学年id
|
@@ -140,7 +145,7 @@ export var YearTerm = function YearTerm(_ref) {
|
|
140
145
|
return /*#__PURE__*/React.createElement("div", {
|
141
146
|
className: isSingle ? '' : "".concat(mb),
|
142
147
|
style: isSingle ? {} : style
|
143
|
-
}, type === 'term' ? null : /*#__PURE__*/React.createElement(Select, {
|
148
|
+
}, type === 'term' ? null : /*#__PURE__*/React.createElement(Select, _extends({
|
144
149
|
value: yearId,
|
145
150
|
allowClear: allowClear,
|
146
151
|
className: "".concat(mb.b('school-select')),
|
@@ -153,7 +158,7 @@ export var YearTerm = function YearTerm(_ref) {
|
|
153
158
|
},
|
154
159
|
options: allYearOptions,
|
155
160
|
onChange: changeFirstSelect
|
156
|
-
}), type === 'year' ? null : /*#__PURE__*/React.createElement(Select, {
|
161
|
+
}, type !== 'yearTerm' ? rest : {})), type === 'year' ? null : /*#__PURE__*/React.createElement(Select, _extends({
|
157
162
|
value: termId,
|
158
163
|
allowClear: allowClear,
|
159
164
|
showSearch: showSearch,
|
@@ -165,5 +170,5 @@ export var YearTerm = function YearTerm(_ref) {
|
|
165
170
|
},
|
166
171
|
options: termOptions,
|
167
172
|
onChange: changeSecondSelect
|
168
|
-
}));
|
173
|
+
}, type !== 'yearTerm' ? rest : {})));
|
169
174
|
};
|