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