yootd 0.0.5 → 0.0.7
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/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/school/index.js +1 -1
- package/dist/student-dropdown/index.d.ts +3 -0
- package/dist/student-dropdown/index.js +66 -0
- package/dist/student-dropdown/types/types.d.ts +44 -0
- package/dist/upload/components/imageUpload.js +4 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -52,6 +52,8 @@ export { Switch } from './switch';
|
|
52
52
|
export type { SwitchProps } from './switch';
|
53
53
|
export { Steps } from './steps';
|
54
54
|
export type { StepsProps } from './steps';
|
55
|
+
export { StudentDropdown } from './student-dropdown';
|
56
|
+
export type { StudentDropdownProps } from './student-dropdown/types/types';
|
55
57
|
export { ApprovalProcess } from './approval-process';
|
56
58
|
export { State } from './state';
|
57
59
|
export type { StateProps } from './state';
|
package/dist/index.js
CHANGED
@@ -26,6 +26,7 @@ export { TreeSelect } from "./tree-select";
|
|
26
26
|
export { Transfer } from "./transfer";
|
27
27
|
export { Switch } from "./switch";
|
28
28
|
export { Steps } from "./steps";
|
29
|
+
export { StudentDropdown } from "./student-dropdown";
|
29
30
|
export { ApprovalProcess } from "./approval-process";
|
30
31
|
export { State } from "./state";
|
31
32
|
export { BusinessTree } from "./business-tree";
|
package/dist/school/index.js
CHANGED
@@ -184,7 +184,7 @@ export var School = function School(_ref) {
|
|
184
184
|
return gradeId != null ? (_allGradeAndClassOpti = allGradeAndClassOptions === null || allGradeAndClassOptions === void 0 ? void 0 : allGradeAndClassOptions[gradeId]) !== null && _allGradeAndClassOpti !== void 0 ? _allGradeAndClassOpti : [] : allClassOptions;
|
185
185
|
}
|
186
186
|
return [];
|
187
|
-
}, [type, collegeId, gradeId,
|
187
|
+
}, [type, collegeId, gradeId, allCollegeAndMajorOptions, allMajorOptions, allGradeAndClassOptions, allClassOptions]);
|
188
188
|
// 第一个下拉框的placeholder
|
189
189
|
var firstSelectPlaceholder = useMemo(function () {
|
190
190
|
if (type === 'collegeMajor' || type === 'college') {
|
@@ -0,0 +1,66 @@
|
|
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 = ["label", "connectors", "showSearch", "optionFilterProp", "teacher_id"];
|
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); }
|
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; }
|
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; }
|
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; }
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
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; }
|
11
|
+
import { useQuery } from '@tanstack/react-query';
|
12
|
+
import React, { useMemo } from 'react';
|
13
|
+
import { Select } from "./..";
|
14
|
+
import { useRequest } from "../hooks/useRequest";
|
15
|
+
export var StudentDropdown = function StudentDropdown(_ref) {
|
16
|
+
var _ref$label = _ref.label,
|
17
|
+
label = _ref$label === void 0 ? ['personalName', 'genderName', 'uniqueNumber'] : _ref$label,
|
18
|
+
_ref$connectors = _ref.connectors,
|
19
|
+
connectors = _ref$connectors === void 0 ? '~' : _ref$connectors,
|
20
|
+
_ref$showSearch = _ref.showSearch,
|
21
|
+
showSearch = _ref$showSearch === void 0 ? true : _ref$showSearch,
|
22
|
+
_ref$optionFilterProp = _ref.optionFilterProp,
|
23
|
+
optionFilterProp = _ref$optionFilterProp === void 0 ? 'label' : _ref$optionFilterProp,
|
24
|
+
teacher_id = _ref.teacher_id,
|
25
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
26
|
+
var request = useRequest();
|
27
|
+
// 查询学生数据
|
28
|
+
var _useQuery = useQuery({
|
29
|
+
queryKey: ['teacherData', teacher_id],
|
30
|
+
queryFn: function queryFn() {
|
31
|
+
return request('v1/users/by/name_no', {
|
32
|
+
params: {
|
33
|
+
user_type: 1,
|
34
|
+
teacher_id: teacher_id
|
35
|
+
}
|
36
|
+
});
|
37
|
+
},
|
38
|
+
enabled: teacher_id != null
|
39
|
+
}),
|
40
|
+
userData = _useQuery.data,
|
41
|
+
userLoading = _useQuery.isLoading;
|
42
|
+
// 将搜索到的数据处理成下拉框
|
43
|
+
var allUserOptions = useMemo(function () {
|
44
|
+
var _userData$content;
|
45
|
+
var userLabel = userData === null || userData === void 0 || (_userData$content = userData.content) === null || _userData$content === void 0 ? void 0 : _userData$content.map(function (item) {
|
46
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
47
|
+
genderName: item.gender != null ? item.gender === 1 ? '男' : '女' : '性别未知'
|
48
|
+
});
|
49
|
+
});
|
50
|
+
return userLabel === null || userLabel === void 0 ? void 0 : userLabel.map(function (item) {
|
51
|
+
var _label$map$join;
|
52
|
+
return {
|
53
|
+
label: label === null || label === void 0 || (_label$map$join = label.map(function (key) {
|
54
|
+
return item[key];
|
55
|
+
}).join(connectors)) === null || _label$map$join === void 0 || (_label$map$join = _label$map$join.replace(new RegExp("^".concat(connectors, "+|").concat(connectors, "+$"), 'g'), '')) === null || _label$map$join === void 0 ? void 0 : _label$map$join.replace(new RegExp("".concat(connectors, "{2,}"), 'g'), connectors),
|
56
|
+
value: item.userId
|
57
|
+
};
|
58
|
+
});
|
59
|
+
}, [userData]);
|
60
|
+
return /*#__PURE__*/React.createElement(Select, _extends({
|
61
|
+
loading: userLoading,
|
62
|
+
showSearch: showSearch,
|
63
|
+
optionFilterProp: optionFilterProp,
|
64
|
+
options: allUserOptions
|
65
|
+
}, rest));
|
66
|
+
};
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { SelectProps } from 'yootd';
|
2
|
+
|
3
|
+
export interface PageData<T> {
|
4
|
+
content: T[];
|
5
|
+
page: {
|
6
|
+
number: number;
|
7
|
+
size: number;
|
8
|
+
totalElements: number;
|
9
|
+
totalPages: number;
|
10
|
+
};
|
11
|
+
}
|
12
|
+
type LabelOptions =
|
13
|
+
| 'uniqueNumber'
|
14
|
+
| 'personalName'
|
15
|
+
| 'majorName'
|
16
|
+
| 'collegeMajorName'
|
17
|
+
| 'className'
|
18
|
+
| 'gradeName'
|
19
|
+
| 'genderName'
|
20
|
+
| 'deptName'
|
21
|
+
| 'credentialsNo'
|
22
|
+
| 'personalMobile';
|
23
|
+
export type StudentDropdownProps = SelectProps & {
|
24
|
+
label?: LabelOptions[];
|
25
|
+
connectors?: string;
|
26
|
+
teacher_id: number;
|
27
|
+
};
|
28
|
+
export interface IuserItem {
|
29
|
+
userId: string; // ID
|
30
|
+
uniqueNumber?: string; // 学号/工号
|
31
|
+
personalName: string; // 姓名
|
32
|
+
personalPhoto?: string; // 照片
|
33
|
+
userFaceType?: number; // 人脸类型(1白名单2黑名单3红名单)
|
34
|
+
majorName?: string; // 专业名称
|
35
|
+
collegeMajorName?: string; // 院系名称
|
36
|
+
className?: string; // 班级名称
|
37
|
+
gradeName?: string; // 年级名称
|
38
|
+
genderName?: string; // 性别
|
39
|
+
deptId?: number; // 部门ID
|
40
|
+
deptName?: string; // 部门名称
|
41
|
+
gender?: number; // 性别
|
42
|
+
credentialsNo?: string; // 证件号
|
43
|
+
personalMobile?: string; // 手机号
|
44
|
+
}
|
@@ -143,11 +143,12 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
143
143
|
return false;
|
144
144
|
}
|
145
145
|
var onRemove = function onRemove(file) {
|
146
|
-
var
|
146
|
+
var _newFileList = fileList === null || fileList === void 0 ? void 0 : fileList.filter(function (item) {
|
147
147
|
return item.uid !== file.uid;
|
148
148
|
});
|
149
|
-
|
150
|
-
|
149
|
+
console.log('onRemove', _newFileList);
|
150
|
+
onChange === null || onChange === void 0 || onChange(_newFileList);
|
151
|
+
setFileList(_newFileList);
|
151
152
|
};
|
152
153
|
function handlePreview(file) {
|
153
154
|
if (file.url != null) {
|