UNPKG

3.01 kBTypeScriptView Raw
1import {FormData, VNodeRule} from "@form-create/core";
2import {Button, Col, Popover, Row, Tooltip} from "ant-design-vue";
3import {Api} from "./index";
4
5export interface OptionAttrs {
6 col?: Boolean | Col & {
7 labelWidth?: number | string;
8 show?: Boolean;
9 };
10 row?: Boolean | Row & {
11 show?: Boolean;
12 };
13 info?: Boolean | (Tooltip | Popover) & VNodeRule & {
14 show?: Boolean;
15 native?: Boolean;
16 icon?: string;
17 align?: 'left' | 'right';
18 info?: string;
19 };
20 wrap?: Boolean | VNodeRule & {
21 colon?: boolean;
22 extra?: any;
23 hasFeedback?: boolean;
24 help?: any;
25 label?: any;
26 labelCol?: Col;
27 required?: boolean;
28 validateStatus?: '' | 'success' | 'warning' | 'error' | 'validating';
29 wrapperCol?: Col;
30 labelAlign?: 'left' | 'right';
31 autoLink?: boolean;
32 show?: Boolean;
33 };
34 form?: {
35 hideRequiredMark?: boolean;
36 labelCol?: Col;
37 layout?: 'horizontal' | 'inline' | 'vertical';
38 wrapperCol?: Col;
39 colon?: boolean;
40 labelAlign?: 'left' | 'right';
41 validateMessages?: any;
42 validateOnRuleChange?: boolean;
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
61declare const optionAttrs: OptionAttrs & {
62 title?: Boolean | VNodeRule & {
63 show?: Boolean;
64 native?: Boolean;
65 title?: string;
66 };
67};
68
69export 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
82export 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
90export 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 submit(success: (formData: FormData, api: Api) => void, fail: (api: Api) => void): void;
103
104 clearValidateState(fields?: string | string[], clearSub?: Boolean): void;
105
106 clearSubValidateState(fields?: string | string[]): void;
107
108 validate(callback?: (callback?: (boolean: boolean, object: Object) => void) => void): void;
109
110 validateField(field: string, callback?: (errorMessage: string) => void): void;
111
112 submitBtnProps(props: Button): void;
113
114 resetBtnProps(props: Button): void;
115
116}