Commit 03b17a8f8bdb50322aa10e3b614bcc40b9e9dcc8

Authored by lzdjack
Committed by GitHub
1 parent 8832a074

fix(formItem): Fix labelcol type mismatch (#903)

*修复antdv升级后formItem中labelCol没有类型style的bug
src/components/Form/src/types/formItem.ts
1 -import type { NamePath } from 'ant-design-vue/lib/form/interface';  
2 -import type { ColProps } from 'ant-design-vue/lib/grid/Col';  
3 -import type { VNodeChild } from 'vue';  
4 -  
5 -export interface FormItem {  
6 - /**  
7 - * Used with label, whether to display : after label text.  
8 - * @default true  
9 - * @type boolean  
10 - */  
11 - colon?: boolean;  
12 -  
13 - /**  
14 - * The extra prompt message. It is similar to help. Usage example: to display error message and prompt message at the same time.  
15 - * @type any (string | slot)  
16 - */  
17 - extra?: string | VNodeChild | JSX.Element;  
18 -  
19 - /**  
20 - * Used with validateStatus, this option specifies the validation status icon. Recommended to be used only with Input.  
21 - * @default false  
22 - * @type boolean  
23 - */  
24 - hasFeedback?: boolean;  
25 -  
26 - /**  
27 - * The prompt message. If not provided, the prompt message will be generated by the validation rule.  
28 - * @type any (string | slot)  
29 - */  
30 - help?: string | VNodeChild | JSX.Element;  
31 -  
32 - /**  
33 - * Label test  
34 - * @type any (string | slot)  
35 - */  
36 - label?: string | VNodeChild | JSX.Element;  
37 -  
38 - /**  
39 - * The layout of label. You can set span offset to something like {span: 3, offset: 12} or sm: {span: 3, offset: 12} same as with <Col>  
40 - * @type Col  
41 - */  
42 - labelCol?: ColProps;  
43 -  
44 - /**  
45 - * Whether provided or not, it will be generated by the validation rule.  
46 - * @default false  
47 - * @type boolean  
48 - */  
49 - required?: boolean;  
50 -  
51 - /**  
52 - * The validation status. If not provided, it will be generated by validation rule. options: 'success' 'warning' 'error' 'validating'  
53 - * @type string  
54 - */  
55 - validateStatus?: '' | 'success' | 'warning' | 'error' | 'validating';  
56 -  
57 - /**  
58 - * The layout for input controls, same as labelCol  
59 - * @type Col  
60 - */  
61 - wrapperCol?: ColProps;  
62 - /**  
63 - * Set sub label htmlFor.  
64 - */  
65 - htmlFor?: string;  
66 - /**  
67 - * text align of label  
68 - */  
69 - labelAlign?: 'left' | 'right';  
70 - /**  
71 - * a key of model. In the setting of validate and resetFields method, the attribute is required  
72 - */  
73 - name?: NamePath;  
74 - /**  
75 - * validation rules of form  
76 - */  
77 - rules?: object | object[];  
78 - /**  
79 - * Whether to automatically associate form fields. In most cases, you can setting automatic association.  
80 - * If the conditions for automatic association are not met, you can manually associate them. See the notes below.  
81 - */  
82 - autoLink?: boolean;  
83 - /**  
84 - * Whether stop validate on first rule of error for this field.  
85 - */  
86 - validateFirst?: boolean;  
87 - /**  
88 - * When to validate the value of children node  
89 - */  
90 - validateTrigger?: string | string[] | false;  
91 -} 1 +import type { NamePath } from 'ant-design-vue/lib/form/interface';
  2 +import type { ColProps } from 'ant-design-vue/lib/grid/Col';
  3 +import type { HTMLAttributes, VNodeChild } from 'vue';
  4 +
  5 +export interface FormItem {
  6 + /**
  7 + * Used with label, whether to display : after label text.
  8 + * @default true
  9 + * @type boolean
  10 + */
  11 + colon?: boolean;
  12 +
  13 + /**
  14 + * The extra prompt message. It is similar to help. Usage example: to display error message and prompt message at the same time.
  15 + * @type any (string | slot)
  16 + */
  17 + extra?: string | VNodeChild | JSX.Element;
  18 +
  19 + /**
  20 + * Used with validateStatus, this option specifies the validation status icon. Recommended to be used only with Input.
  21 + * @default false
  22 + * @type boolean
  23 + */
  24 + hasFeedback?: boolean;
  25 +
  26 + /**
  27 + * The prompt message. If not provided, the prompt message will be generated by the validation rule.
  28 + * @type any (string | slot)
  29 + */
  30 + help?: string | VNodeChild | JSX.Element;
  31 +
  32 + /**
  33 + * Label test
  34 + * @type any (string | slot)
  35 + */
  36 + label?: string | VNodeChild | JSX.Element;
  37 +
  38 + /**
  39 + * The layout of label. You can set span offset to something like {span: 3, offset: 12} or sm: {span: 3, offset: 12} same as with <Col>
  40 + * @type Col
  41 + */
  42 + labelCol?: ColProps & HTMLAttributes;
  43 +
  44 + /**
  45 + * Whether provided or not, it will be generated by the validation rule.
  46 + * @default false
  47 + * @type boolean
  48 + */
  49 + required?: boolean;
  50 +
  51 + /**
  52 + * The validation status. If not provided, it will be generated by validation rule. options: 'success' 'warning' 'error' 'validating'
  53 + * @type string
  54 + */
  55 + validateStatus?: '' | 'success' | 'warning' | 'error' | 'validating';
  56 +
  57 + /**
  58 + * The layout for input controls, same as labelCol
  59 + * @type Col
  60 + */
  61 + wrapperCol?: ColProps;
  62 + /**
  63 + * Set sub label htmlFor.
  64 + */
  65 + htmlFor?: string;
  66 + /**
  67 + * text align of label
  68 + */
  69 + labelAlign?: 'left' | 'right';
  70 + /**
  71 + * a key of model. In the setting of validate and resetFields method, the attribute is required
  72 + */
  73 + name?: NamePath;
  74 + /**
  75 + * validation rules of form
  76 + */
  77 + rules?: object | object[];
  78 + /**
  79 + * Whether to automatically associate form fields. In most cases, you can setting automatic association.
  80 + * If the conditions for automatic association are not met, you can manually associate them. See the notes below.
  81 + */
  82 + autoLink?: boolean;
  83 + /**
  84 + * Whether stop validate on first rule of error for this field.
  85 + */
  86 + validateFirst?: boolean;
  87 + /**
  88 + * When to validate the value of children node
  89 + */
  90 + validateTrigger?: string | string[] | false;
  91 +}