@cloudbase/weda-ui 3.15.8 → 3.17.0

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.
Files changed (69) hide show
  1. package/dist/configs/components/container.js +0 -3
  2. package/dist/configs/components/wd-ad.d.ts +4 -0
  3. package/dist/configs/components/wd-ad.js +23 -0
  4. package/dist/configs/components/wd-cascader.d.ts +4 -0
  5. package/dist/configs/components/wd-checkbox.d.ts +4 -0
  6. package/dist/configs/components/wd-code-editor.d.ts +4 -0
  7. package/dist/configs/components/wd-date-range.d.ts +4 -0
  8. package/dist/configs/components/wd-date.d.ts +4 -0
  9. package/dist/configs/components/wd-department.d.ts +6 -0
  10. package/dist/configs/components/wd-department.js +1 -1
  11. package/dist/configs/components/wd-form-arr.d.ts +4 -0
  12. package/dist/configs/components/wd-form-detail.d.ts +4 -0
  13. package/dist/configs/components/wd-form-obj.d.ts +4 -0
  14. package/dist/configs/components/wd-input-email.d.ts +4 -0
  15. package/dist/configs/components/wd-input-number.d.ts +4 -0
  16. package/dist/configs/components/wd-input-phone.d.ts +4 -0
  17. package/dist/configs/components/wd-input-url.d.ts +4 -0
  18. package/dist/configs/components/wd-input.d.ts +4 -0
  19. package/dist/configs/components/wd-location.d.ts +4 -0
  20. package/dist/configs/components/wd-member.d.ts +4 -0
  21. package/dist/configs/components/wd-radio.d.ts +4 -0
  22. package/dist/configs/components/wd-rating.d.ts +4 -0
  23. package/dist/configs/components/wd-region.d.ts +4 -0
  24. package/dist/configs/components/wd-rich-text.d.ts +4 -0
  25. package/dist/configs/components/wd-select-multiple.d.ts +17 -8
  26. package/dist/configs/components/wd-select-multiple.js +43 -10
  27. package/dist/configs/components/wd-select.d.ts +17 -8
  28. package/dist/configs/components/wd-select.js +85 -8
  29. package/dist/configs/components/wd-switch.d.ts +4 -0
  30. package/dist/configs/components/wd-tag-select.d.ts +4 -0
  31. package/dist/configs/components/wd-tag.d.ts +4 -0
  32. package/dist/configs/components/wd-textarea.d.ts +4 -0
  33. package/dist/configs/components/wd-time.d.ts +4 -0
  34. package/dist/configs/components/wd-upload-file.d.ts +4 -0
  35. package/dist/configs/components/wd-upload-image.d.ts +195 -15
  36. package/dist/configs/components/wd-upload-image.js +125 -6
  37. package/dist/configs/index.d.ts +536 -20
  38. package/dist/configs/type-utils/type-form.d.ts +4 -0
  39. package/dist/configs/type-utils/type-form.js +4 -0
  40. package/dist/configs/type-utils/x-runtime-default.d.ts +3 -0
  41. package/dist/configs/type-utils/x-runtime-default.js +3 -0
  42. package/dist/configs/utils/field.d.ts +1 -0
  43. package/dist/configs/utils/field.js +95 -0
  44. package/dist/style/weda-ui.min.css +1 -1
  45. package/dist/web/components/form/uploader/index.d.ts +1 -0
  46. package/dist/web/components/form/uploader/index.js +7 -4
  47. package/dist/web/components/form/uploader/upload/index.d.ts +26 -0
  48. package/dist/web/components/form/uploader/upload/index.js +200 -0
  49. package/dist/web/components/form/uploader/uploader.h5.d.ts +6 -1
  50. package/dist/web/components/form/uploader/uploader.h5.js +26 -94
  51. package/dist/web/components/form/uploader/uploader.pc.d.ts +1 -1
  52. package/dist/web/components/form/uploader/uploader.pc.js +30 -100
  53. package/dist/web/components/form/uploader/util.d.ts +16 -0
  54. package/dist/web/components/form/uploader/util.js +106 -5
  55. package/dist/web/components/form/uploaderFile/uploadFile.h5.js +3 -5
  56. package/dist/web/components/form/uploaderFile/uploadFile.pc.js +3 -5
  57. package/dist/web/components/uploaderView/index.js +1 -1
  58. package/dist/web/components/wd-ad/wd-ad.js +2 -4
  59. package/dist/web/components/wd-select/relationSelect/relationSelect.js +2 -2
  60. package/dist/web/components/wd-select/select/index.js +3 -2
  61. package/dist/web/components/wd-select/select/selectUI.js +3 -3
  62. package/dist/web/components/wd-select/wd-select.d.ts +2 -0
  63. package/dist/web/components/wd-select/wd-select.js +9 -3
  64. package/dist/web/components/wd-select-multiple/wd-select-multiple.d.ts +2 -0
  65. package/dist/web/components/wd-select-multiple/wd-select-multiple.js +9 -3
  66. package/dist/web/components/wd-upload-image/wd-upload-image.js +14 -4
  67. package/package.json +5 -5
  68. package/dist/web/components/form/uploader/useUploadFile.d.ts +0 -16
  69. package/dist/web/components/form/uploader/useUploadFile.js +0 -99
@@ -2,46 +2,31 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import * as React from 'react';
3
3
  import weui from '../../../utils/weui';
4
4
  import classNames from '../../../utils/classnames';
5
- import { browserEnv, alertErrorMessage } from '../../../utils/platform';
5
+ import { browserEnv } from '../../../utils/platform';
6
6
  import { IMAGE_TYPES, encodeConvert } from './uploader.pc';
7
7
  import { useTempUrl } from '../../../utils/hooks/use-cloud-id-temp-url';
8
- import { toBase64Uri } from '../../../utils/file2base64';
9
- import { isNil } from '../../../utils/lodash';
10
- import { useUploader } from './useUploadFile';
11
- import { errorHandler } from '../../../utils/error';
12
- import { checkAcceptedFiles } from './util';
8
+ import { Upload } from './upload';
13
9
  /**
14
10
  * H5端
15
11
  */
