ny
昨天 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import type { VxeTablePropTypes } from 'vxe-table';
 
import type { PropType } from 'vue';
 
import type { FormProps } from '../../basicForm';
import type { PaginationProps } from './types/pagination';
import type { BasicColumn, FetchSetting, SorterResult, TableCustomRecord, TableRowSelection, TableSetting } from './types/table';
 
import { propTypes } from '@jnpf/utils';
 
import { DEFAULT_FILTER_FN, DEFAULT_SIZE, DEFAULT_VXE_SORT_FN, FETCH_SETTING } from './const';
 
export const basicProps = {
  actionColumn: {
    default: null,
    type: Object as PropType<BasicColumn>,
  },
  afterFetch: {
    default: null,
    type: Function as PropType<Fn>,
  },
  api: {
    default: null,
    type: Function as PropType<(...arg: any[]) => Promise<any>>,
  },
  autoCreateKey: { default: true, type: Boolean },
  beforeFetch: {
    default: null,
    type: Function as PropType<Fn>,
  },
  bordered: propTypes.bool,
  clearSelectOnPageChange: propTypes.bool,
  clickToRowSelect: { type: Boolean, default: true },
  columns: {
    default: () => [],
    type: Array as PropType<BasicColumn[]>,
  },
  dataSource: {
    default: null,
    type: Array as PropType<Recordable[]>,
  },
  defaultExpandAllRows: { default: true, type: Boolean },
  // 默认的排序参数
  defSort: {
    default: null,
    type: Object as PropType<Recordable>,
  },
  ellipsis: { default: true, type: Boolean },
  expandConfig: {
    default: () => null,
    type: Object as PropType<VxeTablePropTypes.ExpandConfig>,
  },
  fetchSetting: {
    default: () => {
      return FETCH_SETTING;
    },
    type: Object as PropType<FetchSetting>,
  },
  filterFn: {
    default: DEFAULT_FILTER_FN,
    type: Function as PropType<(data: Partial<Recordable<string[]>>) => any>,
  },
  footerMethod: {
    default: null,
    type: [Function, Array] as PropType<(...arg: any[]) => any[]>,
  },
  // 表单配置
  formConfig: {
    default: null,
    type: Object as PropType<Partial<FormProps>>,
  },
  handleSearchInfoFn: {
    default: null,
    type: Function as PropType<Fn>,
  },
  height: { default: '100%', type: [Number, String] },
  // 立即请求接口
  immediate: { default: true, type: Boolean },
  indentSize: propTypes.number.def(24),
  indexColumnProps: {
    default: null,
    type: Object as PropType<BasicColumn>,
  },
  isTreeTable: Boolean,
  loading: propTypes.bool,
  pagination: {
    default: null,
    type: [Object, Boolean] as PropType<boolean | PaginationProps>,
  },
  rowClassName: {
    type: Function as PropType<(record: TableCustomRecord<any>, index: number) => string>,
  },
  rowKey: {
    default: '',
    type: [String, Function] as PropType<((record: Recordable) => string) | string>,
  },
  rowSelection: {
    default: null,
    type: Object as PropType<null | TableRowSelection>,
  },
  // 额外的请求参数
  searchInfo: {
    default: null,
    type: Object as PropType<Recordable>,
  },
  showExpandColumn: { default: false, type: Boolean },
  showFooter: Boolean,
  showIndexColumn: { default: true, type: Boolean },
  showTableSetting: { default: true, type: Boolean },
  size: {
    default: DEFAULT_SIZE,
    type: String as PropType<string>,
  },
  sortFn: {
    default: DEFAULT_VXE_SORT_FN,
    type: Function as PropType<(sortInfo: SorterResult) => any>,
  },
  tableSetting: propTypes.shape<TableSetting>({
    expand: propTypes.bool,
  }),
 
  treeConfig: {
    default: () => null,
    type: Object as PropType<VxeTablePropTypes.TreeConfig>,
  },
  // 使用搜索表单
  useSearchForm: propTypes.bool,
};