-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathtypes.ts
More file actions
85 lines (78 loc) · 2.59 KB
/
types.ts
File metadata and controls
85 lines (78 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import type {
RuleItem,
ValidateError,
ValidateFieldsError
} from 'async-validator';
import type { Ref, ComputedRef } from 'vue';
import type { Nullable, Enumerable, ClassValue } from '#/helpers';
export interface FilteredRuleItem extends RuleItem {
trigger?: Nullable<string>;
}
export type QFormItemPropFor = Nullable<string>;
export type QFormItemPropProp = Nullable<string>;
export type QFormItemPropLabel = Nullable<string>;
export type QFormItemPropSublabel = Nullable<string>;
export type QFormItemPropError = Nullable<string>;
export type QFormItemPropRules = Nullable<Enumerable<FilteredRuleItem>>;
export type QFormItemPropShowErrorMessage = Nullable<boolean>;
export type QFormItemPropLabelSize = Nullable<'regular' | 'small'>;
export interface QFormItemProps {
for: QFormItemPropFor;
prop: QFormItemPropProp;
label: QFormItemPropLabel;
sublabel: QFormItemPropSublabel;
error: QFormItemPropError;
rules: QFormItemPropRules;
showErrorMessage: QFormItemPropShowErrorMessage;
labelSize: QFormItemPropLabelSize;
}
export interface QFormItemContext {
validateField: (trigger?: Nullable<string>) => Nullable<
Promise<{
errors?: Nullable<ValidateError[]>;
fields?: ValidateFieldsError;
}>
>;
clearValidate: () => void;
errorMessage: Ref<Nullable<string>>;
getFilteredRules: (trigger: Nullable<string>) => Nullable<FilteredRuleItem[]>;
initialValue: unknown;
isErrorSlotShown: ComputedRef<boolean>;
isHeaderShown: ComputedRef<boolean>;
isRequired: ComputedRef<boolean>;
labelFor: ComputedRef<string>;
resetField: () => void;
rootClasses: ComputedRef<ClassValue>;
rules: Nullable<FilteredRuleItem | FilteredRuleItem[]>;
showErrorMessage: Nullable<boolean>;
for: Nullable<string>;
prop: Nullable<string>;
label: Nullable<string>;
sublabel: Nullable<string>;
}
export interface QFormItemProvider {
validateField: (trigger?: Nullable<string>) => Nullable<
Promise<{
errors?: Nullable<ValidateError[]>;
fields?: ValidateFieldsError;
}>
>;
resetField: () => void;
}
export interface QFormItemInstance {
errorMessage: Ref<Nullable<string>>;
isErrorSlotShown: ComputedRef<boolean>;
labelFor: ComputedRef<string>;
isRequired: ComputedRef<boolean>;
isHeaderShown: ComputedRef<boolean>;
rootClasses: ComputedRef<ClassValue>;
getFilteredRules: (trigger: Nullable<string>) => Nullable<FilteredRuleItem[]>;
validateField: (trigger?: Nullable<string>) => Nullable<
Promise<{
errors?: Nullable<ValidateError[]>;
fields?: ValidateFieldsError;
}>
>;
resetField: () => void;
labelClass: ComputedRef<ClassValue>;
}