el-plus-crud 0.0.38 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +78 -78
- package/.prettierrc.js +39 -39
- package/CHANGELOG.md +7 -5
- package/build.js +31 -31
- package/dist/el-plus-crud.mjs +2750 -2722
- package/dist/el-plus-crud.umd.js +14 -14
- package/dist/style.css +1 -1
- package/example/App.vue +67 -67
- package/example/main.js +18 -18
- package/index.html +13 -13
- package/lib/components/el-plus-form/ElPlusForm.vue +774 -772
- package/lib/components/el-plus-form/ElPlusFormDialog.vue +90 -90
- package/lib/components/el-plus-form/ElPlusFormGroup.vue +116 -116
- package/lib/components/el-plus-form/components/ElPlusFormArea.vue +61 -61
- package/lib/components/el-plus-form/components/ElPlusFormAutocomplete.vue +49 -49
- package/lib/components/el-plus-form/components/ElPlusFormBtn.vue +102 -102
- package/lib/components/el-plus-form/components/ElPlusFormBtns.vue +133 -133
- package/lib/components/el-plus-form/components/ElPlusFormCascader.vue +63 -63
- package/lib/components/el-plus-form/components/ElPlusFormCascaderPanel.vue +53 -51
- package/lib/components/el-plus-form/components/ElPlusFormCheckbox.vue +44 -42
- package/lib/components/el-plus-form/components/ElPlusFormCheckboxButton.vue +44 -42
- package/lib/components/el-plus-form/components/ElPlusFormColor.vue +38 -38
- package/lib/components/el-plus-form/components/ElPlusFormDate.vue +39 -39
- package/lib/components/el-plus-form/components/ElPlusFormDaterange.vue +46 -44
- package/lib/components/el-plus-form/components/ElPlusFormDatetime.vue +40 -38
- package/lib/components/el-plus-form/components/ElPlusFormDatetimerange.vue +3 -1
- package/lib/components/el-plus-form/components/ElPlusFormFile.vue +47 -47
- package/lib/components/el-plus-form/components/ElPlusFormImage.vue +113 -113
- package/lib/components/el-plus-form/components/ElPlusFormInput.vue +3 -1
- package/lib/components/el-plus-form/components/ElPlusFormLink.vue +281 -281
- package/lib/components/el-plus-form/components/ElPlusFormLkuser.vue +489 -489
- package/lib/components/el-plus-form/components/ElPlusFormNbinput.vue +53 -51
- package/lib/components/el-plus-form/components/ElPlusFormNumber.vue +146 -144
- package/lib/components/el-plus-form/components/ElPlusFormPassword.vue +3 -1
- package/lib/components/el-plus-form/components/ElPlusFormQuickInput.vue +94 -92
- package/lib/components/el-plus-form/components/ElPlusFormRadio.vue +42 -42
- package/lib/components/el-plus-form/components/ElPlusFormRate.vue +38 -38
- package/lib/components/el-plus-form/components/ElPlusFormSelect.vue +161 -161
- package/lib/components/el-plus-form/components/ElPlusFormSlider.vue +38 -38
- package/lib/components/el-plus-form/components/ElPlusFormSwitch.vue +38 -38
- package/lib/components/el-plus-form/components/ElPlusFormTag.vue +78 -78
- package/lib/components/el-plus-form/components/ElPlusFormText.vue +99 -99
- package/lib/components/el-plus-form/components/ElPlusFormTextarea.vue +49 -47
- package/lib/components/el-plus-form/components/ElPlusFormTransfer.vue +44 -44
- package/lib/components/el-plus-form/components/ElPlusFormTree.vue +76 -76
- package/lib/components/el-plus-form/components/ElPlusFormTreeSelect.vue +59 -59
- package/lib/components/el-plus-form/components/ElPlusFormUpload.vue +368 -368
- package/lib/components/el-plus-form/components/components/file-icons/FileIcons.vue +135 -135
- package/lib/components/el-plus-form/components/components/file-icons/data/index.ts +27 -27
- package/lib/components/el-plus-form/components/components/file-icons/images/doc.svg +12 -12
- package/lib/components/el-plus-form/components/components/file-icons/images/file.svg +18 -18
- package/lib/components/el-plus-form/components/components/file-icons/images/jpg.svg +13 -13
- package/lib/components/el-plus-form/components/components/file-icons/images/pdf.svg +12 -12
- package/lib/components/el-plus-form/components/components/file-icons/images/png.svg +12 -12
- package/lib/components/el-plus-form/components/components/file-icons/images/ppt.svg +12 -12
- package/lib/components/el-plus-form/components/components/file-icons/images/xls.svg +12 -12
- package/lib/components/el-plus-form/components/index.ts +17 -17
- package/lib/components/el-plus-form/data/file.ts +74 -74
- package/lib/components/el-plus-form/mixins/index.ts +113 -113
- package/lib/components/el-plus-form/util/index.ts +257 -257
- package/lib/components/el-plus-form/util/validate.ts +332 -332
- package/lib/components/el-plus-table/components/columnItem.vue +205 -205
- package/lib/components/el-plus-table/components/header.vue +240 -240
- package/lib/components/el-plus-table/components/statisticInfo.vue +47 -47
- package/lib/components/el-plus-table/util/index.ts +147 -147
- package/lib/config/index.ts +30 -30
- package/lib/index.d.ts +4 -4
- package/lib/index.ts +51 -51
- package/package.json +1 -1
- package/types/axios.d.ts +13 -13
- package/types/formList.d.ts +440 -440
- package/types/layout.d.ts +57 -57
- package/types/mitt.d.ts +38 -38
- package/types/pinia.d.ts +149 -149
- package/types/views.d.ts +329 -329
- package/vite.config.ts +78 -78
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 这里加载当前文件夹下的所有Vue组件
|
|
3
|
-
*/
|
|
4
|
-
const modulesFiles = import.meta.globEager('./*.vue')
|
|
5
|
-
|
|
6
|
-
const components: any[] = []
|
|
7
|
-
const typeList: String[] = []
|
|
8
|
-
|
|
9
|
-
// 递归
|
|
10
|
-
for (const file in modulesFiles) {
|
|
11
|
-
const tempComponent = (modulesFiles[file] as any).default
|
|
12
|
-
components.push(tempComponent)
|
|
13
|
-
if (tempComponent.typeName) {
|
|
14
|
-
typeList.push(tempComponent.typeName)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export { components, typeList }
|
|
1
|
+
/**
|
|
2
|
+
* 这里加载当前文件夹下的所有Vue组件
|
|
3
|
+
*/
|
|
4
|
+
const modulesFiles = import.meta.globEager('./*.vue')
|
|
5
|
+
|
|
6
|
+
const components: any[] = []
|
|
7
|
+
const typeList: String[] = []
|
|
8
|
+
|
|
9
|
+
// 递归
|
|
10
|
+
for (const file in modulesFiles) {
|
|
11
|
+
const tempComponent = (modulesFiles[file] as any).default
|
|
12
|
+
components.push(tempComponent)
|
|
13
|
+
if (tempComponent.typeName) {
|
|
14
|
+
typeList.push(tempComponent.typeName)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export { components, typeList }
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 能够上传的图片类型
|
|
3
|
-
*/
|
|
4
|
-
export const imageTypes = ['image/jpg', 'image/png', 'image/gif', 'image/jpeg']
|
|
5
|
-
/**
|
|
6
|
-
* 能够上传的图片后缀名称
|
|
7
|
-
*/
|
|
8
|
-
export const imageSuffixes = ['.jpe', '.jpeg', '.jpg', '.gif', '.png']
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 能够上传的视频类型
|
|
12
|
-
*/
|
|
13
|
-
export const videoTypes = ['video/3gpp', 'video/mpeg', 'application/mp4', 'video/mp4', 'video/ogg', 'video/x-flv', 'video/x-msvideo']
|
|
14
|
-
/**
|
|
15
|
-
* 能够上传的视频后缀名称
|
|
16
|
-
*/
|
|
17
|
-
export const videoSuffixes = ['.3gpp', '.mpeg', '.mpg', '.mp4', '.ogv', '.flv', '.avi']
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 能够上传的音频类型
|
|
21
|
-
*/
|
|
22
|
-
export const audioTypes = ['audio/x-wav', 'audio/x-ms-wma', 'audio/mp4', 'audio/mp3']
|
|
23
|
-
/**
|
|
24
|
-
* 能够上传的音频后缀名称
|
|
25
|
-
*/
|
|
26
|
-
export const audioSuffixes = ['.wav', '.wma', '.mp4a', '.mp3']
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 能够上传的文档类型
|
|
30
|
-
*/
|
|
31
|
-
export const officeTypes = ['application/x-msaccess', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', ' application/vnd.ms-powerpoint', 'application/vnd.ms-excel', ' application/msword', 'application/pdf', 'application/vnd.ms-works']
|
|
32
|
-
/**
|
|
33
|
-
* 能够上传的文档后缀名称
|
|
34
|
-
*/
|
|
35
|
-
export const officeSuffixes = ['.mdb', '.docx', '.xlsx', '.pptx', '.ppt', '.xls', '.doc', '.pdf']
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* 能够上传的文档类型
|
|
39
|
-
*/
|
|
40
|
-
export const textTypes = ['application/xml', 'application/x-sh', 'application/json', 'application/javascript', 'application/java-vm', 'application/java-archive', 'text/html', 'text/plain']
|
|
41
|
-
/**
|
|
42
|
-
* 能够上传的文档后缀名称
|
|
43
|
-
*/
|
|
44
|
-
export const textSuffixes = ['.xml', '.sh', '.json', '.js', '.class', '.jar', 'html', '.txt', '.wdb', '.wps']
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 能够上传的文档类型
|
|
48
|
-
*/
|
|
49
|
-
export const otherTypes = ['application/x-rar-compressed', 'application/x-msdownload', 'application/x-font-woff', ' application/x-font-ttf', 'application/x-7z-compressed', ' application/vnd.android.package-archive', 'application/zip']
|
|
50
|
-
/**
|
|
51
|
-
* 能够上传的文档后缀
|
|
52
|
-
*/
|
|
53
|
-
export const otherSuffixes = ['.rar', '.exe', '.woff', '.ttf', '.7z', '.apk', '.zip']
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* 能够上传的文件类型
|
|
57
|
-
*/
|
|
58
|
-
export const fileTypes = [...imageTypes, ...videoTypes, ...officeTypes, ...textTypes, ...otherTypes]
|
|
59
|
-
/**
|
|
60
|
-
* 能够上传的文件后缀
|
|
61
|
-
*/
|
|
62
|
-
export const fileSuffixes = [...imageSuffixes, ...videoSuffixes, ...officeSuffixes, ...textSuffixes, ...otherSuffixes]
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* 文档后缀对应的类型
|
|
66
|
-
*/
|
|
67
|
-
export const suffixTypes = [
|
|
68
|
-
{ type: 'pdf', suffixes: ['.pdf'] },
|
|
69
|
-
{ type: 'txt', suffixes: ['.txt'] },
|
|
70
|
-
{ type: 'excel', suffixes: ['.xls', '.xlsx'] },
|
|
71
|
-
{ type: 'word', suffixes: ['.doc', '.docx'] },
|
|
72
|
-
{ type: 'ppt', suffixes: ['.ppt', '.pptx'] },
|
|
73
|
-
{ type: 'zip', suffixes: ['.zip', '.rar', '.7z'] }
|
|
74
|
-
]
|
|
1
|
+
/**
|
|
2
|
+
* 能够上传的图片类型
|
|
3
|
+
*/
|
|
4
|
+
export const imageTypes = ['image/jpg', 'image/png', 'image/gif', 'image/jpeg']
|
|
5
|
+
/**
|
|
6
|
+
* 能够上传的图片后缀名称
|
|
7
|
+
*/
|
|
8
|
+
export const imageSuffixes = ['.jpe', '.jpeg', '.jpg', '.gif', '.png']
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 能够上传的视频类型
|
|
12
|
+
*/
|
|
13
|
+
export const videoTypes = ['video/3gpp', 'video/mpeg', 'application/mp4', 'video/mp4', 'video/ogg', 'video/x-flv', 'video/x-msvideo']
|
|
14
|
+
/**
|
|
15
|
+
* 能够上传的视频后缀名称
|
|
16
|
+
*/
|
|
17
|
+
export const videoSuffixes = ['.3gpp', '.mpeg', '.mpg', '.mp4', '.ogv', '.flv', '.avi']
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 能够上传的音频类型
|
|
21
|
+
*/
|
|
22
|
+
export const audioTypes = ['audio/x-wav', 'audio/x-ms-wma', 'audio/mp4', 'audio/mp3']
|
|
23
|
+
/**
|
|
24
|
+
* 能够上传的音频后缀名称
|
|
25
|
+
*/
|
|
26
|
+
export const audioSuffixes = ['.wav', '.wma', '.mp4a', '.mp3']
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 能够上传的文档类型
|
|
30
|
+
*/
|
|
31
|
+
export const officeTypes = ['application/x-msaccess', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', ' application/vnd.ms-powerpoint', 'application/vnd.ms-excel', ' application/msword', 'application/pdf', 'application/vnd.ms-works']
|
|
32
|
+
/**
|
|
33
|
+
* 能够上传的文档后缀名称
|
|
34
|
+
*/
|
|
35
|
+
export const officeSuffixes = ['.mdb', '.docx', '.xlsx', '.pptx', '.ppt', '.xls', '.doc', '.pdf']
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 能够上传的文档类型
|
|
39
|
+
*/
|
|
40
|
+
export const textTypes = ['application/xml', 'application/x-sh', 'application/json', 'application/javascript', 'application/java-vm', 'application/java-archive', 'text/html', 'text/plain']
|
|
41
|
+
/**
|
|
42
|
+
* 能够上传的文档后缀名称
|
|
43
|
+
*/
|
|
44
|
+
export const textSuffixes = ['.xml', '.sh', '.json', '.js', '.class', '.jar', 'html', '.txt', '.wdb', '.wps']
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 能够上传的文档类型
|
|
48
|
+
*/
|
|
49
|
+
export const otherTypes = ['application/x-rar-compressed', 'application/x-msdownload', 'application/x-font-woff', ' application/x-font-ttf', 'application/x-7z-compressed', ' application/vnd.android.package-archive', 'application/zip']
|
|
50
|
+
/**
|
|
51
|
+
* 能够上传的文档后缀
|
|
52
|
+
*/
|
|
53
|
+
export const otherSuffixes = ['.rar', '.exe', '.woff', '.ttf', '.7z', '.apk', '.zip']
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 能够上传的文件类型
|
|
57
|
+
*/
|
|
58
|
+
export const fileTypes = [...imageTypes, ...videoTypes, ...officeTypes, ...textTypes, ...otherTypes]
|
|
59
|
+
/**
|
|
60
|
+
* 能够上传的文件后缀
|
|
61
|
+
*/
|
|
62
|
+
export const fileSuffixes = [...imageSuffixes, ...videoSuffixes, ...officeSuffixes, ...textSuffixes, ...otherSuffixes]
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 文档后缀对应的类型
|
|
66
|
+
*/
|
|
67
|
+
export const suffixTypes = [
|
|
68
|
+
{ type: 'pdf', suffixes: ['.pdf'] },
|
|
69
|
+
{ type: 'txt', suffixes: ['.txt'] },
|
|
70
|
+
{ type: 'excel', suffixes: ['.xls', '.xlsx'] },
|
|
71
|
+
{ type: 'word', suffixes: ['.doc', '.docx'] },
|
|
72
|
+
{ type: 'ppt', suffixes: ['.ppt', '.pptx'] },
|
|
73
|
+
{ type: 'zip', suffixes: ['.zip', '.rar', '.7z'] }
|
|
74
|
+
]
|
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
export interface IMixinsProps {
|
|
2
|
-
modelValue?: any
|
|
3
|
-
field: string
|
|
4
|
-
rowIndex?: number
|
|
5
|
-
loading?: boolean
|
|
6
|
-
desc: { [key: string]: any }
|
|
7
|
-
formData: { [key: string]: any }
|
|
8
|
-
isMobile?: boolean
|
|
9
|
-
defineEmits?: any
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 获取属性
|
|
14
|
-
* @param props
|
|
15
|
-
* @param customAttrs
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
export const getAttrs = async (props: IMixinsProps, customAttrs?: { [key: string]: any }) => {
|
|
19
|
-
// 合并属性
|
|
20
|
-
const attrs = Object.assign({}, customAttrs, props.desc?._attrs, props.desc?.attrs, getPlaceholder(props.desc))
|
|
21
|
-
|
|
22
|
-
// 处理多选
|
|
23
|
-
if (props.desc.multiple) {
|
|
24
|
-
attrs.multiple = true
|
|
25
|
-
attrs.showCheckbox = true
|
|
26
|
-
if (['select'].indexOf(props.desc.type) >= 0) {
|
|
27
|
-
attrs.collapseTags = props.desc.attrs?.collapseTags ?? false
|
|
28
|
-
attrs.collapseTagsTooltip = props.desc.attrs?.collapseTagsTooltip ?? false
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// if (['area'].indexOf(props.desc.type) >= 0) {
|
|
33
|
-
// delete attrs.options
|
|
34
|
-
// }
|
|
35
|
-
|
|
36
|
-
// 处理下elType
|
|
37
|
-
if (props.desc.elType) {
|
|
38
|
-
if (typeof props.desc.elType === 'function') {
|
|
39
|
-
attrs.type = props.desc.elType(props.formData)
|
|
40
|
-
} else {
|
|
41
|
-
attrs.type = props.desc.elType
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return attrs
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 获取事件
|
|
49
|
-
* @returns
|
|
50
|
-
*/
|
|
51
|
-
export const getEvents = (props: IMixinsProps) => {
|
|
52
|
-
const tempOn = {} as any
|
|
53
|
-
if (props.desc?.on) {
|
|
54
|
-
Object.keys(props.desc.on).map((key: string) => {
|
|
55
|
-
tempOn[key] = (val: any) => {
|
|
56
|
-
props.desc.on[key](props.formData, props.rowIndex, val)
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
return tempOn
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* 根据类型获取属性 placeholder
|
|
65
|
-
* @param desc
|
|
66
|
-
* @returns
|
|
67
|
-
*/
|
|
68
|
-
function getPlaceholder(desc: { [key: string]: any }) {
|
|
69
|
-
if (!desc || !desc.type) return ''
|
|
70
|
-
switch (desc.type) {
|
|
71
|
-
case 'input':
|
|
72
|
-
case 'nbinput':
|
|
73
|
-
case 'password':
|
|
74
|
-
case 'number':
|
|
75
|
-
case 'validCode':
|
|
76
|
-
case 'tag':
|
|
77
|
-
return { placeholder: desc?.placeholder || '请输入' + desc?._label }
|
|
78
|
-
case 'switch':
|
|
79
|
-
return {}
|
|
80
|
-
case 'area':
|
|
81
|
-
case 'select':
|
|
82
|
-
case 'category':
|
|
83
|
-
case 'cascader':
|
|
84
|
-
return { placeholder: desc?.placeholder || '请选择' + (desc.remote ? (desc.initLoad !== false ? '(默认查10个,其余请输入搜索)' : '或输入进行搜索') : desc?._label) }
|
|
85
|
-
case 'data':
|
|
86
|
-
case 'datetime':
|
|
87
|
-
case 'datas':
|
|
88
|
-
return { placeholder: '选择日期' }
|
|
89
|
-
case 'daterange':
|
|
90
|
-
case 'datetimerange':
|
|
91
|
-
case 'timerange':
|
|
92
|
-
case 'monthrange':
|
|
93
|
-
return {
|
|
94
|
-
startPlaceholder: '开始日期',
|
|
95
|
-
endPlaceholder: '结束日期'
|
|
96
|
-
}
|
|
97
|
-
case 'dates':
|
|
98
|
-
return { placeholder: '选择一个或多个日期' }
|
|
99
|
-
case 'month':
|
|
100
|
-
return { placeholder: '选择月' }
|
|
101
|
-
case 'time':
|
|
102
|
-
case 'timsPicker':
|
|
103
|
-
return { placeholder: '请选择时间' }
|
|
104
|
-
case 'week':
|
|
105
|
-
return { placeholder: '请选择周' }
|
|
106
|
-
case 'year':
|
|
107
|
-
return { placeholder: '请选择年' }
|
|
108
|
-
case 'upimg':
|
|
109
|
-
return { placeholder: '请上传' }
|
|
110
|
-
case 'upfile':
|
|
111
|
-
return { placeholder: '点击上传' }
|
|
112
|
-
}
|
|
113
|
-
}
|
|
1
|
+
export interface IMixinsProps {
|
|
2
|
+
modelValue?: any
|
|
3
|
+
field: string
|
|
4
|
+
rowIndex?: number
|
|
5
|
+
loading?: boolean
|
|
6
|
+
desc: { [key: string]: any }
|
|
7
|
+
formData: { [key: string]: any }
|
|
8
|
+
isMobile?: boolean
|
|
9
|
+
defineEmits?: any
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 获取属性
|
|
14
|
+
* @param props
|
|
15
|
+
* @param customAttrs
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export const getAttrs = async (props: IMixinsProps, customAttrs?: { [key: string]: any }) => {
|
|
19
|
+
// 合并属性
|
|
20
|
+
const attrs = Object.assign({}, customAttrs, props.desc?._attrs, props.desc?.attrs, getPlaceholder(props.desc))
|
|
21
|
+
|
|
22
|
+
// 处理多选
|
|
23
|
+
if (props.desc.multiple) {
|
|
24
|
+
attrs.multiple = true
|
|
25
|
+
attrs.showCheckbox = true
|
|
26
|
+
if (['select'].indexOf(props.desc.type) >= 0) {
|
|
27
|
+
attrs.collapseTags = props.desc.attrs?.collapseTags ?? false
|
|
28
|
+
attrs.collapseTagsTooltip = props.desc.attrs?.collapseTagsTooltip ?? false
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// if (['area'].indexOf(props.desc.type) >= 0) {
|
|
33
|
+
// delete attrs.options
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
// 处理下elType
|
|
37
|
+
if (props.desc.elType) {
|
|
38
|
+
if (typeof props.desc.elType === 'function') {
|
|
39
|
+
attrs.type = props.desc.elType(props.formData)
|
|
40
|
+
} else {
|
|
41
|
+
attrs.type = props.desc.elType
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return attrs
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 获取事件
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
export const getEvents = (props: IMixinsProps) => {
|
|
52
|
+
const tempOn = {} as any
|
|
53
|
+
if (props.desc?.on) {
|
|
54
|
+
Object.keys(props.desc.on).map((key: string) => {
|
|
55
|
+
tempOn[key] = (val: any) => {
|
|
56
|
+
props.desc.on[key](props.formData, props.rowIndex, val)
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
return tempOn
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 根据类型获取属性 placeholder
|
|
65
|
+
* @param desc
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
function getPlaceholder(desc: { [key: string]: any }) {
|
|
69
|
+
if (!desc || !desc.type) return ''
|
|
70
|
+
switch (desc.type) {
|
|
71
|
+
case 'input':
|
|
72
|
+
case 'nbinput':
|
|
73
|
+
case 'password':
|
|
74
|
+
case 'number':
|
|
75
|
+
case 'validCode':
|
|
76
|
+
case 'tag':
|
|
77
|
+
return { placeholder: desc?.placeholder || '请输入' + desc?._label }
|
|
78
|
+
case 'switch':
|
|
79
|
+
return {}
|
|
80
|
+
case 'area':
|
|
81
|
+
case 'select':
|
|
82
|
+
case 'category':
|
|
83
|
+
case 'cascader':
|
|
84
|
+
return { placeholder: desc?.placeholder || '请选择' + (desc.remote ? (desc.initLoad !== false ? '(默认查10个,其余请输入搜索)' : '或输入进行搜索') : desc?._label) }
|
|
85
|
+
case 'data':
|
|
86
|
+
case 'datetime':
|
|
87
|
+
case 'datas':
|
|
88
|
+
return { placeholder: '选择日期' }
|
|
89
|
+
case 'daterange':
|
|
90
|
+
case 'datetimerange':
|
|
91
|
+
case 'timerange':
|
|
92
|
+
case 'monthrange':
|
|
93
|
+
return {
|
|
94
|
+
startPlaceholder: '开始日期',
|
|
95
|
+
endPlaceholder: '结束日期'
|
|
96
|
+
}
|
|
97
|
+
case 'dates':
|
|
98
|
+
return { placeholder: '选择一个或多个日期' }
|
|
99
|
+
case 'month':
|
|
100
|
+
return { placeholder: '选择月' }
|
|
101
|
+
case 'time':
|
|
102
|
+
case 'timsPicker':
|
|
103
|
+
return { placeholder: '请选择时间' }
|
|
104
|
+
case 'week':
|
|
105
|
+
return { placeholder: '请选择周' }
|
|
106
|
+
case 'year':
|
|
107
|
+
return { placeholder: '请选择年' }
|
|
108
|
+
case 'upimg':
|
|
109
|
+
return { placeholder: '请上传' }
|
|
110
|
+
case 'upfile':
|
|
111
|
+
return { placeholder: '点击上传' }
|
|
112
|
+
}
|
|
113
|
+
}
|