@cloudbase/weda-ui 3.10.3 → 3.11.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/button.js +1 -1
- package/dist/configs/components/chart/bar.d.ts +146 -0
- package/dist/configs/components/chart/bar.js +1147 -0
- package/dist/configs/components/dataView.js +0 -16
- package/dist/configs/components/image.js +1 -1
- package/dist/configs/components/listView.js +0 -16
- package/dist/configs/components/lottery.js +1 -1
- package/dist/configs/components/navigationBar.json +1 -1
- package/dist/configs/components/wd-audio.js +1 -1
- package/dist/configs/components/wd-button.js +2 -2
- package/dist/configs/components/wd-icon.js +1 -1
- package/dist/configs/components/wd-image.js +1 -1
- package/dist/configs/components/wd-input-email.d.ts +2 -2
- package/dist/configs/components/wd-input-phone.d.ts +2 -2
- package/dist/configs/components/wd-input-url.d.ts +2 -2
- package/dist/configs/components/wd-link.js +1 -1
- package/dist/configs/components/wd-progress.d.ts +10 -0
- package/dist/configs/components/wd-progress.js +39 -2
- package/dist/configs/components/wd-rating.js +2 -2
- package/dist/configs/components/wd-select-multiple.d.ts +23 -0
- package/dist/configs/components/wd-select-multiple.js +26 -1
- package/dist/configs/components/wd-select.d.ts +23 -0
- package/dist/configs/components/wd-select.js +25 -0
- package/dist/configs/components/wd-side-tab.js +2 -2
- package/dist/configs/components/wd-table.d.ts +1 -1
- package/dist/configs/components/wd-table.js +1 -0
- package/dist/configs/components/wd-top-tab.d.ts +4 -0
- package/dist/configs/components/wd-top-tab.js +7 -2
- package/dist/configs/components/wd-upload-image.js +1 -1
- package/dist/configs/components/wedaVideo.js +3 -3
- package/dist/configs/components/wxOpenApi/share.js +1 -1
- package/dist/configs/index.d.ts +765 -2065
- package/dist/configs/index.js +1 -1
- package/dist/configs/type-utils/type-form.d.ts +6 -0
- package/dist/configs/type-utils/type-form.js +64 -22
- package/dist/configs/type-utils/x-runtime-default.d.ts +1 -0
- package/dist/configs/type-utils/x-runtime-default.js +1 -0
- package/dist/enum/index.js +5 -1
- package/dist/style/index.css +16 -4
- package/dist/style/index.scss +1 -1
- package/dist/style/weda-ui.min.css +2 -2
- package/dist/web/components/form/location/common/propsConfig.d.ts +1 -1
- package/dist/web/components/form/select/index.css +2 -2
- package/dist/web/components/form/select/request.d.ts +3 -3
- package/dist/web/components/form/select/request.js +1 -0
- package/dist/web/components/form/select/status/index.d.ts +3 -1
- package/dist/web/components/form/select/status/index.js +3 -1
- package/dist/web/components/form/selectMultiple/dropdown-select/index.css +5 -5
- package/dist/web/components/form/uploader/uploader.h5.js +13 -4
- package/dist/web/components/form/uploader/util.d.ts +1 -0
- package/dist/web/components/form/uploader/util.js +28 -0
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +14 -6
- package/dist/web/components/form-date/index.d.ts +1 -1
- package/dist/web/components/form-email/index.d.ts +1 -1
- package/dist/web/components/form-input/index.d.ts +1 -1
- package/dist/web/components/form-input-hooks/index.js +10 -1
- package/dist/web/components/form-input-hooks/validator.d.ts +1 -0
- package/dist/web/components/form-input-hooks/validator.js +6 -2
- package/dist/web/components/form-phone/index.d.ts +1 -1
- package/dist/web/components/form-time/index.d.ts +1 -1
- package/dist/web/components/form-url/index.d.ts +1 -1
- package/dist/web/components/grid/col.d.ts +2 -2
- package/dist/web/components/wd-date/elements/Modal.h5.d.ts +2 -0
- package/dist/web/components/wd-date/elements/Modal.h5.js +3 -3
- package/dist/web/components/wd-form/index.js +1 -1
- package/dist/web/components/wd-form-item/wd-form-item-read-only.d.ts +1 -0
- package/dist/web/components/wd-input/wd-input.d.ts +1 -1
- package/dist/web/components/wd-input-email/wd-input-email.d.ts +1 -1
- package/dist/web/components/wd-input-phone/wd-input-phone.d.ts +1 -1
- package/dist/web/components/wd-input-url/wd-input-url.d.ts +1 -1
- package/dist/web/components/wd-progress/wd-progress.js +5 -3
- package/dist/web/components/wd-select/relationSelect/relationSelect.d.ts +4 -0
- package/dist/web/components/wd-select/relationSelect/relationSelect.js +202 -0
- package/dist/web/components/wd-select/{relationalSetting.js → relationSelect/relationalSetting.js} +4 -4
- package/dist/web/components/wd-select/select/index.d.ts +2 -0
- package/dist/web/components/wd-select/select/index.js +8 -0
- package/dist/web/components/wd-select/select/selectUI.d.ts +3 -0
- package/dist/web/components/wd-select/select/selectUI.js +190 -0
- package/dist/web/components/wd-select/style.d.ts +2 -0
- package/dist/web/components/wd-select/style.js +2 -0
- package/dist/web/components/wd-select/wd-select.css +83 -0
- package/dist/web/components/wd-select/wd-select.d.ts +0 -1
- package/dist/web/components/wd-select/wd-select.js +18 -8
- package/dist/web/components/wd-select-multiple/style.d.ts +2 -0
- package/dist/web/components/wd-select-multiple/style.js +2 -0
- package/dist/web/components/wd-select-multiple/wd-select-multiple.css +30 -4
- package/dist/web/components/wd-select-multiple/wd-select-multiple.js +18 -7
- package/dist/web/components/wd-table/components/FieldRender/index.d.ts +7 -4
- package/dist/web/components/wd-table/components/FieldRender/index.js +42 -15
- package/dist/web/components/wd-table/components/ModalTable/index.js +4 -3
- package/dist/web/components/wd-table/hooks/useChooseList.d.ts +1 -0
- package/dist/web/components/wd-table/hooks/useChooseList.js +55 -26
- package/dist/web/components/wd-table/utils/index.js +1 -1
- package/dist/web/components/wd-table/wd-table.js +2 -2
- package/dist/web/utils/isObjectEqual.d.ts +1 -1
- package/dist/web/utils/moment.d.ts +1 -0
- package/dist/web/utils/platform.js +3 -3
- package/dist/web/utils/tool.js +2 -2
- package/package.json +18 -13
- package/dist/configs/components/chart/bar.json +0 -1144
- /package/dist/web/components/wd-select/{relationalSetting.d.ts → relationSelect/relationalSetting.d.ts} +0 -0
|
@@ -13,7 +13,7 @@ export namespace propTypes {
|
|
|
13
13
|
const zoom: PropTypes.Requireable<boolean>;
|
|
14
14
|
const disabled: PropTypes.Requireable<boolean>;
|
|
15
15
|
const requiredFlag: PropTypes.Requireable<boolean>;
|
|
16
|
-
const decorator: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
16
|
+
const decorator: PropTypes.Requireable<NonNullable<any[] | PropTypes.ReactNodeLike>>;
|
|
17
17
|
const value: PropTypes.Requireable<object>;
|
|
18
18
|
const locationType: PropTypes.Requireable<number>;
|
|
19
19
|
const dataSource: PropTypes.Requireable<object>;
|
|
@@ -9,16 +9,16 @@ type IRelationFetchOptions = {
|
|
|
9
9
|
where: unknown;
|
|
10
10
|
pageNo: number;
|
|
11
11
|
primaryField: string;
|
|
12
|
-
controlledValue
|
|
12
|
+
controlledValue?: OptionItem[];
|
|
13
13
|
};
|
|
14
14
|
type IEnumFetchOptions = {
|
|
15
15
|
format: 'x-enum';
|
|
16
16
|
enumName: string;
|
|
17
|
-
controlledValue
|
|
17
|
+
controlledValue?: OptionItem[];
|
|
18
18
|
};
|
|
19
19
|
export type IUseoptionsParams = (IRelationFetchOptions | IEnumFetchOptions | {
|
|
20
20
|
format?: string;
|
|
21
|
-
controlledValue
|
|
21
|
+
controlledValue?: OptionItem[];
|
|
22
22
|
}) & {
|
|
23
23
|
callWedaApi?: (params: any) => Promise<any> | any;
|
|
24
24
|
callDataSource?: (params: any) => Promise<any>;
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
border-radius: 3px;
|
|
119
119
|
display: block;
|
|
120
120
|
position: absolute;
|
|
121
|
-
left:
|
|
121
|
+
left: 5px;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
.weda-ui-custom-picker__cloumns.weda-ui-custom-picker__cloumns--select-multiple
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
border-radius: 3px;
|
|
131
131
|
display: block;
|
|
132
132
|
position: absolute;
|
|
133
|
-
left:
|
|
133
|
+
left: 5px;
|
|
134
134
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTAiIHZpZXdCb3g9IjAgMCAxNCAxMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTMuNDAxNDYgNy45NDI3QzMuNDAxNCA3Ljk0MjY0IDMuNDAxNTMgNy45NDI3NiAzLjQwMTQ2IDcuOTQyN0wwLjc1IDUuMjkxMjNMMi41NDM0OSAzLjU0OTE5TDUuMTcyMSA2LjE3NzhMMTEuMzY4NyAwTDEzLjEyNDQgMS43NTU3TDYuOTI3OCA3LjkzMzVMNi45MzcxOCA3Ljk0Mjg5TDYuOTExMDkgNy45NjgyM0M2Ljg1NyA4LjAyMDc3IDYuODAxMTQgOC4wNzAzNyA2Ljc0MzcxIDguMTE3MDRMNi4wNDEyMyA4LjgxNzM4QzUuNTUyODYgOS4zMDQyNyA0Ljc2MjQ0IDkuMzAzNjcgNC4yNzQ4MSA4LjgxNjA0TDMuNDAxNDYgNy45NDI3WiIgZmlsbD0id2hpdGUiIGZpbGwtb3BhY2l0eT0iMC45Ii8+Cjwvc3ZnPg==);
|
|
135
135
|
background-repeat: no-repeat;
|
|
136
136
|
background-position: center;
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
|
|
145
145
|
/* 下拉选择类型 */
|
|
146
146
|
.weda-ui-custom-picker__cloumns.weda-ui-custom-picker__cloumns--select-multiple {
|
|
147
|
-
padding: 0
|
|
147
|
+
padding: 0 16px;
|
|
148
148
|
height: 280px;
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -219,12 +219,12 @@
|
|
|
219
219
|
justify-content: space-between;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
.wedatea2td-list.wedatea2td-list--option.wedatea2td-list--checkoption
|
|
222
|
+
/* .wedatea2td-list.wedatea2td-list--option.wedatea2td-list--checkoption
|
|
223
223
|
.wedatea2td-list__status
|
|
224
224
|
.wedatea2td-action-state
|
|
225
225
|
.wedatea2td-action-state__text {
|
|
226
226
|
display: none;
|
|
227
|
-
}
|
|
227
|
+
} */
|
|
228
228
|
|
|
229
229
|
.wedatea2td-list.wedatea2td-list--option.wedatea2td-list--checkoption
|
|
230
230
|
.wedatea2td-list__status
|
|
@@ -9,6 +9,7 @@ import { toBase64Uri } from '../../../utils/file2base64';
|
|
|
9
9
|
import { isNil } from '../../../utils/lodash';
|
|
10
10
|
import { useUploader } from './useUploadFile';
|
|
11
11
|
import { errorHandler } from '../../../utils/error';
|
|
12
|
+
import { checkAcceptedFiles } from './util';
|
|
12
13
|
/**
|
|
13
14
|
* H5端
|
|
14
15
|
*/
|
|
@@ -51,10 +52,18 @@ export function ImageUploaderH5(props) {
|
|
|
51
52
|
return tempFile.length < maxUploadCount;
|
|
52
53
|
}, [tempFile, single, maxUploadCount, uploading]);
|
|
53
54
|
const uploadChange = async (e) => {
|
|
54
|
-
var _a, _b, _c, _d, _e, _f;
|
|
55
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
55
56
|
let files = [...e.target.files];
|
|
56
|
-
|
|
57
|
+
const isAccepted = files.every((i) => checkAcceptedFiles(i, accepts));
|
|
58
|
+
if (!isAccepted) {
|
|
57
59
|
(_b = (_a = window === null || window === void 0 ? void 0 : window.$w) === null || _a === void 0 ? void 0 : _a.utils) === null || _b === void 0 ? void 0 : _b.showToast({
|
|
60
|
+
title: `上传图片类型错误`,
|
|
61
|
+
icon: 'none',
|
|
62
|
+
});
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
if (files.some((f) => f.size > maxSize * 1024 * 1024)) {
|
|
66
|
+
(_d = (_c = window === null || window === void 0 ? void 0 : window.$w) === null || _c === void 0 ? void 0 : _c.utils) === null || _d === void 0 ? void 0 : _d.showToast({
|
|
58
67
|
title: `请上传不超过 ${maxSize}M 的图片`,
|
|
59
68
|
icon: 'none',
|
|
60
69
|
});
|
|
@@ -62,14 +71,14 @@ export function ImageUploaderH5(props) {
|
|
|
62
71
|
}
|
|
63
72
|
if (files.length > finalMaxImgCount) {
|
|
64
73
|
// 防止一下子选择过多文件
|
|
65
|
-
(
|
|
74
|
+
(_f = (_e = window === null || window === void 0 ? void 0 : window.$w) === null || _e === void 0 ? void 0 : _e.utils) === null || _f === void 0 ? void 0 : _f.showToast({
|
|
66
75
|
title: `最多只能上传${finalMaxImgCount}张图片,请重新选择`,
|
|
67
76
|
icon: 'none',
|
|
68
77
|
});
|
|
69
78
|
return false;
|
|
70
79
|
}
|
|
71
80
|
if (tempFile.length + files.length > finalMaxImgCount) {
|
|
72
|
-
(
|
|
81
|
+
(_h = (_g = window === null || window === void 0 ? void 0 : window.$w) === null || _g === void 0 ? void 0 : _g.utils) === null || _h === void 0 ? void 0 : _h.showToast({
|
|
73
82
|
title: `最多只能上传${finalMaxImgCount}张图片`,
|
|
74
83
|
icon: 'none',
|
|
75
84
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const getBase64: (files: any) => Promise<any[]>;
|
|
2
2
|
export declare const uploadTcbMulti: (files: any, props: any) => Promise<any[]>;
|
|
3
3
|
export declare const filenameRegex: RegExp;
|
|
4
|
+
export declare const checkAcceptedFiles: (file: any, acceptedFiles: any) => any;
|
|
@@ -86,3 +86,31 @@ const uploadToTcb = async (item, props) => {
|
|
|
86
86
|
onUploadError(err);
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
+
export const checkAcceptedFiles = (file, acceptedFiles) => {
|
|
90
|
+
if (file && acceptedFiles) {
|
|
91
|
+
const acceptedFilesArray = Array.isArray(acceptedFiles)
|
|
92
|
+
? acceptedFiles
|
|
93
|
+
: acceptedFiles.split(',');
|
|
94
|
+
if (acceptedFilesArray.length === 0) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
if (acceptedFilesArray.includes('*')) {
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
const fileName = file.name || '';
|
|
101
|
+
const mimeType = (file.type || '').toLowerCase();
|
|
102
|
+
const baseMimeType = mimeType.replace(/\/.*$/, '');
|
|
103
|
+
return acceptedFilesArray.some((type) => {
|
|
104
|
+
const validType = type.trim().toLowerCase();
|
|
105
|
+
if (validType.charAt(0) === '.') {
|
|
106
|
+
return fileName.toLowerCase().endsWith(validType);
|
|
107
|
+
}
|
|
108
|
+
else if (validType.endsWith('/*')) {
|
|
109
|
+
// This is something like a image/* mime type
|
|
110
|
+
return baseMimeType === validType.replace(/\/.*$/, '');
|
|
111
|
+
}
|
|
112
|
+
return mimeType === validType;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
};
|
|
@@ -13,7 +13,7 @@ import { WdButton } from '../../wd-button/wd-button';
|
|
|
13
13
|
import { toBase64Uri } from '../../../utils/file2base64';
|
|
14
14
|
import { isNil } from '../../../utils/lodash';
|
|
15
15
|
import { errorHandler } from '../../../utils/error';
|
|
16
|
-
import { filenameRegex } from '../uploader/util';
|
|
16
|
+
import { filenameRegex, checkAcceptedFiles } from '../uploader/util';
|
|
17
17
|
// 默认组件类前缀
|
|
18
18
|
const CLASS_PREFIX = 'weda-upload-file-mobile';
|
|
19
19
|
// 默认图片类型
|
|
@@ -137,10 +137,18 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
137
137
|
}, 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: btnTitle }))) : (_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: () => {
|
|
138
138
|
inputRef.current && (inputRef.current.value = '');
|
|
139
139
|
}, onChange: async (e) => {
|
|
140
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
140
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
141
141
|
let fileList = [...e.target.files];
|
|
142
|
-
|
|
142
|
+
const isAccepted = fileList.every((i) => checkAcceptedFiles(i, accepts));
|
|
143
|
+
if (!isAccepted) {
|
|
143
144
|
(_b = (_a = window === null || window === void 0 ? void 0 : window.$w) === null || _a === void 0 ? void 0 : _a.utils) === null || _b === void 0 ? void 0 : _b.showToast({
|
|
145
|
+
title: `上传图片类型错误`,
|
|
146
|
+
icon: 'none',
|
|
147
|
+
});
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
if (single && fileList.length > 1) {
|
|
151
|
+
(_d = (_c = window === null || window === void 0 ? void 0 : window.$w) === null || _c === void 0 ? void 0 : _c.utils) === null || _d === void 0 ? void 0 : _d.showToast({
|
|
144
152
|
title: `上传文件总数不能超过1个`,
|
|
145
153
|
icon: 'none',
|
|
146
154
|
});
|
|
@@ -148,7 +156,7 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
148
156
|
}
|
|
149
157
|
if (fileList.length + fileIDList.length >
|
|
150
158
|
maxUploadCount) {
|
|
151
|
-
(
|
|
159
|
+
(_f = (_e = window === null || window === void 0 ? void 0 : window.$w) === null || _e === void 0 ? void 0 : _e.utils) === null || _f === void 0 ? void 0 : _f.showToast({
|
|
152
160
|
title: `上传文件总数不能超过${maxUploadCount}个`,
|
|
153
161
|
icon: 'none',
|
|
154
162
|
});
|
|
@@ -156,14 +164,14 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
156
164
|
}
|
|
157
165
|
if (maxSizeLimit &&
|
|
158
166
|
fileList.some((f) => f.size > maxSizeLimit * 1024 * 1024)) {
|
|
159
|
-
(
|
|
167
|
+
(_h = (_g = window === null || window === void 0 ? void 0 : window.$w) === null || _g === void 0 ? void 0 : _g.utils) === null || _h === void 0 ? void 0 : _h.showToast({
|
|
160
168
|
title: `请上传不超过${maxSizeLimit}M的文件`,
|
|
161
169
|
icon: 'none',
|
|
162
170
|
});
|
|
163
171
|
return false;
|
|
164
172
|
}
|
|
165
173
|
if (fileList.some((f) => f.size > 1024 * 1024 * 1024)) {
|
|
166
|
-
(
|
|
174
|
+
(_k = (_j = window === null || window === void 0 ? void 0 : window.$w) === null || _j === void 0 ? void 0 : _j.utils) === null || _k === void 0 ? void 0 : _k.showToast({
|
|
167
175
|
title: `请上传不超过1024M的文件`,
|
|
168
176
|
icon: 'none',
|
|
169
177
|
});
|
|
@@ -18,8 +18,8 @@ declare const FormDate: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
|
18
18
|
start: string;
|
|
19
19
|
layout: "" | "vertical" | "horizontal";
|
|
20
20
|
mode: "datetime" | "year" | "month" | "day";
|
|
21
|
-
labelVisible: boolean;
|
|
22
21
|
clearable: boolean;
|
|
22
|
+
labelVisible: boolean;
|
|
23
23
|
requiredFlag: boolean;
|
|
24
24
|
requiredMsg: string;
|
|
25
25
|
} & {
|
|
@@ -17,8 +17,8 @@ declare const FormEmail: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
|
17
17
|
maxLength: number;
|
|
18
18
|
placeholder: string;
|
|
19
19
|
layout: "" | "vertical" | "horizontal";
|
|
20
|
-
labelVisible: boolean;
|
|
21
20
|
clearable: boolean;
|
|
21
|
+
labelVisible: boolean;
|
|
22
22
|
requiredFlag: boolean;
|
|
23
23
|
requiredMsg: string;
|
|
24
24
|
} & {
|
|
@@ -18,9 +18,9 @@ declare const WdInput: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
|
18
18
|
maxLength: number;
|
|
19
19
|
placeholder: string;
|
|
20
20
|
layout: "" | "vertical" | "horizontal";
|
|
21
|
+
clearable: boolean;
|
|
21
22
|
labelVisible: boolean;
|
|
22
23
|
isNickNameType: boolean;
|
|
23
|
-
clearable: boolean;
|
|
24
24
|
password: boolean;
|
|
25
25
|
rules: {
|
|
26
26
|
format: string;
|
|
@@ -143,7 +143,8 @@ export function useFormInputTrait(inputParams) {
|
|
|
143
143
|
setDisabled(originalDisabled);
|
|
144
144
|
};
|
|
145
145
|
},
|
|
146
|
-
async handleValidate() {
|
|
146
|
+
async handleValidate(throwError = true) {
|
|
147
|
+
var _a;
|
|
147
148
|
let finalValue = valueRef.current;
|
|
148
149
|
if (!required && !rules.length)
|
|
149
150
|
return;
|
|
@@ -236,6 +237,14 @@ export function useFormInputTrait(inputParams) {
|
|
|
236
237
|
if (errorArr.length > 0) {
|
|
237
238
|
setValidateState('error');
|
|
238
239
|
setValidateErrorMsg(errorArr[0].message);
|
|
240
|
+
if (throwError) {
|
|
241
|
+
const { compError } = errorHandler({
|
|
242
|
+
code: 'VALIDATE_ERROR',
|
|
243
|
+
error: errorArr,
|
|
244
|
+
message: `【${label}】${(_a = errorArr[0]) === null || _a === void 0 ? void 0 : _a.message}`,
|
|
245
|
+
});
|
|
246
|
+
throw compError;
|
|
247
|
+
}
|
|
239
248
|
}
|
|
240
249
|
else {
|
|
241
250
|
// console.log("校验成功>>>>>>>")
|
|
@@ -4,6 +4,7 @@ export declare const validType: {
|
|
|
4
4
|
readonly cn: (value: any) => boolean;
|
|
5
5
|
readonly mobile: (value: any) => boolean;
|
|
6
6
|
readonly tel: (value: any) => boolean;
|
|
7
|
+
readonly internationalTel: (value: any) => boolean;
|
|
7
8
|
readonly email: (value: any) => boolean;
|
|
8
9
|
readonly url: (value: any) => boolean;
|
|
9
10
|
readonly carId: (value: any) => boolean;
|
|
@@ -7,8 +7,9 @@ const pattern = {
|
|
|
7
7
|
cnName: /^[\u2E80-\uFE4F]{2,6}(?:·[\u2E80-\uFE4F]{2,6})*$/,
|
|
8
8
|
userName: /^[\da-zA-Z\u2E80-\uFE4F \s]{2,}$/,
|
|
9
9
|
carId: /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/,
|
|
10
|
-
mobile: /^
|
|
11
|
-
tel:
|
|
10
|
+
mobile: /^1[3-9]\d{9}$/,
|
|
11
|
+
tel: /(^(0\d{2,3}-)?|^\(\d{3}\)?|^(400|800)-?)(\d{3,8})(-\d{1,4})?$/,
|
|
12
|
+
internationalTel: /^(\+\d{1,4}[\s-]?)?(\(?\d{1,4}\)?[\s-]?)?(\d{1,4}[\s-]?)?(\d{1,4})?\d{1,9}(\s?(x|ext)\s?\d{1,6})?$/,
|
|
12
13
|
address: /^[\da-zA-Z\u2E80-\uFE4F \s-]{4,400}$/,
|
|
13
14
|
date: /((^((1[8-9]\d{2})|([2-9]\d{3}))([-\/\._])(10|12|0?[13578])([-\/\._])(3[01]|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))([-\/\._])(11|0?[469])([-\/\._])(30|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))([-\/\._])(0?2)([-\/\._])(2[0-8]|1[0-9]|0?[1-9])$)|(^([2468][048]00)([-\/\._])(0?2)([-\/\._])(29)$)|(^([3579][26]00)([-\/\._])(0?2)([-\/\._])(29)$)|(^([1][89][0][48])([-\/\._])(0?2)([-\/\._])(29)$)|(^([2-9][0-9][0][48])([-\/\._])(0?2)([-\/\._])(29)$)|(^([1][89][2468][048])([-\/\._])(0?2)([-\/\._])(29)$)|(^([2-9][0-9][2468][048])([-\/\._])(0?2)([-\/\._])(29)$)|(^([1][89][13579][26])([-\/\._])(0?2)([-\/\._])(29)$)|(^([2-9][0-9][13579][26])([-\/\._])(0?2)([-\/\._])(29)$))/,
|
|
14
15
|
numVcode: /^[0-9]{4,8}$/,
|
|
@@ -58,6 +59,9 @@ export const validType = {
|
|
|
58
59
|
tel(value) {
|
|
59
60
|
return pattern.tel.test(String(value).trim());
|
|
60
61
|
},
|
|
62
|
+
internationalTel(value) {
|
|
63
|
+
return pattern.internationalTel.test(String(value).trim());
|
|
64
|
+
},
|
|
61
65
|
// 邮箱检测
|
|
62
66
|
email(value) {
|
|
63
67
|
return typeof value === 'string' && pattern.email.test(value.trim());
|
|
@@ -16,8 +16,8 @@ declare const FormPhone: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
|
16
16
|
disabled: boolean;
|
|
17
17
|
placeholder: string;
|
|
18
18
|
layout: "" | "vertical" | "horizontal";
|
|
19
|
-
labelVisible: boolean;
|
|
20
19
|
clearable: boolean;
|
|
20
|
+
labelVisible: boolean;
|
|
21
21
|
requiredFlag: boolean;
|
|
22
22
|
requiredMsg: string;
|
|
23
23
|
} & {
|
|
@@ -17,8 +17,8 @@ declare const FormTime: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
|
17
17
|
end: string;
|
|
18
18
|
start: string;
|
|
19
19
|
layout: "" | "vertical" | "horizontal";
|
|
20
|
-
labelVisible: boolean;
|
|
21
20
|
clearable: boolean;
|
|
21
|
+
labelVisible: boolean;
|
|
22
22
|
requiredFlag: boolean;
|
|
23
23
|
requiredMsg: string;
|
|
24
24
|
} & {
|
|
@@ -17,8 +17,8 @@ declare const FormUrl: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
|
17
17
|
maxLength: number;
|
|
18
18
|
placeholder: string;
|
|
19
19
|
layout: "" | "vertical" | "horizontal";
|
|
20
|
-
labelVisible: boolean;
|
|
21
20
|
clearable: boolean;
|
|
21
|
+
labelVisible: boolean;
|
|
22
22
|
requiredFlag: boolean;
|
|
23
23
|
requiredMsg: string;
|
|
24
24
|
} & {
|
|
@@ -3,11 +3,11 @@ import type { CommonPropsType } from '../../types';
|
|
|
3
3
|
import './style';
|
|
4
4
|
declare const _default: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
5
5
|
alignSelf?: string;
|
|
6
|
-
widthType: ("fit-content" | "auto-fill" | (1 | "1") | (2 | "2") | (3 | "3") | (4 | "4") | (5 | "5") | (6 | "6") | (7 | "7") | (8 | "8") | (9 |
|
|
6
|
+
widthType: ("fit-content" | "auto-fill" | (1 | "1") | (2 | "2") | (3 | "3") | (4 | "4") | (5 | "5") | (6 | "6") | (7 | "7") | (8 | "8") | ("9" | 9) | (10 | "10") | (11 | "11") | (12 | "12")) | {
|
|
7
7
|
type: string;
|
|
8
8
|
value: string;
|
|
9
9
|
};
|
|
10
|
-
lgWidthType: ("fit-content" | "auto-fill" | (1 | "1") | (2 | "2") | (3 | "3") | (4 | "4") | (5 | "5") | (6 | "6") | (7 | "7") | (8 | "8") | (9 |
|
|
10
|
+
lgWidthType: ("fit-content" | "auto-fill" | (1 | "1") | (2 | "2") | (3 | "3") | (4 | "4") | (5 | "5") | (6 | "6") | (7 | "7") | (8 | "8") | ("9" | 9) | (10 | "10") | (11 | "11") | (12 | "12")) | {
|
|
11
11
|
type: string;
|
|
12
12
|
value: string;
|
|
13
13
|
};
|
|
@@ -7,10 +7,10 @@ import classNames from '../../../utils/classnames';
|
|
|
7
7
|
* H5端 模态框
|
|
8
8
|
*/
|
|
9
9
|
export function Modal(props) {
|
|
10
|
-
const { onOk = noop, onClose = noop, visible, children, className, header, } = props;
|
|
10
|
+
const { onOk = noop, onClose = noop, visible, children, className, header, okButtonVisible = true, popupContainer, } = props;
|
|
11
11
|
const { classPrefix } = useConfig();
|
|
12
12
|
if (!visible)
|
|
13
13
|
return null;
|
|
14
|
-
const renderHeader = () => header ? (header) : (_jsxs("div", { className: `${classPrefix}-custom-picker__header`, children: [_jsx("div", { className: `${classPrefix}-custom-picker__header-cancle`, onClick: onClose, children: "\u53D6\u6D88" }), _jsx("div", { className: `${classPrefix}-custom-picker__header-confirm`, onClick: onOk, children: "\u786E\u5B9A" })] }));
|
|
15
|
-
return (_jsx(Portal, { type: "div", children: _jsxs("div", { className: classNames(`${classPrefix}-custom-picker`, className), children: [_jsx("div", { className: `${classPrefix}-custom-backdrop`, onClick: onClose }), _jsxs("div", { className: `${classPrefix}-custom-picker__inner`, children: [renderHeader(), _jsx("div", { className: `${classPrefix}-custom-picker__body`, children: children })] })] }) }));
|
|
14
|
+
const renderHeader = () => header ? (header) : (_jsxs("div", { className: `${classPrefix}-custom-picker__header`, children: [_jsx("div", { className: `${classPrefix}-custom-picker__header-cancle`, onClick: onClose, children: "\u53D6\u6D88" }), okButtonVisible && (_jsx("div", { className: `${classPrefix}-custom-picker__header-confirm`, onClick: onOk, children: "\u786E\u5B9A" }))] }));
|
|
15
|
+
return (_jsx(Portal, { type: "div", portalContainer: popupContainer, children: _jsxs("div", { className: classNames(`${classPrefix}-custom-picker`, className), children: [_jsx("div", { className: `${classPrefix}-custom-backdrop`, onClick: onClose }), _jsxs("div", { className: `${classPrefix}-custom-picker__inner`, children: [renderHeader(), _jsx("div", { className: `${classPrefix}-custom-picker__body`, children: children })] })] }) }));
|
|
16
16
|
}
|
|
@@ -86,7 +86,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
86
86
|
}
|
|
87
87
|
items.forEach((item) => {
|
|
88
88
|
if (item.handleValidate) {
|
|
89
|
-
const validate = item.handleValidate();
|
|
89
|
+
const validate = item.handleValidate(false);
|
|
90
90
|
const { name, label } = item;
|
|
91
91
|
if (validate) {
|
|
92
92
|
validatePromise.push(validate);
|
|
@@ -26,6 +26,7 @@ export declare const WdInput: React.ForwardRefExoticComponent<CommonPropsType &
|
|
|
26
26
|
suffixIcon?: string;
|
|
27
27
|
suffixSrc?: string;
|
|
28
28
|
labelWidth?: string;
|
|
29
|
+
clearable?: boolean;
|
|
29
30
|
inputValue?: string;
|
|
30
31
|
labelVisible?: boolean;
|
|
31
32
|
labelAlign?: string;
|
|
@@ -33,7 +34,6 @@ export declare const WdInput: React.ForwardRefExoticComponent<CommonPropsType &
|
|
|
33
34
|
labelTips?: string;
|
|
34
35
|
isNickNameType?: boolean;
|
|
35
36
|
cursorSpacing?: number;
|
|
36
|
-
clearable?: boolean;
|
|
37
37
|
isUnionValue?: boolean;
|
|
38
38
|
password?: boolean;
|
|
39
39
|
counterVisible?: boolean;
|
|
@@ -25,13 +25,13 @@ export declare const WdInputEmail: React.ForwardRefExoticComponent<CommonPropsTy
|
|
|
25
25
|
suffixIcon?: string;
|
|
26
26
|
suffixSrc?: string;
|
|
27
27
|
labelWidth?: string;
|
|
28
|
+
clearable?: boolean;
|
|
28
29
|
inputValue?: string;
|
|
29
30
|
labelVisible?: boolean;
|
|
30
31
|
labelAlign?: string;
|
|
31
32
|
labelWrap?: boolean;
|
|
32
33
|
labelTips?: string;
|
|
33
34
|
cursorSpacing?: number;
|
|
34
|
-
clearable?: boolean;
|
|
35
35
|
isUnionValue?: boolean;
|
|
36
36
|
counterVisible?: boolean;
|
|
37
37
|
borderedH5?: boolean;
|
|
@@ -42,6 +42,7 @@ export declare const WdInputPhone: React.ForwardRefExoticComponent<CommonPropsTy
|
|
|
42
42
|
suffixIcon?: string;
|
|
43
43
|
suffixSrc?: string;
|
|
44
44
|
labelWidth?: string;
|
|
45
|
+
clearable?: boolean;
|
|
45
46
|
inputValue?: string;
|
|
46
47
|
labelVisible?: boolean;
|
|
47
48
|
labelAlign?: string;
|
|
@@ -49,7 +50,6 @@ export declare const WdInputPhone: React.ForwardRefExoticComponent<CommonPropsTy
|
|
|
49
50
|
labelTips?: string;
|
|
50
51
|
isNickNameType?: boolean;
|
|
51
52
|
cursorSpacing?: number;
|
|
52
|
-
clearable?: boolean;
|
|
53
53
|
isUnionValue?: boolean;
|
|
54
54
|
password?: boolean;
|
|
55
55
|
counterVisible?: boolean;
|
|
@@ -41,13 +41,13 @@ export declare const WdInputUrl: React.ForwardRefExoticComponent<CommonPropsType
|
|
|
41
41
|
suffixIcon?: string;
|
|
42
42
|
suffixSrc?: string;
|
|
43
43
|
labelWidth?: string;
|
|
44
|
+
clearable?: boolean;
|
|
44
45
|
inputValue?: string;
|
|
45
46
|
labelVisible?: boolean;
|
|
46
47
|
labelAlign?: string;
|
|
47
48
|
labelWrap?: boolean;
|
|
48
49
|
labelTips?: string;
|
|
49
50
|
cursorSpacing?: number;
|
|
50
|
-
clearable?: boolean;
|
|
51
51
|
isUnionValue?: boolean;
|
|
52
52
|
counterVisible?: boolean;
|
|
53
53
|
borderedH5?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { WdFormItem } from '../wd-form-item';
|
|
@@ -11,7 +11,7 @@ import { useSyncValue } from '../../utils/hooks/useSyncValue';
|
|
|
11
11
|
import { useSetWidgetApi } from '../../utils/widget-api/use-set-widget-api';
|
|
12
12
|
import { calculateNextValue, calculatePercentByValueAndBoundary } from './util';
|
|
13
13
|
export const WdProgress = React.forwardRef(function FormProgress(props, inputRef) {
|
|
14
|
-
const { className, id, events, style, name, label, min = 0, max = 100, step = 1, } = props;
|
|
14
|
+
const { className, id, events, style, name, label, min = 0, max = 100, step = 1, percentSlot, showPercent = false, } = props;
|
|
15
15
|
const [innerHandle, setInnerHandle] = React.useState({});
|
|
16
16
|
const traitProps = { ...props, inputRef, setInnerHandle };
|
|
17
17
|
const { onChange: outerOnChange, disabled, readOnly, validateErrorMsg, validateState, visible, value: defaultValue, } = useFormInputTrait(traitProps);
|
|
@@ -30,6 +30,7 @@ export const WdProgress = React.forwardRef(function FormProgress(props, inputRef
|
|
|
30
30
|
visible,
|
|
31
31
|
disabled,
|
|
32
32
|
readOnly,
|
|
33
|
+
showPercent,
|
|
33
34
|
}), [
|
|
34
35
|
innerHandle,
|
|
35
36
|
name,
|
|
@@ -41,6 +42,7 @@ export const WdProgress = React.forwardRef(function FormProgress(props, inputRef
|
|
|
41
42
|
min,
|
|
42
43
|
max,
|
|
43
44
|
step,
|
|
45
|
+
showPercent,
|
|
44
46
|
], inputRef);
|
|
45
47
|
const active = !(readOnly || disabled);
|
|
46
48
|
const progressRef = React.useRef(null);
|
|
@@ -123,5 +125,5 @@ export const WdProgress = React.forwardRef(function FormProgress(props, inputRef
|
|
|
123
125
|
document.removeEventListener('touchmove', onTouchMove);
|
|
124
126
|
};
|
|
125
127
|
}, [cancelDragging, onMouseMove, onTouchMove, active]);
|
|
126
|
-
return (visible && (_jsx(WdFormItem, { ...props, testId: "form-progress", validateErrorMsg: validateErrorMsg, validateState: validateState, readValue: value, classRoot: 'progress', disabled: disabled, layout: props.layout, children:
|
|
128
|
+
return (visible && (_jsx(WdFormItem, { ...props, testId: "form-progress", validateErrorMsg: validateErrorMsg, validateState: validateState, readValue: value, classRoot: 'progress', disabled: disabled, layout: props.layout, children: _jsxs("div", { id: id, className: classNames(`${classPrefix}-${platform}-progress-container`, `${classPrefix}-progress-container`, className), style: style, "data-testid": "progress-container", children: [_jsx("div", { ref: progressRef, className: `${classPrefix}-progress`, children: _jsx("div", { className: `${classPrefix}-progress__value`, style: { width: `${percent}%` } }) }), showPercent && (_jsx("div", { className: `${classPrefix}-progress__percent`, children: percentSlot }))] }) })));
|
|
127
129
|
});
|