16
12
  export function ImageUploaderH5(props) {
17
13
  var _a;
18
- const { title: label, maxUploadCount, maxSize = 10, acceptTypes = IMAGE_TYPES, className, id, events, layout: _layout, single = false, disabled = false, requiredFlag = false, labelVisible = true, onChange, style, imgTypeCls, readOnly, sourceType, callbacks, } = props;
14
+ const { title: label, maxUploadCount, maxSize = 10, acceptTypes = IMAGE_TYPES, className, id, events, layout: _layout, single = false, disabled = false, requiredFlag = false, labelVisible = true, onChange, style, imgTypeCls, readOnly, sourceType, callbacks, defaultValue, setUploadHandle: outSetUploadHandle, } = props;
19
15
  const layout = _layout !== 'vertical' ? 'horizontal' : 'vertical';
20
16
  const layoutCls = layout === 'horizontal' ? 'weda-formcells weui-flex' : '';
21
17
  const cls = classNames({
22
18
  'weda-ui': true,
23
19
  [className]: className,
24
20
  });
25
- const inputRef = React.useRef(null);
26
- const { tempFile, uploading, upload, getTempFile } = useUploader(props);
21
+ const uploadRef = React.useRef(null);
22
+ const [uploadHandle, setUploadHandle] = React.useState({});
23
+ const tempFile = React.useMemo(() => (uploadHandle === null || uploadHandle === void 0 ? void 0 : uploadHandle.previewFile) || [], [uploadHandle === null || uploadHandle === void 0 ? void 0 : uploadHandle.previewFile]);
24
+ const uploading = tempFile === null || tempFile === void 0 ? void 0 : tempFile.some((i) => i.loading);
27
25
  const finalMaxImgCount = React.useMemo(() => {
28
26
  if (single)
29
27
  return 1;
30
28
  return maxUploadCount;
31
29
  }, [single, maxUploadCount]);
32
- const deleteFile = (file) => {
33
- const fileList = tempFile.filter((d) => d.key !== file.key);
34
- handleChange(fileList, true);
35
- };
36
- const handleChange = (allFile = [], isDelete = false) => {
37
- var _a;
38
- const value = getTempFile(allFile);
39
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
40
- (_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value, isDelete });
41
- };
42
- const accepts = React.useMemo(() => {
43
- return acceptTypes.length === 0 ? IMAGE_TYPES : Array.from(new Set(acceptTypes));
44
- }, [acceptTypes]);
45
30
  const showAdd = React.useMemo(() => {
46
31
  if (single) {
47
32
  // single 模式时,当数组为空且不在上传文件过程中时显示
@@ -49,82 +34,29 @@ export function ImageUploaderH5(props) {
49
34
  }
50
35
  return tempFile.length < maxUploadCount;
51
36
  }, [tempFile, single, maxUploadCount, uploading]);
52
- const uploadChange = async (e) => {
53
- let files = [...e.target.files];
54
- const isAccepted = files.every((i) => checkAcceptedFiles(i, accepts));
55
- if (!isAccepted) {
56
- alertErrorMessage({
57
- message: `上传图片类型错误`,
58
- icon: 'none',
59
- });
60
- return false;
61
- }
62
- if (files.some((f) => f.size > maxSize * 1024 * 1024)) {
63
- alertErrorMessage({
64
- message: `请上传不超过 ${maxSize}M 的图片`,
65
- icon: 'none',
66
- });
67
- return false;
37
+ const setUploadRef = React.useCallback((uploadHandle) => {
38
+ setUploadHandle(uploadHandle);
39
+ // 兼容云后台数据库中使用uploader组件,未传outSetUploadHandle
40
+ if (outSetUploadHandle) {
41
+ outSetUploadHandle(uploadHandle);
68
42
  }
69
- if (files.length > finalMaxImgCount) {
70
- // 防止一下子选择过多文件
71
- alertErrorMessage({
72
- message: `最多只能上传${finalMaxImgCount}张图片,请重新选择`,
73
- icon: 'none',
74
- });
75
- return false;
76
- }
77
- if (tempFile.length + files.length > finalMaxImgCount) {
78
- alertErrorMessage({
79
- message: `最多只能上传${finalMaxImgCount}张图片`,
80
- icon: 'none',
81
- });
82
- return false;
83
- }
84
- let shouldUploadToCos = true;
85
- if (typeof (callbacks === null || callbacks === void 0 ? void 0 : callbacks.beforeUpload) === 'function') {
86
- try {
87
- const base64Uri = await Promise.all(files.map((file) => toBase64Uri(file)));
88
- const ret = await callbacks.beforeUpload({ files, base64Uri });
89
- if (typeof ret === 'boolean') {
90
- shouldUploadToCos = ret;
91
- }
92
- else if (Array.isArray(ret) && ret.every((item) => item instanceof File)) {
93
- files = ret;
94
- }
95
- else if (!isNil(ret)) {
96
- throw new TypeError('web端返回值接受布尔值 / File对象数组');
97
- }
98
- }
99
- catch (err) {
100
- errorHandler({
101
- code: 'BEFORE_UPLOAD_ERROR',
102
- error: err,
103
- });
104
- shouldUploadToCos = false;
105
- }
106
- }
107
- if (shouldUploadToCos === false) {
108
- return;
109
- }
110
- const allFile = await upload(files);
111
- handleChange(allFile);
112
- };
113
- return (_jsx("div", { className: cls, id: id, style: style, children: _jsxs("div", { className: classNames('weui-uploader weui-cells weui-cells_form weda-formcells', layout, layoutCls), children: [_jsx("div", { className: classNames('weui-uploader__hd', layout), children: _jsx(UploaderLabel, { layout: layout, label: label, labelVisible: labelVisible, currentCount: tempFile.length, maxCount: finalMaxImgCount, requiredFlag: requiredFlag }) }), _jsx("div", { className: "weui-uploader__bd", children: _jsxs("ul", { className: "weui-uploader__files", id: "uploaderFiles", children: [(_a = (tempFile !== null && tempFile !== void 0 ? tempFile : [])) === null || _a === void 0 ? void 0 : _a.map((f) => (_jsx(SingleImage, { tempFile: f, deleteBySrc: deleteFile, disabled: disabled || readOnly || sourceType === 'album', imgTypeCls: imgTypeCls }, f === null || f === void 0 ? void 0 : f.key))), tempFile.length < 1 && readOnly && _jsx(_Fragment, { children: "-" }), showAdd && !readOnly && (_jsx("li", { className: `weui-uploader__input-box ${imgTypeCls}`, children: !disabled &&
114
- sourceType !== 'album' &&
115
- (sourceType === 'camera' ? (_jsx("input", { ref: inputRef, onClick: () => {
116
- inputRef.current && (inputRef.current.value = '');
117
- }, "data-testid": "uploaderh5_input", id: "uploaderInput", className: "weui-uploader__input", type: "file", accept: accepts.join(','), multiple: !single && !(browserEnv().android && browserEnv().weixin), capture: true, onChange: uploadChange })) : (_jsx("input", { ref: inputRef, onClick: () => {
118
- inputRef.current && (inputRef.current.value = '');
119
- }, "data-testid": "uploaderh5_input", id: "uploaderInput", className: "weui-uploader__input", type: "file", accept: accepts.join(','), multiple: !single && !(browserEnv().android && browserEnv().weixin), onChange: uploadChange }))) }))] }) })] }) }));
43
+ }, [outSetUploadHandle]);
44
+ const multiple = !single && !(browserEnv().android && browserEnv().weixin);
45
+ return (_jsx("div", { className: cls, id: id, style: style, children: _jsxs("div", { className: classNames('weui-uploader weui-cells weui-cells_form weda-formcells', layout, layoutCls), children: [_jsx("div", { className: classNames('weui-uploader__hd', layout), children: _jsx(UploaderLabel, { layout: layout, label: label, labelVisible: labelVisible, currentCount: tempFile.length, maxCount: finalMaxImgCount, requiredFlag: requiredFlag }) }), _jsx("div", { className: "weui-uploader__bd", children: _jsx(Upload, { ...props, acceptTypes: acceptTypes, events: events, capture: sourceType === 'camera' ? 'capture' : null, multiple: multiple, maxSize: maxSize, maxUploadCount: maxUploadCount, disabled: disabled, onChange: onChange, callbacks: callbacks, ref: uploadRef, value: defaultValue, setUploadHandle: setUploadRef, children: _jsxs("ul", { className: "weui-uploader__files", id: "uploaderFiles", children: [(_a = (tempFile !== null && tempFile !== void 0 ? tempFile : [])) === null || _a === void 0 ? void 0 : _a.map((f) => (_jsx(SingleImage, { tempFile: f, deleteBySrc: (file) => {
46
+ var _a;
47
+ (_a = uploadRef === null || uploadRef === void 0 ? void 0 : uploadRef.current) === null || _a === void 0 ? void 0 : _a.delete({ cloudId: file.cloudId });
48
+ }, disabled: disabled || readOnly || sourceType === 'album', imgTypeCls: imgTypeCls }, f === null || f === void 0 ? void 0 : f.cloudId))), tempFile.length < 1 && readOnly && _jsx(_Fragment, { children: "-" }), showAdd && !readOnly && (_jsx("li", { className: `weui-uploader__input-box ${imgTypeCls}`, children: !disabled && sourceType !== 'album' && (_jsx("span", { onClick: () => {
49
+ var _a;
50
+ (_a = uploadRef === null || uploadRef === void 0 ? void 0 : uploadRef.current) === null || _a === void 0 ? void 0 : _a.upload();
51
+ }, "data-testid": "uploaderh5_input", id: "uploaderInput", className: "weui-uploader__input" })) }))] }) }) })] }) }));
120
52
  }
121
53
  function SingleImage({ deleteBySrc, disabled, imgTypeCls, tempFile }) {
122
- const { progress, loading, realUrl, tempUrl } = tempFile;
54
+ const { progress, loading, cloudId, tempUrl } = tempFile;
123
55
  const cls = classNames({
124
56
  'weui-uploader__file': true,
125
57
  'weui-uploader__file_status': loading,
126
58
  });
127
- const src = realUrl !== null && realUrl !== void 0 ? realUrl : tempUrl;
59
+ const src = cloudId !== null && cloudId !== void 0 ? cloudId : tempUrl;
128
60
  const { data: realSrc, error } = useTempUrl(src);
129
61
  const encodeSrc = encodeConvert(realSrc !== null && realSrc !== void 0 ? realSrc : tempUrl);
130
62
  // 圆括号冲突,加上引号引用url地址
@@ -145,11 +77,11 @@ function SingleImage({ deleteBySrc, disabled, imgTypeCls, tempFile }) {
145
77
  },
146
78
  });
