UNPKG

3.09 kBTypeScriptView Raw
1import {Button, Col, Popover, Row, Tooltip} from "element-ui";
2import {FormData, VNodeData} from "@form-create/core";
3import {ElementUIComponentSize} from "element-ui/types/component";
4import {FormItemLabelPosition, ValidateCallback, ValidateFieldCallback} from "element-ui/types/form";
5import {Api} from "./index";
6
7export interface OptionAttrs {
8 col?: Boolean | Col & {
9 labelWidth?: number | string;
10 show?: Boolean;
11 };
12 row?: Boolean | Row & {
13 show?: Boolean;
14 };
15 info?: Boolean | (Tooltip | Popover) & VNodeData & {
16 show?: Boolean;
17 native?: Boolean;
18 icon?: string;
19 align?: 'left' | 'right';
20 info?: string;
21 };
22 wrap?: Boolean | VNodeData & {
23 labelWidth?: string
24 required?: boolean
25 error?: string
26 showMessage?: boolean
27 inlineMessage?: boolean
28 size?: ElementUIComponentSize
29 show?: Boolean;
30 };
31 form?: {
32 inline?: boolean
33 disabled?: boolean
34 labelPosition?: FormItemLabelPosition
35 labelWidth?: string
36 labelSuffix?: string
37 showMessage?: boolean
38 inlineMessage?: boolean
39 statusIcon?: boolean
40 validateOnRuleChange?: boolean
41 size?: ElementUIComponentSize
42 className?: any;
43 col?: Boolean;
44 };
45
46 submitBtn?: Boolean | Button & {
47 click?: Function;
48 innerText?: string;
49 show?: Boolean;
50 };
51
52 resetBtn?: Boolean | Button & {
53 click?: Function;
54 innerText?: string;
55 show?: Boolean;
56 };
57
58}
59
60declare const optionAttrs: OptionAttrs & {
61 title?: Boolean | VNodeData & {
62 show?: Boolean;
63 native?: Boolean;
64 title?: string;
65 };
66};
67
68interface children {
69 children?: VNodeData[]
70}
71
72export interface CreatorAttrs {
73 col(props: typeof optionAttrs.col): this;
74
75 wrap(props: typeof optionAttrs.wrap): this;
76
77 title(props: string | typeof optionAttrs.title & children): this;
78
79 info(props: string | typeof optionAttrs.info & children): this;
80
81 className(prop: string): this;
82
83}
84
85export interface RuleAttrs {
86 col?: typeof optionAttrs.col;
87 wrap?: typeof optionAttrs.wrap;
88 title?: string | typeof optionAttrs.title & children;
89 info?: string | typeof optionAttrs.info & children;
90 className?: string;
91}
92
93export interface ApiAttrs {
94 btn: {
95 loading(loading: boolean): void;
96 disabled(disabled: boolean): void;
97 show(show: boolean): void;
98 }
99 resetBtn: {
100 loading(loading: boolean): void;
101 disabled(disabled: boolean): void;
102 show(show: boolean): void;
103 }
104
105 submit(success: (formData: FormData, $f: Api) => void, fail: ($f: Api) => void): void;
106
107 clearValidateState(fields?: string | string[], clearSub?: Boolean): void;
108
109 clearSubValidateState(fields?: string | string[]): void;
110
111 validate(callback?: ValidateCallback): void;
112
113 validateField(field: string, callback?: ValidateFieldCallback): void;
114
115 submitBtnProps(props: Button): void;
116
117 resetBtnProps(props: Button): void;
118
119}
\No newline at end of file