1sm
2021-12-28 f964533701389109d90144cbefff7042cdcedbf6
提交 | 用户 | age
2f6253 1 import type { FieldMapToTime, FormSchema } from './types/form';
4ff1c4 2 import type { CSSProperties, PropType } from 'vue';
2f6253 3 import type { ColEx } from './types';
4ff1c4 4 import type { TableActionType } from '/@/components/Table';
V 5 import type { ButtonProps } from 'ant-design-vue/es/button/buttonTypes';
785732 6 import type { RowProps } from 'ant-design-vue/lib/grid/Row';
4ff1c4 7 import { propTypes } from '/@/utils/propTypes';
2f6253 8
9 export const basicProps = {
84c9d7 10   model: {
4ff1c4 11     type: Object as PropType<Recordable>,
84c9d7 12     default: {},
V 13   },
2f6253 14   // 标签宽度  固定宽度
15   labelWidth: {
16     type: [Number, String] as PropType<number | string>,
17     default: 0,
18   },
19   fieldMapToTime: {
20     type: Array as PropType<FieldMapToTime>,
21     default: () => [],
22   },
4ff1c4 23   compact: propTypes.bool,
2f6253 24   // 表单配置规则
25   schemas: {
26     type: [Array] as PropType<FormSchema[]>,
27     default: () => [],
28   },
29   mergeDynamicData: {
4ff1c4 30     type: Object as PropType<Recordable>,
2f6253 31     default: null,
32   },
b9d3d6 33   baseRowStyle: {
4ff1c4 34     type: Object as PropType<CSSProperties>,
b9d3d6 35   },
2f6253 36   baseColProps: {
4ff1c4 37     type: Object as PropType<Partial<ColEx>>,
2f6253 38   },
4ff1c4 39   autoSetPlaceHolder: propTypes.bool.def(true),
9b2d41 40   // 在INPUT组件上单击回车时,是否自动提交
N 41   autoSubmitOnEnter: propTypes.bool.def(false),
4ff1c4 42   submitOnReset: propTypes.bool,
f96453 43   submitOnChange: propTypes.bool,
4ff1c4 44   size: propTypes.oneOf(['default', 'small', 'large']).def('default'),
2f6253 45   // 禁用表单
4ff1c4 46   disabled: propTypes.bool,
2f6253 47   emptySpan: {
48     type: [Number, Object] as PropType<number>,
49     default: 0,
50   },
51   // 是否显示收起展开按钮
4ff1c4 52   showAdvancedButton: propTypes.bool,
2f6253 53   // 转化时间
54   transformDateFunc: {
55     type: Function as PropType<Fn>,
56     default: (date: any) => {
3fcfac 57       return date?.format?.('YYYY-MM-DD HH:mm:ss') ?? date;
2f6253 58     },
59   },
4ff1c4 60   rulesMessageJoinLabel: propTypes.bool.def(true),
2f6253 61   // 超过3行自动折叠
4ff1c4 62   autoAdvancedLine: propTypes.number.def(3),
93f9a1 63   // 不受折叠影响的行数
64   alwaysShowLines: propTypes.number.def(1),
2f6253 65
66   // 是否显示操作按钮
4ff1c4 67   showActionButtonGroup: propTypes.bool.def(true),
2f6253 68   // 操作列Col配置
4ff1c4 69   actionColOptions: Object as PropType<Partial<ColEx>>,
2f6253 70   // 显示重置按钮
4ff1c4 71   showResetButton: propTypes.bool.def(true),
ac1a36 72   // 是否聚焦第一个输入框,只在第一个表单项为input的时候作用
V 73   autoFocusFirstItem: propTypes.bool,
2f6253 74   // 重置按钮配置
4ff1c4 75   resetButtonOptions: Object as PropType<Partial<ButtonProps>>,
2f6253 76
77   // 显示确认按钮
4ff1c4 78   showSubmitButton: propTypes.bool.def(true),
2f6253 79   // 确认按钮配置
4ff1c4 80   submitButtonOptions: Object as PropType<Partial<ButtonProps>>,
2f6253 81
82   // 自定义重置函数
4ff1c4 83   resetFunc: Function as PropType<() => Promise<void>>,
V 84   submitFunc: Function as PropType<() => Promise<void>>,
2f6253 85
86   // 以下为默认props
4ff1c4 87   hideRequiredMark: propTypes.bool,
2f6253 88
4ff1c4 89   labelCol: Object as PropType<Partial<ColEx>>,
2f6253 90
4ff1c4 91   layout: propTypes.oneOf(['horizontal', 'vertical', 'inline']).def('horizontal'),
5832ee 92   tableAction: {
V 93     type: Object as PropType<TableActionType>,
94   },
2f6253 95
4ff1c4 96   wrapperCol: Object as PropType<Partial<ColEx>>,
2f6253 97
4ff1c4 98   colon: propTypes.bool,
2f6253 99
4ff1c4 100   labelAlign: propTypes.string,
785732 101
L 102   rowProps: Object as PropType<RowProps>,
2f6253 103 };