147
79
  };
148
- return (_jsxs("li", { className: `${cls} ${imgTypeCls}`, style: imgStyle, onClick: showGallery, "data-testid": "uploaderh5_imgStyle", children: [error || status ? (_jsx("div", { className: "weui-uploader__file-content", children: error ? (_jsx("i", { role: "img", "aria-label": "\u9519\u8BEF", className: "weui-icon-warn" })) : (_jsx("i", { className: `weui-loading ${imgTypeCls}`, style: { width: 30, height: 30 } })) })) : (false), loading && _jsxs("div", { className: "weui-uploader__file-progress", children: [progress, "%"] })] }));
80
+ return (_jsxs("li", { className: `${cls} ${imgTypeCls}`, style: imgStyle, onClick: showGallery, "data-testid": "uploaderh5_imgStyle", children: [error || status ? (_jsx("div", { className: "weui-uploader__file-content", children: error ? (_jsx("i", { role: "img", "aria-label": "\u9519\u8BEF", className: "weui-icon-warn" })) : (_jsx("i", { className: `weui-loading ${imgTypeCls}`, style: { width: 30, height: 30 } })) })) : (false), loading && _jsxs("div", { className: "weui-uploader__file-progress", children: [progress, "%"] })] }, cloudId));
149
81
  }
