vben
2020-10-25 d09406e3cb8cfc069ce79b5f4194f7d959f63daf
提交 | 用户 | age
2f6253 1 import type { FieldMapToTime, FormSchema } from './types/form';
2 import type { PropType } from 'vue';
3 import type { ColEx } from './types';
4
5 export const basicProps = {
6   // 标签宽度  固定宽度
7   labelWidth: {
8     type: [Number, String] as PropType<number | string>,
9     default: 0,
10   },
11   fieldMapToTime: {
12     type: Array as PropType<FieldMapToTime>,
13     default: () => [],
14   },
15   compact: Boolean as PropType<boolean>,
16   // 表单配置规则
17   schemas: {
18     type: [Array] as PropType<FormSchema[]>,
19     default: () => [],
20     required: true,
21   },
22   mergeDynamicData: {
23     type: Object as PropType<any>,
24     default: null,
25   },
26   baseColProps: {
27     type: Object as PropType<any>,
28   },
29   autoSetPlaceHolder: {
30     type: Boolean,
31     default: true,
32   },
d09406 33   submitOnReset: {
V 34     type: Boolean,
35     default: false,
36   },
2f6253 37   size: {
38     type: String as PropType<'default' | 'small' | 'large'>,
39     default: 'default',
40   },
41   // 禁用表单
42   disabled: Boolean as PropType<boolean>,
43   emptySpan: {
44     type: [Number, Object] as PropType<number>,
45     default: 0,
46   },
47   // 是否显示收起展开按钮
48   showAdvancedButton: { type: Boolean as PropType<boolean>, default: false },
49   // 转化时间
50   transformDateFunc: {
51     type: Function as PropType<Fn>,
52     default: (date: any) => {
53       return date._isAMomentObject ? date.format('YYYY-MM-DD HH:mm:ss') : date;
54     },
55   },
56   rulesMessageJoinLabel: {
57     type: Boolean,
58     default: true,
59   },
60   // 超过3行自动折叠
61   autoAdvancedLine: {
62     type: Number as PropType<number>,
63     default: 3,
64   },
65
66   // 是否显示操作按钮
67   showActionButtonGroup: {
68     type: Boolean as PropType<boolean>,
69     default: true,
70   },
71   // 操作列Col配置
72   actionColOptions: Object as PropType<ColEx>,
73   // 显示重置按钮
74   showResetButton: {
75     type: Boolean as PropType<boolean>,
76     default: true,
77   },
78   // 重置按钮配置
79   resetButtonOptions: Object as PropType<any>,
80
81   // 显示确认按钮
82   showSubmitButton: {
83     type: Boolean as PropType<boolean>,
84     default: true,
85   },
86   // 确认按钮配置
87   submitButtonOptions: Object as PropType<any>,
88
89   // 自定义重置函数
90   resetFunc: Function as PropType<Fn>,
91   submitFunc: Function as PropType<Fn>,
92
93   // 以下为默认props
94   hideRequiredMark: Boolean as PropType<boolean>,
95
96   labelCol: Object as PropType<ColEx>,
97
98   layout: {
99     type: String as PropType<'horizontal' | 'vertical' | 'inline'>,
100     default: 'horizontal',
101   },
102
103   wrapperCol: Object as PropType<any>,
104
105   colon: {
106     type: Boolean as PropType<boolean>,
107     default: false,
108   },
109
110   labelAlign: String as PropType<string>,
111 };