-
Notifications
You must be signed in to change notification settings - Fork 138
/
types.ts
114 lines (100 loc) · 2.89 KB
/
types.ts
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
/**
* @license
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { PortalTargetType } from '@idux/cdk/portal'
import type { FormSize } from '@idux/components/form'
import type { ProFormSchemaFormatter } from '@idux/pro/form'
import type { ProLocale } from '@idux/pro/locales'
import type { ProSearchSize } from '@idux/pro/search'
import type { ProTableColumnIndexable } from '@idux/pro/table'
import type { TextareaResize } from '@idux/pro/textarea'
import type { Options as AjvOptions } from 'ajv'
import type { Component, VNode } from 'vue'
export interface ProGlobalConfig {
common: ProCommonConfig
locale: ProLocale
form: ProFormConfig
table: ProTableConfig
tagSelect: ProTagSelectConfig
tree: ProTreeConfig
textarea: ProTextareaConfig
search: ProSearchConfig
}
export type ProGlobalConfigKey = keyof ProGlobalConfig
export interface ProCommonConfig {
prefixCls: string
}
interface ProFormConfigFormatComponent {
component?: string | Component
componentProps?: any
}
export interface ProFormConfig {
/**
* [ajv](https://ajv.js.org/options.html) 参数
*/
ajvOptions: AjvOptions
autoId: boolean
autoLabelFor: boolean
/**
* 根据 format 字段渲染的组件
*
* @example { 'date': { component: IxDatePicker, componentProps: { format: 'dd/MM/yyyy' }}}
*/
formatComponents: {
default?: ProFormConfigFormatComponent
data?: ProFormConfigFormatComponent
time?: ProFormConfigFormatComponent
'date-time'?: ProFormConfigFormatComponent
uri?: ProFormConfigFormatComponent
email?: ProFormConfigFormatComponent
ipv4?: ProFormConfigFormatComponent
ipv6?: ProFormConfigFormatComponent
[key: string]: ProFormConfigFormatComponent | undefined
}
/**
* 忽略某些数据类型 (type) 的校验, 默认:['type', 'enum']
*/
ignoreKeywords: string[]
schemaFormatter: ProFormSchemaFormatter
}
export interface ProTableConfig {
// @deprecated please use `columnIndexable` of TableConfig instead'
columnIndexable?: Omit<ProTableColumnIndexable, 'type'>
layoutTool: {
changeSize: boolean
resetable: boolean
searchable: boolean
}
}
export interface ProTagSelectConfig {
borderless: boolean
clearable: boolean
clearIcon: string
size: FormSize
suffix: string
}
export interface ProTreeConfig {
clearIcon: string
collapseIcon: [string, string]
}
export interface ProSearchConfig {
clearable: boolean
clearIcon: string | VNode
searchIcon: string | VNode
size: ProSearchSize
overlayContainer?: PortalTargetType
}
export interface ProTextareaConfig {
clearable: boolean
clearIcon: string
computeCount?: (value: string) => string
maxCount?: number | string
resize: TextareaResize
size: FormSize
showCount: boolean
trim: boolean
}