150
82
  const UploaderLabel = ({ layout, label, currentCount, maxCount, requiredFlag, labelVisible }) => {
151
83
  if (layout === 'horizontal') {
152
- return (_jsx(React.Fragment, { children: _jsx(_Fragment, { children: labelVisible && (_jsx("div", { className: "weda-formcells__label weui-cell", children: _jsxs("div", { children: [requiredFlag && _jsx("label", { className: "weda-formcells__flag", children: "*" }), _jsx("p", { className: "weui-uploader__title", children: label }), _jsxs("div", { className: "weui-uploader__info", children: [_jsx("span", { id: "uploadCount", children: currentCount }), "/", maxCount] })] }) })) }) }));
84
+ return (_jsx(React.Fragment, { children: labelVisible && (_jsx("div", { className: "weda-formcells__label weui-cell", children: _jsxs("div", { children: [requiredFlag && _jsx("label", { className: "weda-formcells__flag", children: "*" }), _jsx("p", { className: "weui-uploader__title", children: label }), _jsxs("div", { className: "weui-uploader__info", children: [_jsx("span", { id: "uploadCount", children: currentCount }), "/", maxCount] })] }) })) }));
153
85
  }
154
- return (_jsx(React.Fragment, { children: _jsx(_Fragment, { children: labelVisible && (_jsxs("div", { className: "weda-formcells__label weui-cell", children: [_jsxs("div", { className: "weui-uploader__label", children: [requiredFlag && _jsx("label", { className: "weda-formcells__flag", children: "*" }), _jsx("p", { className: "weui-uploader__title", children: label })] }), _jsxs("div", { className: "weui-uploader__info", children: [_jsx("span", { id: "uploadCount", children: currentCount }), "/", maxCount] })] })) }) }));
86
+ return (_jsx(React.Fragment, { children: labelVisible && (_jsxs("div", { className: "weda-formcells__label weui-cell", children: [_jsxs("div", { className: "weui-uploader__label", children: [requiredFlag && _jsx("label", { className: "weda-formcells__flag", children: "*" }), _jsx("p", { className: "weui-uploader__title", children: label })] }), _jsxs("div", { className: "weui-uploader__info", children: [_jsx("span", { id: "uploadCount", children: currentCount }), "/", maxCount] })] })) }));
155
87
  };
@@ -5,7 +5,7 @@ export declare const IMAGE_TYPES: string[];
5
5
  interface TempFileProps {
6
6
  progress?: number;
7
7
  loading?: boolean;
8
- realUrl?: string;
8
+ cloudId?: string;
9
9
  tempUrl?: string;
10
10
  key?: string;
11
11
  }
@@ -1,14 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { Upload, Icon, ErrorTip, ConfigProvider } from 'tea-component';
3
+ import { Icon, ErrorTip, ConfigProvider } from 'tea-component';
4
4
  import { useTempUrl } from '../../../utils/hooks/use-cloud-id-temp-url';
5
- import { toBase64Uri } from '../../../utils/file2base64';
6
- import { isNil } from '../../../utils/lodash';
7
5
  import { errorHandler } from '../../../utils/error';
8
- import { alertErrorMessage } from '../../../utils/platform';
9
6
  import { WdIcon } from '../../wd-icon';
10
- import { useUploader } from './useUploadFile';
11
7
  import { ImagePreview } from '../../wd-image/ImagePreview';
8
+ import { Upload } from './upload';
12
9
  // 默认组件类前缀
13
10
  export const CLASS_PREFIX = 'weda-uploader-pc';
14
11
  // 默认图片类型
@@ -22,117 +19,50 @@ export const IMAGE_TYPES = [
22
19
  'image/gif',
23
20
  ];
