@cloudbase/weda-ui 3.24.1 → 3.25.1
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/configs/components/dataView.js +1 -0
- package/dist/configs/components/listView.js +1 -0
- package/dist/configs/components/wd-form-arr.js +4 -1
- package/dist/configs/components/wd-image.js +1 -1
- package/dist/configs/components/wd-select-multiple.js +1 -0
- package/dist/configs/components/wd-select.js +1 -0
- package/dist/configs/components/wd-table.d.ts +5 -0
- package/dist/configs/components/wd-table.js +12 -0
- package/dist/configs/components/wd-text.js +2 -2
- package/dist/configs/components/wxOpenApi/userInfo.d.ts +2 -2
- package/dist/configs/index.d.ts +12 -2
- package/dist/configs/type-utils/type-form.js +6 -4
- package/dist/configs/utils/field.d.ts +1 -0
- package/dist/configs/utils/field.js +151 -0
- package/dist/style/index.css +7 -2
- package/dist/style/index.scss +1 -1
- package/dist/style/weda-ui.min.css +4 -4
- package/dist/web/components/form/uploader/upload/index.js +3 -1
- package/dist/web/components/form/uploader/uploader.pc.js +3 -1
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +25 -17
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +26 -17
- package/dist/web/components/form/userOrgSelect/component/depart-breadcrumb.js +3 -1
- package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.d.ts +2 -2
- package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.js +8 -4
- package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +10 -3
- package/dist/web/components/form/userOrgSelect/component/depart-select/org-modal-pc.js +6 -6
- package/dist/web/components/form/userOrgSelect/component/error-tips.d.ts +1 -1
- package/dist/web/components/form/userOrgSelect/component/error-tips.js +7 -4
- package/dist/web/components/form/userOrgSelect/component/modal-search-h5.js +3 -1
- package/dist/web/components/form/userOrgSelect/component/modal-search.js +4 -1
- package/dist/web/components/form/userOrgSelect/component/modal-select-h5.js +8 -11
- package/dist/web/components/form/userOrgSelect/component/org-tree.js +3 -1
- package/dist/web/components/form/userOrgSelect/component/selected-list-h5.js +8 -8
- package/dist/web/components/form/userOrgSelect/component/selected-list.js +5 -10
- package/dist/web/components/form/userOrgSelect/component/user-org-list.js +12 -21
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-list-h5.js +6 -10
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.d.ts +1 -1
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.js +5 -1
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/model-user-list.d.ts +1 -1
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/model-user-list.js +4 -2
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +4 -2
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.d.ts +2 -2
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +6 -2
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.d.ts +2 -2
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +12 -11
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +9 -9
- package/dist/web/components/form-input-hooks/index.js +12 -4
- package/dist/web/components/form-input-hooks/validator.js +1 -1
- package/dist/web/components/formdetail/index.js +1 -0
- package/dist/web/components/index.d.ts +1 -0
- package/dist/web/components/index.js +1 -0
- package/dist/web/components/richText/const.d.ts +57 -0
- package/dist/web/components/richText/const.js +57 -0
- package/dist/web/components/richText/index.css +3 -1
- package/dist/web/components/richText/index.d.ts +1 -2
- package/dist/web/components/richText/index.js +26 -20
- package/dist/web/components/table/ImportFileModal/index.css +21 -69
- package/dist/web/components/uploaderFileView/index.js +2 -0
- package/dist/web/components/uploaderView/index.js +6 -3
- package/dist/web/components/wd-button/wd-button.js +5 -5
- package/dist/web/components/wd-config-provider/wd-config-context.d.ts +9 -0
- package/dist/web/components/wd-config-provider/wd-config-context.js +2 -0
- package/dist/web/components/wd-config-provider/wd-config-provider.js +8 -9
- package/dist/web/components/wd-form/hoc/form-container-decorator.js +2 -2
- package/dist/web/components/wd-form/hooks/use-remote-value.js +1 -1
- package/dist/web/components/wd-form-item/wd-form-item.js +9 -11
- package/dist/web/components/wd-image/ImagePreview.js +5 -1
- package/dist/web/components/wd-rich-text/wd-rich-text.js +1 -1
- package/dist/web/components/wd-table/table-with-form.js +28 -14
- package/dist/web/components/wd-table/wd-table.js +14 -4
- package/dist/web/components/wd-tree/utils.d.ts +1 -1
- package/dist/web/components/wd-upload-file/wd-upload-file.js +5 -1
- package/dist/web/utils/config-context/use-config.d.ts +1 -0
- package/dist/web/utils/config-context/use-config.js +2 -1
- package/dist/web/utils/hooks/useCanPreview.js +1 -1
- package/dist/web/utils/i18n/index.d.ts +1 -0
- package/dist/web/utils/i18n/index.js +1 -0
- package/dist/web/utils/i18n/locale/en_US.d.ts +119 -0
- package/dist/web/utils/i18n/locale/en_US.js +187 -0
- package/dist/web/utils/i18n/locale/zh_CN.d.ts +120 -0
- package/dist/web/utils/i18n/locale/zh_CN.js +188 -0
- package/dist/web/utils/i18n/translation.d.ts +9 -0
- package/dist/web/utils/i18n/translation.js +28 -0
- package/dist/web/utils/i18n/translationMap.d.ts +15 -0
- package/dist/web/utils/i18n/translationMap.js +10 -0
- package/package.json +4 -3
|
@@ -168,7 +168,9 @@ export const Upload = forwardRef(function Upload({ children, ...props }, ref) {
|
|
|
168
168
|
(_a = events === null || events === void 0 ? void 0 : events.success) === null || _a === void 0 ? void 0 : _a.call(events, { value: _storageTypeIsHttps ? item.url : item.cloudId, file: item.file });
|
|
169
169
|
},
|
|
170
170
|
onFail(err) {
|
|
171
|
-
events === null || events === void 0 ? void 0 : events.error
|
|
171
|
+
if (typeof (events === null || events === void 0 ? void 0 : events.error) === 'function') {
|
|
172
|
+
events.error(err);
|
|
173
|
+
}
|
|
172
174
|
},
|
|
173
175
|
beforeUpload: callbacks === null || callbacks === void 0 ? void 0 : callbacks.beforeUpload,
|
|
174
176
|
};
|
|
@@ -6,6 +6,7 @@ import { errorHandler } from '../../../utils/error';
|
|
|
6
6
|
import { WdIcon } from '../../wd-icon';
|
|
7
7
|
import { ImagePreview } from '../../wd-image/ImagePreview';
|
|
8
8
|
import { Upload } from './upload';
|
|
9
|
+
import { useTranslation } from '../../../utils/i18n/translation';
|
|
9
10
|
// 默认组件类前缀
|
|
10
11
|
export const CLASS_PREFIX = 'weda-uploader-pc';
|
|
11
12
|
// 默认图片类型
|
|
@@ -19,7 +20,8 @@ export const IMAGE_TYPES = [
|
|
|
19
20
|
'image/gif',
|
|
20
21
|
];
|
|
21
22
|
export function UploaderPCInner(props) {
|
|
22
|
-
const
|
|
23
|
+
const t = useTranslation();
|
|
24
|
+
const { tips = '', btnTitle = t.uploadImage, maxUploadCount = 9, acceptTypes = IMAGE_TYPES, single = false, disabled = false, imgTypeCls, readOnly, sourceType, popupContainer: portalContainer, defaultValue, setUploadHandle: outSetUploadHandle, } = props;
|
|
23
25
|
const uploadRef = React.useRef(null);
|
|
24
26
|
const [uploadHandle, setUploadHandle] = React.useState({});
|
|
25
27
|
const tempFile = React.useMemo(() => (uploadHandle === null || uploadHandle === void 0 ? void 0 : uploadHandle.previewFile) || [], [uploadHandle === null || uploadHandle === void 0 ? void 0 : uploadHandle.previewFile]);
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
4
4
|
import { ConfigProvider, Button, Text, List, Progress, Tooltip } from 'tea-component';
|
|
5
|
+
import { useTranslation } from '../../../utils/i18n/translation';
|
|
5
6
|
import { filterStrList, isCloudFileID, isHttpFileID, transSize, transFileCloudidToName, randomStr, isInIde, isWebInMiniprogram, transFileName, alertErrorMessage, } from '../../../utils/platform';
|
|
6
7
|
import { getCloudInstance, getDefaultUploadPath } from '../../../utils/tcb';
|
|
7
8
|
import classNames from '../../../utils/classnames';
|
|
@@ -25,12 +26,12 @@ export const FILES_TYPES = [
|
|
|
25
26
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
26
27
|
];
|
|
27
28
|
// 上传状态字典
|
|
28
|
-
const
|
|
29
|
-
UPLOAD_STATUS_PENDING: { title:
|
|
30
|
-
UPLOAD_STATUS_LOADING: { title:
|
|
31
|
-
UPLOAD_STATUS_SUCCESS: { title:
|
|
32
|
-
UPLOAD_STATUS_ERROR: { title:
|
|
33
|
-
};
|
|
29
|
+
const getStatusMap = (t) => ({
|
|
30
|
+
UPLOAD_STATUS_PENDING: { title: t.waitingUpload, icon: 'pending' },
|
|
31
|
+
UPLOAD_STATUS_LOADING: { title: t.uploading, icon: 'loading' },
|
|
32
|
+
UPLOAD_STATUS_SUCCESS: { title: t.uploadSuccess, icon: 'success' },
|
|
33
|
+
UPLOAD_STATUS_ERROR: { title: t.uploadFailed, icon: 'error' },
|
|
34
|
+
});
|
|
34
35
|
// 上传文件Context
|
|
35
36
|
const FileContext = React.createContext(null);
|
|
36
37
|
/**
|
|
@@ -39,12 +40,17 @@ const FileContext = React.createContext(null);
|
|
|
39
40
|
const defaultStyle = { margin: '0,-5px' };
|
|
40
41
|
export function UploadFileH5({
|
|
41
42
|
// 系统属性
|
|
42
|
-
layout, id = '', style = defaultStyle, labelVisible = true, label
|
|
43
|
+
layout, id = '', style = defaultStyle, labelVisible = true, label, requiredFlag = false, disabled = false, className = '', acceptTypes = emptyArray,
|
|
43
44
|
// 组件属性
|
|
44
|
-
tips = '', btnTitle
|
|
45
|
+
tips = '', btnTitle, uploadTipText, maxUploadCount = 9, maxSize = 10, deleteVisible = true, downloadVisible = true, value = emptyArray, // 需要兼容 cloud:和https: 协议,需要兼容字符串和字符串数组
|
|
45
46
|
events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true, onChange = null, isEdit = true, $node, readOnly, callbacks, storageType = 'cloudID', }) {
|
|
46
47
|
var _a;
|
|
48
|
+
const t = useTranslation();
|
|
47
49
|
const _storageTypeIsHttps = storageTypeIsHttps(storageType);
|
|
50
|
+
// 使用国际化文本或传入的文本
|
|
51
|
+
const uploadFileLabel = label || t.uploadFile;
|
|
52
|
+
const uploadBtnTitle = btnTitle || t.clickToUpload;
|
|
53
|
+
const uploadSupportText = uploadTipText || t.supportBatchUpload;
|
|
48
54
|
const [fileIDList, setfileIDList] = React.useState(isInIde() ? [] : filterStrList([].concat(defaultValue, value))); // 上传成功文件ID列表,fileID[]
|
|
49
55
|
const [fileList, setFileList] = React.useState([]); // 上传中的文件列表,file[],file为原始文件 + uuid属性
|
|
50
56
|
const [fileSizeObj, setFileSizeObj] = React.useState({}); // 管理上传文件大小 {uuid:size}
|
|
@@ -132,42 +138,42 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
132
138
|
isEdit,
|
|
133
139
|
events,
|
|
134
140
|
fileSizeObj,
|
|
135
|
-
}, children: _jsx("div", { "data-testid": "uploadFileH5", className: cls, id: id, style: style, children: _jsxs("div", { className: classNames(`${CLASS_PREFIX}`), children: [isEdit && (_jsx("div", { className: classNames(`${CLASS_PREFIX}__hd`, layout), children: _jsx("div", { children: btnDisabled ? (readOnly ? null : (_jsx(WdButton, { variant: "outline", className: classNames(`${CLASS_PREFIX}__btn--weak`), disabled: btnDisabled, text:
|
|
141
|
+
}, children: _jsx("div", { "data-testid": "uploadFileH5", className: cls, id: id, style: style, children: _jsxs("div", { className: classNames(`${CLASS_PREFIX}`), children: [isEdit && (_jsx("div", { className: classNames(`${CLASS_PREFIX}__hd`, layout), children: _jsx("div", { children: btnDisabled ? (readOnly ? null : (_jsx(WdButton, { variant: "outline", className: classNames(`${CLASS_PREFIX}__btn--weak`), disabled: btnDisabled, text: uploadBtnTitle }))) : (_jsxs("div", { children: [_jsx("input", { ref: inputRef, id: "uploaderInput", type: "file", "data-testid": "button-up", className: "weui-uploader-mobile__input", accept: accepts.join(','), multiple: !single, onClick: () => {
|
|
136
142
|
inputRef.current && (inputRef.current.value = '');
|
|
137
143
|
}, onChange: async (e) => {
|
|
138
144
|
let fileList = [...e.target.files];
|
|
139
145
|
const isAccepted = fileList.every((i) => checkAcceptedFiles(i, accepts));
|
|
140
146
|
if (!isAccepted) {
|
|
141
147
|
alertErrorMessage({
|
|
142
|
-
message:
|
|
148
|
+
message: t.fileTypeError,
|
|
143
149
|
icon: 'none',
|
|
144
150
|
});
|
|
145
151
|
return false;
|
|
146
152
|
}
|
|
147
153
|
if (single && fileList.length > 1) {
|
|
148
154
|
alertErrorMessage({
|
|
149
|
-
message:
|
|
155
|
+
message: t.fileTotalExceed.replace('{count}', '1'),
|
|
150
156
|
icon: 'none',
|
|
151
157
|
});
|
|
152
158
|
return false;
|
|
153
159
|
}
|
|
154
160
|
if (fileList.length + fileIDList.length > maxUploadCount) {
|
|
155
161
|
alertErrorMessage({
|
|
156
|
-
message:
|
|
162
|
+
message: t.fileTotalExceed.replace('{count}', `${maxUploadCount}`),
|
|
157
163
|
icon: 'none',
|
|
158
164
|
});
|
|
159
165
|
return false;
|
|
160
166
|
}
|
|
161
167
|
if (maxSizeLimit && fileList.some((f) => f.size > maxSizeLimit * 1024 * 1024)) {
|
|
162
168
|
alertErrorMessage({
|
|
163
|
-
message:
|
|
169
|
+
message: t.fileSizeExceed.replace('{size}', `${maxSizeLimit}`),
|
|
164
170
|
icon: 'none',
|
|
165
171
|
});
|
|
166
172
|
return false;
|
|
167
173
|
}
|
|
168
174
|
if (fileList.some((f) => f.size > 1024 * 1024 * 1024)) {
|
|
169
175
|
alertErrorMessage({
|
|
170
|
-
message:
|
|
176
|
+
message: t.fileSizeExceed.replace('{size}', '1024'),
|
|
171
177
|
icon: 'none',
|
|
172
178
|
});
|
|
173
179
|
return false;
|
|
@@ -204,11 +210,11 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
204
210
|
}
|
|
205
211
|
fileList.forEach((f) => (f['_uuid'] = randomStr()));
|
|
206
212
|
setFileList((list) => [...list, ...fileList]);
|
|
207
|
-
} }), _jsx(WdButton, { variant: "outline", className: "wedatea2td-btn wedatea2td-btn--weak", text:
|
|
213
|
+
} }), _jsx(WdButton, { variant: "outline", className: "wedatea2td-btn wedatea2td-btn--weak", text: uploadBtnTitle, size: "sm" }), !single && _jsx(Text, { className: `${CLASS_PREFIX}__tips`, children: uploadSupportText })] })) }) })), _jsx("div", { className: `${CLASS_PREFIX}__bd`, children: _jsxs(List, { children: [fileIDList.map((d) => (_jsx(List.Item, { children: _jsx(TcbFileEcho, { fileID: d, fileList: fileList, onChange: handleChange, disabled: disabled, deleteVisible: deleteVisible, downloadVisible: downloadVisible, formType: formType }) }, d))), fileList.map((item) => (_jsx(List.Item, { children: _jsx(TcbFileUpload, { id: id, disabled: disabled, file: item, downloadVisible: downloadVisible, deleteVisible: deleteVisible && !disabled, formType: formType }) }, item === null || item === void 0 ? void 0 : item._uuid)))] }) })] }) }) }) }))({
|
|
208
214
|
id,
|
|
209
215
|
className: cls,
|
|
210
216
|
style,
|
|
211
|
-
label: labelVisible ?
|
|
217
|
+
label: labelVisible ? uploadFileLabel : null,
|
|
212
218
|
layout,
|
|
213
219
|
multiCell: false,
|
|
214
220
|
requiredFlag,
|
|
@@ -299,9 +305,11 @@ const TcbFileUpload = ({ id, file, disabled, formType }) => {
|
|
|
299
305
|
const UploadFileStatus = ({ status = 'UPLOAD_STATUS_SUCCESS', percent = 0, size, title = null, percentSize = 0, formType, }) => {
|
|
300
306
|
var _a;
|
|
301
307
|
const { isEdit } = React.useContext(FileContext) || {};
|
|
308
|
+
const t = useTranslation();
|
|
309
|
+
const statusMap = getStatusMap(t);
|
|
302
310
|
//上传中、待上传状态
|
|
303
311
|
if (status == 'UPLOAD_STATUS_LOADING' || (status == 'UPLOAD_STATUS_PENDING' && percent)) {
|
|
304
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: `${CLASS_PREFIX}__file-detail`, children: _jsx(Text, { className: `${CLASS_PREFIX}__file-name`, children: title }) }), _jsx("div", { children: _jsx(Progress, { percent: percent, theme: "default", strokeColor: '#0052D9', className: `${CLASS_PREFIX}__file-progress` }) }), _jsxs("div", { className: `${CLASS_PREFIX}__file-foot`, children: [formType !== 'read' && (_jsxs("div", { children: [_jsxs(Text, { children: [Math.floor(percentSize), "K/"] }), _jsx(Text, { children: size })] })), _jsx(Text, { children: status === 'UPLOAD_STATUS_PENDING' ?
|
|
312
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: `${CLASS_PREFIX}__file-detail`, children: _jsx(Text, { className: `${CLASS_PREFIX}__file-name`, children: title }) }), _jsx("div", { children: _jsx(Progress, { percent: percent, theme: "default", strokeColor: '#0052D9', className: `${CLASS_PREFIX}__file-progress` }) }), _jsxs("div", { className: `${CLASS_PREFIX}__file-foot`, children: [formType !== 'read' && (_jsxs("div", { children: [_jsxs(Text, { children: [Math.floor(percentSize), "K/"] }), _jsx(Text, { children: size })] })), _jsx(Text, { children: status === 'UPLOAD_STATUS_PENDING' ? t.waitingUpload : t.uploading })] })] }));
|
|
305
313
|
}
|
|
306
314
|
return (_jsxs(_Fragment, { children: [_jsx("div", { className: `${CLASS_PREFIX}__file-detail`, children: _jsx(Tooltip, { title: title, children: _jsx(Text, { className: `${CLASS_PREFIX}__file-name`, children: title }) }) }), isEdit && (_jsxs("div", { className: `${CLASS_PREFIX}__file-foot`, children: [isEdit && (_jsx("div", { className: `${CLASS_PREFIX}__file-status`, children: _jsx(Text, { className: `${CLASS_PREFIX}__file-status--msg`, children: ((_a = statusMap[status]) === null || _a === void 0 ? void 0 : _a.title) || statusMap['UPLOAD_STATUS_PENDING'].title }) })), formType !== 'read' && (_jsx("div", { children: _jsx(Text, { children: size }) }))] }))] }));
|
|
307
315
|
};
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { Upload, ConfigProvider, Icon, List } from 'tea-component';
|
|
4
4
|
import { WdButton } from '../../wd-button';
|
|
5
5
|
import { WdText } from '../../wd-text';
|
|
6
|
+
import { useTranslation } from '../../../utils/i18n/translation';
|
|
6
7
|
import { filterStrList, isCloudFileID, isHttpFileID, isDataUri, transSize, cutFileTitle, transFileCloudidToName, randomStr, isInIde, isWebInMiniprogram, transFileName, alertErrorMessage, } from '../../../utils/platform';
|
|
7
8
|
import { getCloudInstance, getDefaultUploadPath } from '../../../utils/tcb';
|
|
8
9
|
import classNames from '../../../utils/classnames';
|
|
@@ -18,12 +19,12 @@ import { filenameRegex, storageTypeIsHttps } from '../uploader/util';
|
|
|
18
19
|
// 默认组件类前缀
|
|
19
20
|
const CLASS_PREFIX = 'weda-upload-file-pc';
|
|
20
21
|
// 上传状态字典
|
|
21
|
-
const
|
|
22
|
-
0: { title:
|
|
23
|
-
1: { title:
|
|
24
|
-
2: { title:
|
|
25
|
-
3: { title:
|
|
26
|
-
};
|
|
22
|
+
const getStatusMap = (t) => ({
|
|
23
|
+
0: { title: t.pendingUpload, icon: 'pending-gray' },
|
|
24
|
+
1: { title: t.uploading, icon: 'loading' },
|
|
25
|
+
2: { title: t.uploadSuccess, icon: 'success' },
|
|
26
|
+
3: { title: t.uploadFailed, icon: 'error' },
|
|
27
|
+
});
|
|
27
28
|
// 上传文件Context
|
|
28
29
|
const FileContext = React.createContext(null);
|
|
29
30
|
/**
|
|
@@ -31,13 +32,18 @@ const FileContext = React.createContext(null);
|
|
|
31
32
|
*/
|
|
32
33
|
export function UploadFilePc({
|
|
33
34
|
// 系统属性
|
|
34
|
-
layout, id = '', style, labelVisible = true, label
|
|
35
|
+
layout, id = '', style, labelVisible = true, label, requiredFlag = false, disabled = false, className = '', events = emptyObject,
|
|
35
36
|
// 组件属性
|
|
36
|
-
decorator, tips = '', btnTitle
|
|
37
|
+
decorator, tips = '', btnTitle, uploadTipText, maxUploadCount = 9, maxSize = 1024, single = true, defaultValue = emptyArray, // 组件默认初始化值
|
|
37
38
|
value = emptyArray, // 用于模型组件中 formily 的值管理
|
|
38
39
|
acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPath = 'weda-uploader', onChange = null, isEdit = true, $node, readOnly, callbacks, storageType = 'cloudID', }) {
|
|
39
40
|
var _a;
|
|
41
|
+
const t = useTranslation();
|
|
40
42
|
const _storageTypeIsHttps = storageTypeIsHttps(storageType);
|
|
43
|
+
// 使用国际化文本或传入的文本
|
|
44
|
+
const uploadFileLabel = label || t.uploadFile;
|
|
45
|
+
const uploadBtnTitle = btnTitle || t.clickToUpload;
|
|
46
|
+
const uploadSupportText = uploadTipText || t.supportBatchUpload;
|
|
41
47
|
const [fileIDList, setfileIDList] = React.useState(() => {
|
|
42
48
|
let defaultVal = defaultValue;
|
|
43
49
|
let val = value;
|
|
@@ -93,7 +99,7 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
93
99
|
const handleBefore = async (file, fileList, isAccepted, error) => {
|
|
94
100
|
if (fileList.length + fileIDList.length > maxUploadCount) {
|
|
95
101
|
alertErrorMessage({
|
|
96
|
-
message:
|
|
102
|
+
message: t.fileTotalExceed.replace('{count}', `${maxUploadCount}`),
|
|
97
103
|
icon: 'error',
|
|
98
104
|
});
|
|
99
105
|
return Promise.reject(false);
|
|
@@ -102,10 +108,10 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
102
108
|
try {
|
|
103
109
|
const errorList = [];
|
|
104
110
|
if (error.find((item) => (item === null || item === void 0 ? void 0 : item.code) === 'file-invalid-type')) {
|
|
105
|
-
errorList.push(
|
|
111
|
+
errorList.push(t.fileTypeError);
|
|
106
112
|
}
|
|
107
113
|
if (error.find((item) => (item === null || item === void 0 ? void 0 : item.code) === 'file-too-large')) {
|
|
108
|
-
errorList.push(
|
|
114
|
+
errorList.push(t.fileSizeExceed.replace('{size}', `${maxSizeLimit}`));
|
|
109
115
|
}
|
|
110
116
|
alertErrorMessage({
|
|
111
117
|
message: errorList.join(', '),
|
|
@@ -204,11 +210,11 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
204
210
|
isEdit,
|
|
205
211
|
events,
|
|
206
212
|
fileSizeObj,
|
|
207
|
-
}, "data-testid": "button-up", children: _jsxs("div", { className: `${CLASS_PREFIX} ${readOnly ? `${CLASS_PREFIX}__readOnly` : ''}`, "data-testid": "UploadFilePc", children: [isEdit && (_jsx("div", { className: `${CLASS_PREFIX}__input-box`, children: btnDisabled ? (readOnly ? null : (_jsx(WdButton, { disabled: true, text: btnTitle, theme: "secondary", variant: "outline" }))) : (_jsxs(Upload, { ...uploadProps, beforeUpload: handleBefore, "data-testid": "Upload", children: [_jsx(WdButton, { className: `${CLASS_PREFIX}__btn--weak`, text:
|
|
213
|
+
}, "data-testid": "button-up", children: _jsxs("div", { className: `${CLASS_PREFIX} ${readOnly ? `${CLASS_PREFIX}__readOnly` : ''}`, "data-testid": "UploadFilePc", children: [isEdit && (_jsx("div", { className: `${CLASS_PREFIX}__input-box`, children: btnDisabled ? (readOnly ? null : (_jsx(WdButton, { disabled: true, text: btnTitle, theme: "secondary", variant: "outline" }))) : (_jsxs(Upload, { ...uploadProps, beforeUpload: handleBefore, "data-testid": "Upload", children: [_jsx(WdButton, { className: `${CLASS_PREFIX}__btn--weak`, text: uploadBtnTitle, theme: "secondary", variant: "outline" }), !single && _jsx(WdText, { text: uploadSupportText, className: `${CLASS_PREFIX}__btn-descripe` })] })) })), _jsxs(List, { split: "divide", children: [_jsx(List.Item, { children: _jsxs("div", { className: `${CLASS_PREFIX}--item ${CLASS_PREFIX}--item-header`, children: [_jsx("div", { className: `${CLASS_PREFIX}--item-title ${CLASS_PREFIX}--item-label`, children: t.fileName }), formType !== 'read' && (_jsx("div", { className: `${CLASS_PREFIX}--item-size ${CLASS_PREFIX}--item-label`, children: t.fileSize })), _jsx("div", { className: `${CLASS_PREFIX}--item-status ${CLASS_PREFIX}--item-label`, children: t.fileStatus }), _jsx("div", { className: `${CLASS_PREFIX}--item-action ${CLASS_PREFIX}--item-label`, children: t.fileOperation })] }) }), fileIDList.map((d) => (_jsx(List.Item, { children: _jsx(TcbFileEcho, { disabled: disabled, fileID: d, formType: formType }) }, d))), fileList.map((item) => (_jsx(List.Item, { children: _jsx(TcbFileUpload, { disabled: disabled, file: item, formType: formType, id: id }) }, item === null || item === void 0 ? void 0 : item._uuid))), !readOnly && isEdit && fileIDList.length === 0 && fileList.length === 0 && (_jsx(List.Item, { className: `${CLASS_PREFIX}--item-empty`, children: _jsxs("div", { className: `${CLASS_PREFIX}--item`, children: [t.clickTopBtn.replace('{btn}', uploadBtnTitle), " "] }) }))] })] }) }) }), decorator)({
|
|
208
214
|
id,
|
|
209
215
|
className: cls,
|
|
210
216
|
style,
|
|
211
|
-
label: labelVisible ?
|
|
217
|
+
label: labelVisible ? uploadFileLabel : null,
|
|
212
218
|
layout,
|
|
213
219
|
multiCell: false,
|
|
214
220
|
requiredFlag,
|
|
@@ -290,6 +296,8 @@ const TcbFileUpload = ({ id, file, disabled, formType }) => {
|
|
|
290
296
|
*/
|
|
291
297
|
const UploadFileStatus = ({ status = '2', percent = 0 }) => {
|
|
292
298
|
var _a;
|
|
299
|
+
const t = useTranslation();
|
|
300
|
+
const statusMap = getStatusMap(t);
|
|
293
301
|
if (status == '1' && percent) {
|
|
294
302
|
return (_jsxs(_Fragment, { children: [_jsx(Icon, { type: "loading" }), "\u4E0A\u4F20", percent, "% ..."] }));
|
|
295
303
|
}
|
|
@@ -300,15 +308,16 @@ const UploadFileStatus = ({ status = '2', percent = 0 }) => {
|
|
|
300
308
|
* props: { status, fileID, uuid, src, onChange }
|
|
301
309
|
*/
|
|
302
310
|
const UploadFileAction = ({ title = 'downfile', status = '0', fileID = '', uuid = '', src = '', file = null, onReLoad = null, onCancel = null, disabled, readOnly, }) => {
|
|
311
|
+
const t = useTranslation();
|
|
303
312
|
const { onChange, downloadVisible, deleteVisible, isEdit } = React.useContext(FileContext) || {};
|
|
304
313
|
// 操作列按钮-删除
|
|
305
314
|
const renderDelete = () => isEdit &&
|
|
306
315
|
deleteVisible &&
|
|
307
|
-
!readOnly && (_jsx(WdButton, { text:
|
|
316
|
+
!readOnly && (_jsx(WdButton, { text: t.delete, size: "sm", variant: "link", disabled: disabled, events: { tap: () => onChange === null || onChange === void 0 ? void 0 : onChange({ fileID, uuid, type: 'delete', url: src }) } }));
|
|
308
317
|
// 操作列按钮-取消
|
|
309
|
-
const renderCancel = () => isEdit && _jsx(WdButton, { events: { tap: () => onCancel === null || onCancel === void 0 ? void 0 : onCancel(uuid) }, variant: "link", text:
|
|
318
|
+
const renderCancel = () => isEdit && _jsx(WdButton, { events: { tap: () => onCancel === null || onCancel === void 0 ? void 0 : onCancel(uuid) }, variant: "link", text: t.cancelText, size: "sm" });
|
|
310
319
|
// 操作列按钮-重新上传
|
|
311
|
-
const renderReLoad = () => isEdit && (_jsx(WdButton, { text:
|
|
320
|
+
const renderReLoad = () => isEdit && (_jsx(WdButton, { text: t.reupload, size: "sm", variant: "link", events: {
|
|
312
321
|
tap: () => {
|
|
313
322
|
onReLoad === null || onReLoad === void 0 ? void 0 : onReLoad(file);
|
|
314
323
|
},
|
|
@@ -316,7 +325,7 @@ const UploadFileAction = ({ title = 'downfile', status = '0', fileID = '', uuid
|
|
|
316
325
|
// 操作列按钮-下载
|
|
317
326
|
const renderDownLoad = () => {
|
|
318
327
|
return (downloadVisible &&
|
|
319
|
-
!isWebInMiniprogram() && (_jsx("a", { download: title, href: src, target: "_blank", rel: "noreferrer", children: _jsx(WdButton, { text:
|
|
328
|
+
!isWebInMiniprogram() && (_jsx("a", { download: title, href: src, target: "_blank", rel: "noreferrer", children: _jsx(WdButton, { text: t.download, size: "sm", variant: "link", children: t.download }) })));
|
|
320
329
|
};
|
|
321
330
|
switch (status) {
|
|
322
331
|
case '0':
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from 'tea-component';
|
|
3
|
+
import { useTranslation } from '../../../../utils/i18n/translation';
|
|
3
4
|
export const DepartBreadcrumb = (props) => {
|
|
4
5
|
const { data, onBreadCrumbClick } = props;
|
|
6
|
+
const t = useTranslation();
|
|
5
7
|
return (_jsxs("div", { className: "weda-select-user-dept-breadcrumb", children: [_jsx(Button, { type: "link", className: !(Array.isArray(data) && data.length > 0)
|
|
6
8
|
? 'weda-select-user-dept-breadcrumb__item is-selected'
|
|
7
|
-
: 'weda-select-user-dept-breadcrumb__item', onClick: () => onBreadCrumbClick(), children:
|
|
9
|
+
: 'weda-select-user-dept-breadcrumb__item', onClick: () => onBreadCrumbClick(), children: t.organization }), (data || []).map((item, index) => (_jsxs(_Fragment, { children: [_jsx("span", { className: "weda-select-user-dept-breadcrumb__separate" }), _jsx(Button, { type: "link", className: index === data.length - 1
|
|
8
10
|
? 'weda-select-user-dept-breadcrumb__item is-selected'
|
|
9
11
|
: 'weda-select-user-dept-breadcrumb__item', onClick: () => onBreadCrumbClick(item), children: item === null || item === void 0 ? void 0 : item.content })] })))] }));
|
|
10
12
|
};
|
package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ export declare function DepartTreeSelectPC({ id, className, style, label, labelV
|
|
|
5
5
|
id: any;
|
|
6
6
|
className: any;
|
|
7
7
|
style: any;
|
|
8
|
-
label
|
|
8
|
+
label: any;
|
|
9
9
|
labelVisible?: boolean;
|
|
10
|
-
placeholder
|
|
10
|
+
placeholder: any;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
layout?: string;
|
|
13
13
|
requiredFlag?: boolean;
|
|
@@ -7,8 +7,12 @@ import { defaultRequest } from '../../common/fetch-data-service';
|
|
|
7
7
|
import '../index.css';
|
|
8
8
|
import { OrgModalPC } from './org-modal-pc';
|
|
9
9
|
import { InputTags } from '../../component/input-tags';
|
|
10
|
+
import { useTranslation } from '../../../../../utils/i18n/translation';
|
|
10
11
|
export const OrgTreeContext = React.createContext(null);
|
|
11
|
-
export function DepartTreeSelectPC({ id, className, style, label
|
|
12
|
+
export function DepartTreeSelectPC({ id, className, style, label, labelVisible = true, placeholder, disabled = false, layout = 'horizontal', requiredFlag = false, size = 'l', multiple = false, decorator, request = defaultRequest, confirmOrgList, setConfirmOrgList, selectedOrgList, setSelectedOrgList, errorInfo, setErrorInfo, treeData, orgList, error, defaultExpandedIds, readOnly, }) {
|
|
13
|
+
const t = useTranslation();
|
|
14
|
+
const departmentLabel = label || t.departmentLabel;
|
|
15
|
+
const departmentPlaceholder = placeholder || t.departmentPlaceholder;
|
|
12
16
|
const [open, setOpen] = useState(false);
|
|
13
17
|
// 外层组件类
|
|
14
18
|
const cls = classNames({
|
|
@@ -33,20 +37,20 @@ export function DepartTreeSelectPC({ id, className, style, label = '部门选择
|
|
|
33
37
|
confirmOrgList,
|
|
34
38
|
defaultExpandedIds,
|
|
35
39
|
request,
|
|
36
|
-
}, children: readOnly ? (_jsx(InputTags, { tagsList: confirmOrgList, placeholder:
|
|
40
|
+
}, children: readOnly ? (_jsx(InputTags, { tagsList: confirmOrgList, placeholder: departmentPlaceholder, multiple: multiple, errInfo: errorInfo, disabled: disabled, readOnly: readOnly, onClose: (e, item) => {
|
|
37
41
|
setConfirmOrgList(confirmOrgList.filter((l) => (l === null || l === void 0 ? void 0 : l.id) !== (item === null || item === void 0 ? void 0 : item.id)));
|
|
38
42
|
e.stopPropagation();
|
|
39
43
|
} })) : (_jsx(Dropdown, { className: classNames(`weda-ui-org-selected`, `size-${size}`), open: open, onOpenChange: (open) => {
|
|
40
44
|
setOpen(open);
|
|
41
45
|
setErrorInfo({ errorStatus: false, errorMessage: null });
|
|
42
|
-
}, appearance: 'button', button: _jsx(InputTags, { tagsList: confirmOrgList, placeholder:
|
|
46
|
+
}, appearance: 'button', button: _jsx(InputTags, { tagsList: confirmOrgList, placeholder: departmentPlaceholder, multiple: multiple, errInfo: errorInfo, disabled: disabled, onClose: (e, item) => {
|
|
43
47
|
setConfirmOrgList(confirmOrgList.filter((l) => (l === null || l === void 0 ? void 0 : l.id) !== (item === null || item === void 0 ? void 0 : item.id)));
|
|
44
48
|
e.stopPropagation();
|
|
45
49
|
} }), overlayClassName: 'weda-ui-user-selected-overlay-hidden', style: { width: '100%' }, disabled: disabled, children: _jsx(OrgModalPC, { open: open, setOpen: setOpen, request: request, onConfirm: onConfirm, onCancel: onCancel, treeData: treeData || [], orgList: orgList || [], treeDataError: error }) })) }) }), decorator)({
|
|
46
50
|
id,
|
|
47
51
|
className: cls,
|
|
48
52
|
style,
|
|
49
|
-
label: labelVisible ?
|
|
53
|
+
label: labelVisible ? departmentLabel : null,
|
|
50
54
|
layout,
|
|
51
55
|
multiCell: false,
|
|
52
56
|
requiredFlag,
|
|
@@ -8,14 +8,16 @@ import isObjectEqual from '../../../../../utils/isObjectEqual';
|
|
|
8
8
|
import { emptyObject, emptyArray } from '../../../../../utils/constant';
|
|
9
9
|
import { DepartTreeSelectH5 as DepartSelectH5 } from '../../departTreeSelect/departTreeSelect.h5';
|
|
10
10
|
import { DepartTreeSelectPC as DepartSelectPC } from './depart-select-pc';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { useTranslation } from '../../../../../utils/i18n/translation';
|
|
12
|
+
import { defaultRequest, getDepartByIds } from '../../common/fetch-data-service';
|
|
13
|
+
import { setFlag, formatTree, parseStrToArr, setChildren } from '../../common/utils';
|
|
13
14
|
import { useDepartData } from '../../hooks/use-depart-data';
|
|
14
15
|
import './style';
|
|
15
16
|
import { useDeepCompareEffect } from '@react-hookz/web';
|
|
16
17
|
export default function DepartTreeSelect(props) {
|
|
17
18
|
const { events = emptyObject, defaultValue = emptyArray, //默认值,支持数组
|
|
18
|
-
confirmValue = '', defaultValueType = 'noneDepart', multiple = false, onChange = null, request = defaultRequest, departmentScope, } = props;
|
|
19
|
+
confirmValue = '', defaultValueType = 'noneDepart', multiple = false, onChange = null, request = defaultRequest, departmentScope, label, placeholder, } = props;
|
|
20
|
+
const t = useTranslation();
|
|
19
21
|
const platform = usePlatform();
|
|
20
22
|
// 两次默认值不同, 需要刷新
|
|
21
23
|
const prevDefaultRef = React.useRef(null);
|
|
@@ -116,6 +118,9 @@ export default function DepartTreeSelect(props) {
|
|
|
116
118
|
triggerEventRef.current = true;
|
|
117
119
|
setConfirmOrgList(v);
|
|
118
120
|
}, []);
|
|
121
|
+
// 使用国际化文本或传入的文本
|
|
122
|
+
const departmentLabel = label || t.departmentLabel;
|
|
123
|
+
const departmentPlaceholder = placeholder || t.departmentPlaceholder;
|
|
119
124
|
const restProps = {
|
|
120
125
|
confirmOrgIds,
|
|
121
126
|
confirmOrgList,
|
|
@@ -128,6 +133,8 @@ export default function DepartTreeSelect(props) {
|
|
|
128
133
|
orgList,
|
|
129
134
|
error,
|
|
130
135
|
defaultExpandedIds,
|
|
136
|
+
label: departmentLabel,
|
|
137
|
+
placeholder: departmentPlaceholder,
|
|
131
138
|
};
|
|
132
139
|
if ((props === null || props === void 0 ? void 0 : props.showType) === 'pc') {
|
|
133
140
|
return _jsx(DepartSelectPC, { ...restProps, ...props });
|
|
@@ -9,9 +9,11 @@ import { fetchSearchOrg } from '../../common/utils';
|
|
|
9
9
|
import debounce from '../../../../../utils/debounce';
|
|
10
10
|
import { WdButton } from '../../../../wd-button';
|
|
11
11
|
import '../index.css';
|
|
12
|
+
import { useTranslation } from '../../../../../utils/i18n/translation';
|
|
12
13
|
export const OrgModalPC = (props) => {
|
|
13
|
-
const { open, setOpen, onCancel, onConfirm, treeData, orgList, treeDataError
|
|
14
|
-
const { multiple, setSelectedOrgList, selectedOrgList, confirmOrgList, defaultExpandedIds
|
|
14
|
+
const { open, setOpen, onCancel, onConfirm, treeData, orgList, treeDataError } = props;
|
|
15
|
+
const { multiple, setSelectedOrgList, selectedOrgList, confirmOrgList, defaultExpandedIds } = React.useContext(OrgTreeContext) || {};
|
|
16
|
+
const t = useTranslation();
|
|
15
17
|
const [searchOrgList, setSearchOrgList] = useState([]);
|
|
16
18
|
// 是否有搜索项
|
|
17
19
|
const [keyWords, setKeyWords] = useState('');
|
|
@@ -55,11 +57,9 @@ export const OrgModalPC = (props) => {
|
|
|
55
57
|
}
|
|
56
58
|
}, [orgList, setSelectedOrgList]);
|
|
57
59
|
const btnDisabled = selectedOrgList.length === 0 && confirmOrgList.length === 0;
|
|
58
|
-
return (_jsxs(Modal, { disableEscape: true, maskClosable: false, visible: open, caption:
|
|
60
|
+
return (_jsxs(Modal, { disableEscape: true, maskClosable: false, visible: open, caption: t.selectDepartment, onClose: () => setOpen(false), className: "weda-ui weda-ui-user-select-modal", children: [_jsxs(Modal.Body, { children: [_jsxs("div", { className: "weda-ui-user-select-container", children: [_jsx(ModalSearch, { searchList: searchOrgList, errInfo: errInfo, loading: loading, keyWords: keyWords, selectedList: selectedOrgList, multiple: multiple, setSelectedList: setSelectedOrgList, setSelectedIds: handleSelectedIdsChange, selectedIds: selectedIds, onSearch: (key) => onSearch(key), onReset: () => setSearchOrgList([]), isUser: false }), keyWords.length === 0 && (_jsx(_Fragment, { children: _jsx("div", { className: "weda-ui-user-select-container-list", children: _jsx("div", { className: "weda-ui-user-select-container-list__start", children: _jsx(OrgTree, { selectedOrgId: selectedIds, mutiple: multiple,
|
|
59
61
|
//setSelectedOrgId={setSelectedOrgId}
|
|
60
62
|
isUser: false, treeData: treeData, treeDataError: treeDataError, selectable: true, defaultExpandedIds: defaultExpandedIds, onActive: (ids) => handleSelectedIdsChange(ids) }) }) }) }))] }), _jsx(SelectedList, { selectedList: selectedOrgList, isUser: false, onClose: (item) => {
|
|
61
63
|
setSelectedOrgList(selectedOrgList.filter((data) => data.id !== (item === null || item === void 0 ? void 0 : item.id)));
|
|
62
|
-
} })] }), _jsxs(Modal.Footer, { children: [_jsx(WdButton, { text:
|
|
63
|
-
? '请选择部门'
|
|
64
|
-
: null, children: _jsx("span", { children: _jsx(WdButton, { text: "\u786E\u5B9A", events: { tap: onConfirm }, disabled: btnDisabled }) }) })] })] }));
|
|
64
|
+
} })] }), _jsxs(Modal.Footer, { children: [_jsx(WdButton, { text: t.cancelText, events: { tap: onCancel }, theme: "secondary", variant: "outline", className: "wd-btn__margin-right" }), _jsx(Bubble, { content: selectedOrgList.length === 0 && confirmOrgList.length === 0 ? t.departmentPlaceholder : null, children: _jsx("span", { children: _jsx(WdButton, { text: t.okText, events: { tap: onConfirm }, disabled: btnDisabled }) }) })] })] }));
|
|
65
65
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Status } from 'tea-component';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { useTranslation } from '../../../../utils/i18n/translation';
|
|
4
|
+
export const ErrorStatus = ({ description, title }) => {
|
|
5
|
+
const t = useTranslation();
|
|
6
|
+
return _jsx(Status, { icon: 'blank', size: 's', title: title !== null && title !== void 0 ? title : t.loadErrorText, description: description });
|
|
5
7
|
};
|
|
6
8
|
export const NullStatus = ({ title = null, size, description = null }) => {
|
|
7
|
-
return
|
|
9
|
+
return _jsx(Status, { icon: 'blank', size: size, title: title, description: description });
|
|
8
10
|
};
|
|
9
11
|
export const LoadingStatus = () => {
|
|
10
|
-
|
|
12
|
+
const t = useTranslation();
|
|
13
|
+
return _jsx(Status, { icon: 'loading', size: 's', description: t.loadingText });
|
|
11
14
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classNames from '../../../../utils/classnames';
|
|
3
|
+
import { useTranslation } from '../../../../utils/i18n/translation';
|
|
3
4
|
export const ModalSearchH5 = (props) => {
|
|
4
5
|
const { value, onChange, onCancel, isSearch, onFocus } = props;
|
|
6
|
+
const t = useTranslation();
|
|
5
7
|
return (_jsxs("div", { className: classNames({
|
|
6
8
|
'weda-select-user-dept__dialog-search-h5': true,
|
|
7
9
|
'weda-select-user-dept__dialog-search-focus': isSearch,
|
|
@@ -13,5 +15,5 @@ export const ModalSearchH5 = (props) => {
|
|
|
13
15
|
}, className: "weda-select-user-dept__dialog-search-input" }), _jsxs("div", { className: classNames({
|
|
14
16
|
'weda-select-user-dept__dialog-label': true,
|
|
15
17
|
'weda-select-user-dept__dialog-label-value': value,
|
|
16
|
-
}), children: [_jsx("span", { className: "search-icon" }), _jsx("span", { className: "search-placeholder", children:
|
|
18
|
+
}), children: [_jsx("span", { className: "search-icon" }), _jsx("span", { className: "search-placeholder", children: t.searchText })] }), value && value.length > 0 && (_jsx("div", { className: "weda-select-user-dept__dialog-input-clear", onClick: () => onChange(''), children: _jsx("p", { className: "weda-select-user-dept__dialog-input-clear-close" }) }))] }), _jsx("span", { className: "weda-select-user-dept__dialog-search-cancel", onClick: onCancel, children: t.cancelText })] }));
|
|
17
19
|
};
|
|
@@ -2,7 +2,10 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { SearchBox } from 'tea-component';
|
|
3
3
|
import { UserOrgList } from './user-org-list';
|
|
4
4
|
import './index.css';
|
|
5
|
+
import { useTranslation } from '../../../../utils/i18n/translation';
|
|
5
6
|
export const ModalSearch = (props) => {
|
|
6
7
|
const { searchList, onReset, keyWords, onSearch, loading, errInfo, selectedList, multiple, setSelectedList, setSelectedIds, selectedIds, isUser = true, } = props;
|
|
7
|
-
|
|
8
|
+
const t = useTranslation();
|
|
9
|
+
const placeholder = isUser ? t.searchText + t.member : t.searchText + t.department;
|
|
10
|
+
return (_jsxs(_Fragment, { children: [_jsx(SearchBox, { "data-testid": "SearchBox", onChange: onSearch, onSearch: (key) => onSearch(key), onClear: () => onReset(), placeholder: placeholder }), keyWords.length !== 0 && (_jsx("div", { className: "weda-ui-user-select-container-list__end ", children: _jsx(UserOrgList, { isUser: isUser, userOrgList: searchList, isOrg: true, loading: loading, errorStatus: errInfo === null || errInfo === void 0 ? void 0 : errInfo.errorStatus, errorMessage: errInfo === null || errInfo === void 0 ? void 0 : errInfo.errorMessage, selectedList: selectedList, multiple: multiple, setSelectedIds: setSelectedIds, setSelectedList: setSelectedList, selectedIds: selectedIds, secondDisplay: undefined }) }))] }));
|
|
8
11
|
};
|
|
@@ -11,7 +11,7 @@ import { UserListH5 } from './user-select-h5/user-list-h5';
|
|
|
11
11
|
import { getNode, getBreadNode, getPropertiesList } from '../common/utils';
|
|
12
12
|
import debounce from '../../../../utils/debounce';
|
|
13
13
|
import { fetchSearchUser, fetchUserList } from '../common/fetch-data-service';
|
|
14
|
-
|
|
14
|
+
import { useTranslation } from '../../../../utils/i18n/translation';
|
|
15
15
|
export const ModalSelectH5 = (props) => {
|
|
16
16
|
var _a;
|
|
17
17
|
const { open, onClose, onConfirm, treeData, multiple = false, errorInfo, setErrorInfo, selectedUserList, setSelectedUserList, confirmUserList, request, filterParams, pageNo, setPageNo, pageSize, treeDataError, secondDisplay, } = props;
|
|
@@ -26,6 +26,8 @@ export const ModalSelectH5 = (props) => {
|
|
|
26
26
|
const [userList, setUserList] = useState([]);
|
|
27
27
|
const [isEnd, setIsEnd] = useState(false);
|
|
28
28
|
const treeNode = getNode(treeData, 'root', 'id');
|
|
29
|
+
const t = useTranslation();
|
|
30
|
+
const appendNode = { id: 'appendNode', content: t.directMember };
|
|
29
31
|
useEffect(() => {
|
|
30
32
|
// 仅执行一次
|
|
31
33
|
if (treeData) {
|
|
@@ -102,10 +104,8 @@ export const ModalSelectH5 = (props) => {
|
|
|
102
104
|
setListLoading(false);
|
|
103
105
|
if ((res === null || res === void 0 ? void 0 : res.total) > 0) {
|
|
104
106
|
appendNode['children'] = res === null || res === void 0 ? void 0 : res.records;
|
|
105
|
-
appendNode['content'] =
|
|
106
|
-
setShowTreeData((item === null || item === void 0 ? void 0 : item.children)
|
|
107
|
-
? [appendNode].concat(item === null || item === void 0 ? void 0 : item.children)
|
|
108
|
-
: [appendNode]);
|
|
107
|
+
appendNode['content'] = t.directMember + (res === null || res === void 0 ? void 0 : res.total);
|
|
108
|
+
setShowTreeData((item === null || item === void 0 ? void 0 : item.children) ? [appendNode].concat(item === null || item === void 0 ? void 0 : item.children) : [appendNode]);
|
|
109
109
|
}
|
|
110
110
|
else {
|
|
111
111
|
setShowTreeData((item === null || item === void 0 ? void 0 : item.children) ? [].concat(item === null || item === void 0 ? void 0 : item.children) : []);
|
|
@@ -132,8 +132,7 @@ export const ModalSelectH5 = (props) => {
|
|
|
132
132
|
if (!item)
|
|
133
133
|
return;
|
|
134
134
|
//避免重复点击请求
|
|
135
|
-
if ((item === null || item === void 0 ? void 0 : item.id) !== ((_a = breadCrumbData[breadCrumbData.length - 1]) === null || _a === void 0 ? void 0 : _a.id) ||
|
|
136
|
-
showTreeData.length === 0) {
|
|
135
|
+
if ((item === null || item === void 0 ? void 0 : item.id) !== ((_a = breadCrumbData[breadCrumbData.length - 1]) === null || _a === void 0 ? void 0 : _a.id) || showTreeData.length === 0) {
|
|
137
136
|
setListLoading(true);
|
|
138
137
|
setIsEnd(false);
|
|
139
138
|
// 部门目录
|
|
@@ -197,15 +196,13 @@ export const ModalSelectH5 = (props) => {
|
|
|
197
196
|
return (_jsxs(Modal, { disableEscape: true, maskClosable: false, visible: open, onClose: () => {
|
|
198
197
|
onrest();
|
|
199
198
|
onClose();
|
|
200
|
-
}, destroyOnClose: true, className: `weda-ui weda-select-user-dept__dialog`, children: [_jsxs(Modal.Body, { className: ((_a = selectedUserList[0]) === null || _a === void 0 ? void 0 : _a.userId) ? 'is-selected-value' : '', children: [_jsx("div", { className: "weda-select-user-dept__dialog-header", children:
|
|
199
|
+
}, destroyOnClose: true, className: `weda-ui weda-select-user-dept__dialog`, children: [_jsxs(Modal.Body, { className: ((_a = selectedUserList[0]) === null || _a === void 0 ? void 0 : _a.userId) ? 'is-selected-value' : '', children: [_jsx("div", { className: "weda-select-user-dept__dialog-header", children: t.memberSelect }), _jsx(ModalSearchH5, { value: keyWords, onChange: (key) => {
|
|
201
200
|
setKeyWords(key);
|
|
202
201
|
onSearch(key);
|
|
203
202
|
}, onCancel: cancleSearch, isSearch: isSearch, onFocus: (e) => {
|
|
204
203
|
handleFocus(true);
|
|
205
204
|
e.stopPropagation();
|
|
206
|
-
} }), (errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.errorStatus) ? (_jsx(ErrorStatus, { description: (errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.errorMessage) || null })) : (_jsx(_Fragment, { children: treeData && treeData.length > 0 && !pageLoading ? (_jsxs("div", { className: "weda-select-user-dept__dialog-content", children: [!(keyWords && keyWords.length > 0) && (_jsx(DepartBreadcrumb, { data: breadCrumbData, onBreadCrumbClick: (item) => onBreadCrumbClick(item) })), listLoading ? (_jsx(_Fragment, { children: _jsx("div", { className: "weda-select-user-dept__dialog-list", children: _jsx(LoadingStatus, {}) }) })) : (_jsx(_Fragment, { children: showTreeData &&
|
|
207
|
-
showTreeData.length > 0 &&
|
|
208
|
-
!(keyWords && keyWords.length > 0) ? (_jsx(OrgTreeH5, { treeData: showTreeData, loading: loading, loadItem: (item) => loadItem(item), treeDataError: treeDataError, onTouchMove: onTouchMove })) : (_jsx(UserListH5, { userList: userList, selectedList: selectedUserList, setSelectedList: setSelectedUserList, loading: loading, multiple: multiple, isEnd: isEnd, isSearch: keyWords ? true : false, onScrollBottom: onScrollBottom, onTouchMove: onTouchMove, secondDisplay: secondDisplay })) }))] })) : (_jsx("div", { className: "weda-select-user-dept__dialog-list", children: _jsx(LoadingStatus, {}) })) }))] }), _jsx(Modal.Footer, { children: _jsx(SelectedListH5, { selectedList: selectedUserList, setSelectedList: setSelectedUserList, confirmUserList: confirmUserList, secondDisplay: secondDisplay, onClose: () => {
|
|
205
|
+
} }), (errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.errorStatus) ? (_jsx(ErrorStatus, { description: (errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.errorMessage) || null })) : (_jsx(_Fragment, { children: treeData && treeData.length > 0 && !pageLoading ? (_jsxs("div", { className: "weda-select-user-dept__dialog-content", children: [!(keyWords && keyWords.length > 0) && (_jsx(DepartBreadcrumb, { data: breadCrumbData, onBreadCrumbClick: (item) => onBreadCrumbClick(item) })), listLoading ? (_jsx(_Fragment, { children: _jsx("div", { className: "weda-select-user-dept__dialog-list", children: _jsx(LoadingStatus, {}) }) })) : (_jsx(_Fragment, { children: showTreeData && showTreeData.length > 0 && !(keyWords && keyWords.length > 0) ? (_jsx(OrgTreeH5, { treeData: showTreeData, loading: loading, loadItem: (item) => loadItem(item), treeDataError: treeDataError, onTouchMove: onTouchMove })) : (_jsx(UserListH5, { userList: userList, selectedList: selectedUserList, setSelectedList: setSelectedUserList, loading: loading, multiple: multiple, isEnd: isEnd, isSearch: keyWords ? true : false, onScrollBottom: onScrollBottom, onTouchMove: onTouchMove, secondDisplay: secondDisplay })) }))] })) : (_jsx("div", { className: "weda-select-user-dept__dialog-list", children: _jsx(LoadingStatus, {}) })) }))] }), _jsx(Modal.Footer, { children: _jsx(SelectedListH5, { selectedList: selectedUserList, setSelectedList: setSelectedUserList, confirmUserList: confirmUserList, secondDisplay: secondDisplay, onClose: () => {
|
|
209
206
|
onrest();
|
|
210
207
|
onClose();
|
|
211
208
|
}, onConfirm: () => {
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Tree } from 'tea-component';
|
|
3
3
|
import { LoadingStatus, ErrorStatus, NullStatus } from './error-tips';
|
|
4
4
|
import './index.css';
|
|
5
|
+
import { useTranslation } from '../../../../utils/i18n/translation';
|
|
5
6
|
export const OrgTree = (props) => {
|
|
6
7
|
const { selectedOrgId = [], treeData, treeDataError, onActive,
|
|
7
8
|
//是否展示 Checkbox
|
|
@@ -10,6 +11,7 @@ export const OrgTree = (props) => {
|
|
|
10
11
|
mutiple = false,
|
|
11
12
|
//默认展开的节点
|
|
12
13
|
defaultExpandedIds = [], isUser = true, } = props;
|
|
14
|
+
const t = useTranslation();
|
|
13
15
|
// 切换选中组织节点
|
|
14
16
|
const onChange = (ids, checked, nodeId, selectable = true) => {
|
|
15
17
|
if (isUser || selectable) {
|
|
@@ -46,6 +48,6 @@ export const OrgTree = (props) => {
|
|
|
46
48
|
height: 320 }));
|
|
47
49
|
}
|
|
48
50
|
else {
|
|
49
|
-
return _jsx(NullStatus, { description:
|
|
51
|
+
return _jsx(NullStatus, { description: t.emptyText, size: 's' });
|
|
50
52
|
}
|
|
51
53
|
};
|