aha-components 1.5.9 → 1.6.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/Form.esm.js +1 -1
- package/dist/Form.esm.js.map +1 -1
- package/dist/Form.js +1 -1
- package/dist/Form.js.map +1 -1
- package/dist/components/Form/index.d.ts +15 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -32,6 +32,20 @@ export interface FormProps {
|
|
|
32
32
|
}
|
|
33
33
|
/** scrollToField 的选项,与 Element.scrollIntoView 一致 */
|
|
34
34
|
export type ScrollToFieldOptions = ScrollIntoViewOptions;
|
|
35
|
+
/** 校验失败时抛出的错误,携带 values 和 errorFields,便于 catch 后使用 */
|
|
36
|
+
export declare class FormValidationError extends Error {
|
|
37
|
+
/** 当前表单值 */
|
|
38
|
+
values: Record<string, any>;
|
|
39
|
+
/** 校验失败的字段列表 */
|
|
40
|
+
errorFields: Array<{
|
|
41
|
+
name: string;
|
|
42
|
+
errors: string[];
|
|
43
|
+
}>;
|
|
44
|
+
constructor(message: string, values: Record<string, any>, errorFields: Array<{
|
|
45
|
+
name: string;
|
|
46
|
+
errors: string[];
|
|
47
|
+
}>);
|
|
48
|
+
}
|
|
35
49
|
export interface FormInstance {
|
|
36
50
|
/** 获取字段值 */
|
|
37
51
|
getFieldValue: (name: string) => any;
|
|
@@ -55,7 +69,7 @@ export interface FormInstance {
|
|
|
55
69
|
validateFields: (nameList?: string[]) => Promise<any>;
|
|
56
70
|
/** 重置字段 */
|
|
57
71
|
resetFields: (nameList?: string[]) => void;
|
|
58
|
-
/**
|
|
72
|
+
/** 提交表单:校验通过时 resolve 表单值,校验失败时 reject 为 FormValidationError(需 await 或 .catch() 才能捕获) */
|
|
59
73
|
submit: () => Promise<any>;
|
|
60
74
|
/** 滚动到指定字段(如第一个报错项) */
|
|
61
75
|
scrollToField: (name: string, options?: ScrollToFieldOptions) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -750,7 +750,7 @@ interface FormInstance {
|
|
|
750
750
|
validateFields: (nameList?: string[]) => Promise<any>;
|
|
751
751
|
/** 重置字段 */
|
|
752
752
|
resetFields: (nameList?: string[]) => void;
|
|
753
|
-
/**
|
|
753
|
+
/** 提交表单:校验通过时 resolve 表单值,校验失败时 reject 为 FormValidationError(需 await 或 .catch() 才能捕获) */
|
|
754
754
|
submit: () => Promise<any>;
|
|
755
755
|
/** 滚动到指定字段(如第一个报错项) */
|
|
756
756
|
scrollToField: (name: string, options?: ScrollToFieldOptions) => void;
|