24
21
  export function UploaderPCInner(props) {
25
- const { tips = '', btnTitle = '上传图片', maxUploadCount = 9, maxSize = 10, acceptTypes = IMAGE_TYPES, events, single = false, disabled = false, onChange, imgTypeCls, readOnly, sourceType, callbacks, popupContainer: portalContainer, } = props;
26
- const { tempFile, uploading, upload, getTempFile } = useUploader(props);
27
- const handleChange = (allFile = [], isDelete = false) => {
28
- var _a;
29
- const value = getTempFile(allFile);
30
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
31
- (_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value, isDelete });
32
- };
33
- // 方法:上传前,判断图片大小、数量是否满足,取消默认组件的上传事件,用自定义的 tcb 上传方法
34
- const beforeHandle = async (file, fileList, isAccepted, error) => {
35
- const finalMaxImgCount = single ? 1 : maxUploadCount;
36
- if (!isAccepted) {
37
- try {
38
- const errorList = [];
39
- if (error.find((item) => (item === null || item === void 0 ? void 0 : item.code) === 'file-invalid-type')) {
40
- errorList.push('上传图片类型错误');
41
- }
42
- if (error.find((item) => (item === null || item === void 0 ? void 0 : item.code) === 'file-too-large')) {
43
- errorList.push(`上传图片大小不能超过${maxSize}M`);
44
- }
45
- alertErrorMessage({
46
- message: errorList.join(', '),
47
- icon: 'error',
48
- });
49
- }
50
- catch (e) {
51
- errorHandler({
52
- code: 'BEFORE_UPLOAD_ERROR',
53
- error: e,
54
- });
55
- }
56
- return Promise.reject(false);
57
- }
58
- const ids = fileList.filter((f) => !!f.id);
59
- if (ids.length < fileList.length)
60
- return Promise.reject(false);
61
- if (fileList.length > finalMaxImgCount) {
62
- // 防止一下子选择过多文件
63
- alertErrorMessage({
64
- message: `最多只能上传${finalMaxImgCount}张图片,请重新选择`,
65
- icon: 'error',
66
- });
67
- return Promise.reject(false);
68
- }
69
- if (tempFile.length + fileList.length > finalMaxImgCount) {
70
- alertErrorMessage({
71
- message: `最多只能上传${finalMaxImgCount}张图片`,
72
- icon: 'error',
73
- });
74
- return Promise.reject(false);
75
- }
76
- let shouldUploadToCos = true;
77
- if (typeof (callbacks === null || callbacks === void 0 ? void 0 : callbacks.beforeUpload) === 'function') {
78
- try {
79
- const base64Uri = await Promise.all(fileList.map((file) => toBase64Uri(file)));
80
- const ret = await callbacks.beforeUpload({
81
- files: fileList,
82
- base64Uri,
83
- });
84
- if (typeof ret === 'boolean') {
85
- shouldUploadToCos = ret;
86
- }
87
- else if (Array.isArray(ret) && ret.every((item) => item instanceof File)) {
88
- fileList = ret;
89
- }
90
- else if (!isNil(ret)) {
91
- throw new TypeError('web端返回值接受布尔值 / File对象数组');
92
- }
93
- }
94
- catch (err) {
95
- errorHandler({
96
- code: 'BEFORE_UPLOAD_ERROR',
97
- error: err,
98
- });
99
- shouldUploadToCos = false;
100
- }
101
- }
102
- if (shouldUploadToCos === false) {
103
- return Promise.reject(false);
22
+ const { tips = '', btnTitle = '上传图片', maxUploadCount = 9, maxSize = 10, acceptTypes = IMAGE_TYPES, single = false, disabled = false, imgTypeCls, readOnly, sourceType, popupContainer: portalContainer, defaultValue, setUploadHandle: outSetUploadHandle, } = props;
23
+ const uploadRef = React.useRef(null);
24
+ const [uploadHandle, setUploadHandle] = React.useState({});
25
+ const tempFile = React.useMemo(() => (uploadHandle === null || uploadHandle === void 0 ? void 0 : uploadHandle.previewFile) || [], [uploadHandle === null || uploadHandle === void 0 ? void 0 : uploadHandle.previewFile]);
26
+ const uploading = tempFile === null || tempFile === void 0 ? void 0 : tempFile.some((i) => i.loading);
27
+ const setUploadRef = React.useCallback((uploadHandle) => {
28
+ setUploadHandle(uploadHandle);
29
+ // 设置最外层组件方法
30
+ // 兼容云后台数据库中使用uploader组件,未传outSetUploadHandle
31
+ if (outSetUploadHandle) {
32
+ outSetUploadHandle(uploadHandle);
104
33
  }
105
- const allFile = await upload(fileList);
106
- handleChange(allFile);
107
- };
34
+ }, [outSetUploadHandle]);
108
35
  // 删除图片
109
- const deleteHandle = (fileItem) => {
110
- const fileList = tempFile.filter((d) => d.key !== fileItem.key);
111
- handleChange(fileList, true);
36
+ const deleteHandle = (file) => {
37
+ var _a;
38
+ (_a = uploadRef === null || uploadRef === void 0 ? void 0 : uploadRef.current) === null || _a === void 0 ? void 0 : _a.delete({ cloudId: file.cloudId });
112
39
  };
113
40
  // 转换后的属性
114
- const extraProps = {};
41
+ const extraProps = { ...props };
115
42
  //是否支持多选
116
43
  extraProps['multiple'] = !single;
117
44
  extraProps['accept'] = acceptTypes.length === 0 ? IMAGE_TYPES : Array.from(new Set(acceptTypes));
118
45
  tips && (extraProps['title'] = tips);
119
46
  maxSize && (extraProps['maxSize'] = maxSize * 1024 * 1024);
120
47
  const hasActions = !uploading && !readOnly && !(disabled || sourceType === 'camera');
121
- return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsxs("div", { className: "_weda-fn-upload-result", children: [tempFile === null || tempFile === void 0 ? void 0 : tempFile.map((d, index) => (_jsx("div", { className: `_weda-fn-upload-result__item ${imgTypeCls}`, children: _jsx(TcbImage, { index: index, allFile: tempFile, tempFile: d, imgTypeCls: imgTypeCls, isZoom: true, previewIcon: "td:browse", portalContainer: portalContainer, actions: hasActions && (_jsx(WdIcon, { className: `${CLASS_PREFIX}__image-actions-delete`, name: "td:delete", onClick: () => deleteHandle(d), size: "sm" })) }) }, d.key))), _jsxs("div", { className: `${CLASS_PREFIX}__input-box`, children: [readOnly && tempFile.length < 1 && _jsx("div", { children: "-" }), sourceType === 'camera' || (disabled && !readOnly) ? (_jsx("div", { className: `_weda-fn-upload-result__item wedatea2td-disabled weda-uploader-btn__box ${imgTypeCls}`, children: _jsxs("div", { className: "_weda-fn-upload-result__status", children: [_jsx("i", { className: "wedatea2td-icon wedatea2td-icon-plus", role: "img", "aria-label": "plus" }), _jsx("span", { className: "wedatea2td-mt-1n wedatea2td-text-label wedatea2td-fz-reset", children: btnTitle })] }) })) : (((!single && tempFile.length < maxUploadCount) || (single && tempFile.length < 1 && !uploading)) &&
122
- !readOnly && (
123
- // single 模式时,当数组为空且不在上传文件过程中时显示
124
- _jsx(Upload, { ...extraProps, beforeUpload: beforeHandle, children: _jsxs("div", {
48
+ return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(Upload, { ...extraProps, ref: uploadRef, value: defaultValue, setUploadHandle: setUploadRef, children: _jsxs("div", { className: "_weda-fn-upload-result", children: [tempFile === null || tempFile === void 0 ? void 0 : tempFile.map((d, index) => (_jsx("div", { className: `_weda-fn-upload-result__item ${imgTypeCls}`, children: _jsx(TcbImage, { index: index, allFile: tempFile, tempFile: d, imgTypeCls: imgTypeCls, isZoom: true, previewIcon: "td:browse", portalContainer: portalContainer, actions: hasActions && (_jsx(WdIcon, { className: `${CLASS_PREFIX}__image-actions-delete`, name: "td:delete", onClick: () => deleteHandle(d), size: "sm" })) }) }, d.cloudId))), _jsxs("div", { className: `${CLASS_PREFIX}__input-box`, children: [readOnly && tempFile.length < 1 && _jsx("div", { children: "-" }), sourceType === 'camera' || (disabled && !readOnly) ? (_jsx("div", { className: `_weda-fn-upload-result__item wedatea2td-disabled weda-uploader-btn__box ${imgTypeCls}`, children: _jsxs("div", { className: "_weda-fn-upload-result__status", children: [_jsx("i", { className: "wedatea2td-icon wedatea2td-icon-plus", role: "img", "aria-label": "plus" }), _jsx("span", { className: "wedatea2td-mt-1n wedatea2td-text-label wedatea2td-fz-reset", children: btnTitle })] }) })) : (((!single && tempFile.length < maxUploadCount) || (single && tempFile.length < 1 && !uploading)) &&
49
+ !readOnly && (
50
+ // single 模式时,当数组为空且不在上传文件过程中时显示
51
+ _jsxs("div", {
125
52
  // className={"_weda-fn-upload-result__item _weda-fn-upload-result__item--upload" imgTypeCls}
126
53
  // className={classNames(
127
54
  // `_weda-fn-upload-result__item _weda-fn-upload-result__item--upload`,
128
55
  // imgTypeCls
129
56
  // )}
130
- className: `_weda-fn-upload-result__item weda-uploader-btn__box _weda-fn-upload-result__item--upload ${imgTypeCls}`, children: [imgTypeCls, _jsxs("div", { className: "_weda-fn-upload-result__status", children: [_jsx("i", { className: "wedatea2td-icon wedatea2td-icon-plus", role: "img", "aria-label": "plus" }), _jsx("span", { className: "wedatea2td-mt-1n wedatea2td-text-label wedatea2td-fz-reset", children: btnTitle })] })] }) })))] })] }) }));
57
+ className: `_weda-fn-upload-result__item weda-uploader-btn__box _weda-fn-upload-result__item--upload ${imgTypeCls}`, onClick: () => {
58
+ var _a;
59
+ (_a = uploadRef === null || uploadRef === void 0 ? void 0 : uploadRef.current) === null || _a === void 0 ? void 0 : _a.upload();
60
+ }, children: [imgTypeCls, _jsxs("div", { className: "_weda-fn-upload-result__status", children: [_jsx("i", { className: "wedatea2td-icon wedatea2td-icon-plus", role: "img", "aria-label": "plus" }), _jsx("span", { className: "wedatea2td-mt-1n wedatea2td-text-label wedatea2td-fz-reset", children: btnTitle })] })] })))] })] }) }) }));
131
61
  }
132
62
  export const TcbImage = (props) => {
133
- const { fileID, tempFile = { progress: 100, loading: false, realUrl: null, tempUrl: null }, isZoom, imgTypeCls, previewIcon, actions, allFile = [], index, portalContainer, ...rest } = props;
134
- const { progress, loading, realUrl, tempUrl } = tempFile;
135
- const fileCloudID = (realUrl !== null && realUrl !== void 0 ? realUrl : tempUrl) || fileID;
63
+ const { fileID, tempFile = { progress: 100, loading: false, cloudId: null, tempUrl: null }, isZoom, imgTypeCls, previewIcon, actions, allFile = [], index, portalContainer, ...rest } = props;
64
+ const { progress, loading, cloudId, tempUrl } = tempFile;
65
+ const fileCloudID = (cloudId !== null && cloudId !== void 0 ? cloudId : tempUrl) || fileID;
136
66
  const [isError, setIsError] = React.useState(false);
137
67
  const { data: src, error: requestError } = useTempUrl(fileCloudID);
138
68
  const encodeSrc = encodeConvert(src);
@@ -152,7 +82,7 @@ export const TcbImage = (props) => {
152
82
  };
153
83
  if (!isZoom)
154
84
  return renderImg();
155
- const previewImageList = allFile.map((i) => i.realUrl || i.tempUrl);
85
+ const previewImageList = allFile.map((i) => i.cloudId || i.tempUrl);
156
86
  const previewProps = {
157
87
  index,
158
88
  'data-testid': 'uploaderpc_imgStyle',
@@ -1,4 +1,20 @@
1
+ import { TempFileProps } from './upload/index';
2
+ export declare const DEFAULT_UPLOAD_PATH = "weda-uploader";
1
3
  export declare const getBase64: (files: any) => Promise<any[]>;
2
4
  export declare const uploadTcbMulti: (files: any, props: any) => Promise<any[]>;
3
5
  export declare const filenameRegex: RegExp;
4
6
  export declare const checkAcceptedFiles: (file: any, acceptedFiles: any) => any;
7
+ export declare const checkBeforeUpload: ({ tempFile, files, accepts, maxSize, maxUploadCount }: {
8
+ tempFile: any;
9
+ files: any;
10
+ accepts: any;
11
+ maxSize: any;
12
+ maxUploadCount: any;
13
+ }) => boolean;
14
+ export declare const getPreviewFileMap: (previewFile: any) => any;
15
+ export declare const getInitTempFile: ({ value }: {
16
+ value?: any;
17
+ }) => TempFileProps[];
18
+ export declare const CLASS_PREFIX = "weda-uploader-pc";
19
+ export declare const IMAGE_TYPES: string[];
20
+ export declare const upload: (fileList: any, uploadInstance: any, allTempFile: any) => Promise<void>;
@@ -1,8 +1,9 @@
1
1
  import { compressImage } from './compress';
2
2
  import { getCloudInstance, getDefaultUploadPath } from '../../../utils/tcb';
3
3
  import { toBase64Uri } from '../../../utils/file2base64';
4
- import { randomStr } from '../../../utils/platform';
4
+ import { randomStr, alertErrorMessage } from '../../../utils/platform';
5
5
  import { errorHandler } from '../../../utils/error';
6
+ export const DEFAULT_UPLOAD_PATH = 'weda-uploader';
6
7
  export const getBase64 = (files) => {
7
8
  return Promise.all(files.map(async (item) => {
8
9
  let tempUrl = '';
@@ -35,13 +36,29 @@ export const uploadTcbMulti = async (files, props) => {
35
36
  return result;
36
37
  };
37
38
  export const filenameRegex = /[^a-zA-Z0-9\u4e00-\u9fff-*!_.]/g;
39
+ const sanitizeFilename = (filename, replacement = '') => {
40
+ return (filename
41
+ // 移除非法字符
42
+ // eslint-disable-next-line no-control-regex
43
+ .replace(/[<>.:"\\|?*\x00-\x1F]/g, replacement)
44
+ // 处理Windows保留文件名(CON, PRN等)
45
+ .replace(/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\..*)?$/i, replacement)
46
+ // 移除开头和结尾的点,空格,反斜杠(Windows不允许)
47
+ .replace(/^[. /]+/, '')
48
+ .replace(/[. /]+$/, '')
49
+ // 可选:限制长度
50
+ .slice(0, 255));
51
+ };
38
52
  const uploadToTcb = async (item, props) => {
39
53
  var _a;
40
- const { onUploadProgress, onUploadFinish, onUploadError } = props;
41
- const { file, uploadPath } = item;
54
+ const { onUploadProgress, onUploadFinish, onUploadError, uploadPath, customUploadPath } = props;
55
+ const { file } = item;
42
56
  try {
43
57
  const tcb = await getCloudInstance();
44
- const _uploadPath = getDefaultUploadPath(uploadPath);
58
+ let _uploadPath = getDefaultUploadPath(uploadPath);
59
+ if (customUploadPath) {
60
+ _uploadPath = `${_uploadPath}/${sanitizeFilename(customUploadPath, '')}}`;
61
+ }
45
62
  const cloudPath = `${_uploadPath}/${randomStr()}-${(_a = file === null || file === void 0 ? void 0 : file.name) === null || _a === void 0 ? void 0 : _a.replace(filenameRegex, '-')}`;
46
63
  const { fileID } = await tcb.uploadFile({
47
64
  cloudPath,
@@ -67,7 +84,7 @@ const uploadToTcb = async (item, props) => {
67
84
  ...item,
68
85
  progress: 100,
69
86
  loading: false,
70
- realUrl: fileID,
87
+ cloudId: fileID,
71
88
  };
72
89
  if (onUploadFinish) {
73
90
  onUploadFinish(fileItem);
@@ -109,3 +126,87 @@ export const checkAcceptedFiles = (file, acceptedFiles) => {
109
126
  }
110
127
  return true;
111
128
  };
129
+ export const checkBeforeUpload = ({ tempFile, files, accepts, maxSize, maxUploadCount }) => {
130
+ const isAccepted = files.every((i) => checkAcceptedFiles(i, accepts));
131
+ if (!isAccepted) {
132
+ alertErrorMessage({
133
+ message: `上传图片类型错误`,
134
+ icon: 'error',
135
+ });
136
+ return false;
137
+ }
138
+ if (files.some((f) => f.size > maxSize * 1024 * 1024)) {
139
+ alertErrorMessage({
140
+ message: `请上传不超过 ${maxSize}M 的图片`,
141
+ icon: 'error',
142
+ });
143
+ return false;
144
+ }
145
+ if (files.length > maxUploadCount) {
146
+ // 防止一下子选择过多文件
147
+ alertErrorMessage({
148
+ message: `最多只能上传${maxUploadCount}张图片,请重新选择`,
149
+ icon: 'error',
150
+ });
151
+ return false;
152
+ }
153
+ if ((tempFile === null || tempFile === void 0 ? void 0 : tempFile.length) + (files === null || files === void 0 ? void 0 : files.length) > maxUploadCount) {
154
+ alertErrorMessage({
155
+ message: `最多只能上传${maxUploadCount}张图片`,
156
+ icon: 'error',
157
+ });
158
+ return false;
159
+ }
160
+ return true;
161
+ };
162
+ export const getPreviewFileMap = (previewFile) => {
163
+ return previewFile.reduce((acc, obj) => {
164
+ acc[obj === null || obj === void 0 ? void 0 : obj.cloudId] = obj; // 使用 cloudId 作为新对象的 key
165
+ return acc;
166
+ }, {});
167
+ };
168
+ export const getInitTempFile = ({ value }) => {
169
+ const tempFile = value.map((i) => ({
170
+ key: randomStr(),
171
+ cloudId: i,
172
+ tempUrl: '',
173
+ progress: 100,
174
+ loading: false,
175
+ }));
176
+ return tempFile;
177
+ };
178
+ // 默认组件类前缀
179
+ export const CLASS_PREFIX = 'weda-uploader-pc';
180
+ // 默认图片类型
181
+ export const IMAGE_TYPES = [
182
+ 'image/jpg',
183
+ 'image/png',
184
+ 'image/tif',
185
+ 'image/bmp',
186
+ 'image/jpeg',
187
+ 'image/tiff',
188
+ 'image/gif',
189
+ ];
190
+ export const upload = async (fileList, uploadInstance, allTempFile) => {
191
+ const { config = {}, onComplete, onSuccess, onFail, onUploadProgress } = uploadInstance;
192
+ const { isCompressBeforeUpload, compressQuality, compressedHeight, compressedWidth } = config;
193
+ const result = await uploadTcbMulti(fileList, {
194
+ isCompressBeforeUpload,
195
+ compressedHeight,
196
+ compressedWidth,
197
+ compressQuality,
198
+ customUploadPath: config.customUploadPath,
199
+ uploadPath: DEFAULT_UPLOAD_PATH,
200
+ onUploadProgress: (item) => {
201
+ onUploadProgress(item);
202
+ },
203
+ onUploadFinish: (item) => {
204
+ onSuccess(item);
205
+ },
206
+ onUploadError: (err) => {
207
+ onFail(err);
208
+ },
209
+ });
210
+ const allFile = allTempFile.map((i) => result.find((j) => (j === null || j === void 0 ? void 0 : j.key) === (i === null || i === void 0 ? void 0 : i.key)) || i);
211
+ onComplete(allFile);
212
+ };
@@ -69,7 +69,7 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
69
69
  }
70
70
  }, [defaultValue]);
71
71
  React.useEffect(() => {
72
- var _a, _b;
72
+ var _a;
73
73
  if (isObjectEqual(fileRef.current, fileIDList))
74
74
  return;
75
75
  // 外部 onChange 事件
@@ -79,10 +79,6 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
79
79
  if (changeTypeRef.current) {
80
80
  (_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
81
81
  }
82
- if (changeTypeRef.current === 'add') {
83
- const files = pureFileIDList.map((d) => { var _a; return (_a = fileSizeObj[d]) === null || _a === void 0 ? void 0 : _a.file; });
84
- (_b = events === null || events === void 0 ? void 0 : events.success) === null || _b === void 0 ? void 0 : _b.call(events, { value: pureFileIDList, file: files });
85
- }
86
82
  fileRef.current = fileIDList;
87
83
  }, [fileIDList]);
88
84
  // 外层组件类
@@ -99,11 +95,13 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
99
95
  }, [acceptTypes]);
100
96
  // 上传后文件列表 fileIDList 改变事件,'add'|'delete'
101
97
  const handleChange = ({ fileID, uuid, type, size, file }) => {
98
+ var _a;
102
99
  if (fileID) {
103
100
  changeTypeRef.current = type;
104
101
  if (type === 'add') {
105
102
  setFileSizeObj((obj) => ({ ...obj, [fileID]: { size, file } }));
106
103
  setfileIDList((fileIDList) => [...fileIDList, fileID]);
104
+ (_a = events === null || events === void 0 ? void 0 : events.success) === null || _a === void 0 ? void 0 : _a.call(events, { value: fileID, file });
107
105
  }
108
106
  else {
109
107
  setfileIDList((fileIDList) => fileIDList.filter((f) => f !== fileID));
@@ -71,7 +71,7 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
71
71
  }
72
72
  }, [defaultValue]);
73
73
  React.useEffect(() => {
74
- var _a, _b;
74
+ var _a;
75
75
  if (isObjectEqual(fileRef.current, fileIDList))
76
76
  return;
77
77
  // 外部 onChange 事件
@@ -81,10 +81,6 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
81
81
  if (changeTypeRef.current) {
82
82
  (_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
83
83
  }
84
- if (changeTypeRef.current === 'add') {
85
- const files = pureFileIDList.map((d) => { var _a; return (_a = fileSizeObj[d]) === null || _a === void 0 ? void 0 : _a.file; });
86
- (_b = events === null || events === void 0 ? void 0 : events.success) === null || _b === void 0 ? void 0 : _b.call(events, { value: pureFileIDList, file: files });
87
- }
88
84
  fileRef.current = fileIDList;
89
85
  }, [fileIDList]);
90
86
  // 外层组件类
@@ -168,11 +164,13 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
168
164
  };
169
165
  // 上传后文件列表 fileIDList 改变事件,'add'|'delete'
170
166
  const handleChange = ({ fileID, uuid, type, size, file }) => {
167
+ var _a;
171
168
  if (fileID) {
172
169
  changeTypeRef.current = type;
173
170
  if (type === 'add') {
174
171
  setFileSizeObj((obj) => ({ ...obj, [fileID]: { size, file } }));
175
172
  setfileIDList((list) => [...list, fileID]);
173
+ (_a = events === null || events === void 0 ? void 0 : events.success) === null || _a === void 0 ? void 0 : _a.call(events, { value: fileID, file });
176
174
  }
177
175
  else {
178
176
  setfileIDList((list) => list.filter((d) => d !== fileID));
@@ -38,7 +38,7 @@ alt = '[加载失败]', gutter = 8, height = 100, width = 100, events = emptyObj
38
38
  onLoad: () => setSuccessList((list) => [...list, d]),
39
39
  onError: () => setErrorList((list) => [...list, d]),
40
40
  portalContainer,
41
- allFile: values === null || values === void 0 ? void 0 : values.map((d) => ({ realUrl: d })),
41
+ allFile: values === null || values === void 0 ? void 0 : values.map((d) => ({ cloudId: d })),
42
42
  index: i,
43
43
  };
44
44
  return (_jsx("div", { className: `${CLASS_PREFIX}__image-box`, style: boxStyle, title: d, children: _jsx(TcbImage, { ...imgProps }) }, `${d}-${i}`));
@@ -9,13 +9,11 @@ import { X_RUNTIME_DEFAULT } from '../../../configs/type-utils/x-runtime-default
9
9
  */
10
10
  export function WdAd(props) {
11
11
  const { className, id, style, adType: _adType = X_RUNTIME_DEFAULT.adType, gridCount: _gridCount = X_RUNTIME_DEFAULT.gridCount, } = props;
12
- const adType = ['banner', 'video', 'grid'].includes(_adType)
13
- ? _adType
14
- : 'banner';
12
+ const adType = ['banner', 'video', 'grid', 'rewardedVideoAd'].includes(_adType) ? _adType : 'banner';
15
13
  const gridCount = _gridCount == 8 ? 8 : 5;
16
14
  const { classPrefix } = useConfig();
17
15
  const canPreview = useCanPreview();
18
16
  if (!canPreview)
19
17
  return null;
20
- return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(Bubble, { placement: "auto", openDelay: 300, content: _jsxs(_Fragment, { children: ["\u8BE5\u7EC4\u4EF6\u5FC5\u987B\u5728\u5C0F\u7A0B\u5E8F\u771F\u5B9E\u73AF\u5883\u4F7F\u7528\u624D\u80FD\u591F\u770B\u5230\u5B9E\u9645\u6548\u679C\u3002", _jsx("br", {}), "\u8BF7\u9075\u5FAA\u5FAE\u4FE1\u5E7F\u544A\u7EC4\u4EF6\u5E94\u7528\u89C4\u8303\uFF0C\u5426\u5219\u53EF\u80FD\u5BFC\u81F4\u5C0F\u7A0B\u5E8F\u5BA1\u6838\u5931\u8D25\u3002"] }), children: _jsxs("div", { className: `${classPrefix}-ad ${classPrefix}-ad--${adType} ${className}`, id: id, style: style, children: [adType === 'banner' && _jsx(BannerAd, {}), adType === 'video' && _jsx(VideoAd, {}), adType === 'grid' && _jsx(GridAd, { gridCount: gridCount })] }) }) }));
18
+ return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(Bubble, { placement: "auto", openDelay: 300, content: _jsxs(_Fragment, { children: ["\u8BE5\u7EC4\u4EF6\u5FC5\u987B\u5728\u5C0F\u7A0B\u5E8F\u771F\u5B9E\u73AF\u5883\u4F7F\u7528\u624D\u80FD\u591F\u770B\u5230\u5B9E\u9645\u6548\u679C\u3002", _jsx("br", {}), "\u8BF7\u9075\u5FAA\u5FAE\u4FE1\u5E7F\u544A\u7EC4\u4EF6\u5E94\u7528\u89C4\u8303\uFF0C\u5426\u5219\u53EF\u80FD\u5BFC\u81F4\u5C0F\u7A0B\u5E8F\u5BA1\u6838\u5931\u8D25\u3002"] }), children: _jsxs("div", { className: `${classPrefix}-ad ${classPrefix}-ad--${adType} ${className}`, id: id, style: style, children: [adType === 'banner' && _jsx(BannerAd, {}), ['rewardedVideoAd', 'video'].includes(adType) && _jsx(VideoAd, {}), adType === 'grid' && _jsx(GridAd, { gridCount: gridCount })] }) }) }));
21
19
  }